QSPIv2 driver issues H757I EVAL Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
sidbh
Posts: 8
Joined: Sat Sep 02, 2017 2:03 pm
Been thanked: 2 times

QSPIv2 driver issues H757I EVAL

Post by sidbh »

I have been trying to interface with MT25Q using QSPIv2. I have send command working perfectly including the MDMA, but I had to make changes to QSPIv2 driver. Firstly, I noticed a clear bug in the following lines of code:

Code: Select all

  uint32_t ccr  = STM32_MDMA_CCR_PL(STM32_WSPI_QUADSPI1_MDMA_PRIORITY) |
                  STM32_MDMA_CCR_CTCIE          |   /* On transfer complete.*/
                  STM32_MDMA_CCR_TCIE;              /* On transfer error.   */


It should be

Code: Select all

STM32_MDMA_CCR_TEIE
instead of

Code: Select all

STM32_MDMA_CCR_TCIE


Secondly, the driver uses MDMA_REQUEST_QUADSPI_TC signal to MDMA for sending the data, which I think is not correct. In the datasheet section 23.3.12 it says
In case of data transmission (FMODE = 00 and DMODE! = 00), the communication start is
triggered by a write in the FIFO through QUADSPI_DR.
so when the send is entered with this condition the transfer would never take place. I believe MDMA_REQUEST_QUADSPI_FIFO_TH is the correct signal, and I tested it to fix the hang while sending where the above mentioned condition is met.

So, at this stage the Data out is working as intended, double checked on Logic Analyser. Now I am stuck at the issue of receiving the data. I can clearly see the instruction being sent on the bus without issue, and the chip responds as expected, and I can see the bytes appearing in the DR register of QSPI and also FLEVEL value being set correctly to show bytes have successfully been received by QSPI peripheral and retained in FIFO. But from here on forth, the copy by MDMA from DR to memory does not take place.I can see the CNBTR value decreasing to 0 from previous set transaction size, but the bytes in the memory are not even being overwritten with some value, tested by setting the buffer with fill value before hand and checking after the transaction is over. I also observed that at the end of the MDMA transaction completion the QSPI has its DR FIFO flushed as well. I can confirm that the memory is located in AXI SRAM (0x24000000) as required, and have tried with both MDMA_REQUEST_QUADSPI_FIFO_TH and MDMA_REQUEST_QUADSPI_TC signals resulting in similar behaviour. Any direction from here onwards to debug the issue will be greatly appreciated.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: QSPIv2 driver issues H757I EVAL

Post by Giovanni »

Hi,

Moving this topic in "bug reports".

I don't have a board to test this driver, do you mind posting a patch here if you get it fully working? other QSPI and OSPI drivers are functional so it cannot be entirely broken.

Giovanni
sidbh
Posts: 8
Joined: Sat Sep 02, 2017 2:03 pm
Been thanked: 2 times

Re: QSPIv2 driver issues H757I EVAL

Post by sidbh »

Hi Giovanni,
I will certainly do that. Any thoughts on tracking down the MDMA issue?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: QSPIv2 driver issues H757I EVAL

Post by Giovanni »

Not right now, lets see if others have ideas about this.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: QSPIv2 driver issues H757I EVAL

Post by Giovanni »

Hi,

One of our devs apparently has the driver working, he is checking if it is aligned with trunk.

Giovanni
sidbh
Posts: 8
Joined: Sat Sep 02, 2017 2:03 pm
Been thanked: 2 times

Re: QSPIv2 driver issues H757I EVAL

Post by sidbh »

Great! will be waiting for the sample code.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: QSPIv2 driver issues H757I EVAL

Post by Giovanni »

Hi,

About data not being received, is your buffer cacheable? it is possible that the CPU sees data in cache not what DMA has written in RAM.

Giovanni
sidbh
Posts: 8
Joined: Sat Sep 02, 2017 2:03 pm
Been thanked: 2 times

Re: QSPIv2 driver issues H757I EVAL

Post by sidbh »

Yeah, that fixed the issue, the RAM was set to be cacheable, I just added SCB_CleanInvalidateDCache(); before wspiReceive return to quickly test this. But ofcourse the right way would be to disable the Cache on the region entirely. Additionally Transfer Complete signal to MDMA doesn't work for Receive either, needed to set to FIFO Level Threshold signal for that as well. I will be running the entire WSPI-MFS suite after some cleanup. I will also share my patches later this week. Thanks for your help!
sidbh
Posts: 8
Joined: Sat Sep 02, 2017 2:03 pm
Been thanked: 2 times

Re: QSPIv2 driver issues H757I EVAL

Post by sidbh »

Hi Giovanni,
Please find the patches for the changes I added below.
patches.zip
(3.76 KiB) Downloaded 453 times


Patch "0002-QSPIv2-set-FCR-to-clear-pending-flags-if-any.patch" is just out of paranoia, I didn't as such notice any issue except when using TC signal, which sometimes remained set when arriving at this line, I didn't dig much into it though. I haven't run entire MFS example yet, but it seemed to at least go through snorMemoryMap and snorMemoryUnmap.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: QSPIv2 driver issues H757I EVAL

Post by Giovanni »

Hi,

MFS has a test suite, you may try to run that for validation. See the MFS demo.

Giovanni
Post Reply