analogdevicesinc / msdk

Software Development Kit for Analog Device's MAX-series microcontrollers
Apache License 2.0
60 stars 75 forks source link

MAX78000: issues with external SPI RAM (aps6404l) in quad mode #1053

Open alessandro-montanari opened 1 week ago

alessandro-montanari commented 1 week ago

I'm using an external SPI RAM (aps6404l) connected to SPI0 and it works well when I use it in standard 4-wire SPI mode. I can read and write data fine. I am using the sync Master Transactions API.

However, when I enable Quad mode the write operation seems to work but the read operation hangs in the SDK functions.

I did a bit of debugging and it appears that the Master Done flag bit in the SPI0 INTFL register doesn't get set. This means that the function MXC_SPI_RevA1_MasterTransaction never returns since there is this loop while (!((req->spi)->intfl & MXC_F_SPI_REVA_INTFL_MST_DONE)) {}. This is strange because if I inspect the request it seems that all the data has been read: rx_len is what I expect and the buffer seems to contain the data I expect.

I then noticed that if I try to read 75 bytes or less the Master Done flag gets set correctly but if I try to read more bytes it doesn't. This doesn't happen in 4-wire mode where I can read different buffer sizes just fine.

All of this happens using an SPI frequency of 24MHz, if I increase it to 50MHz I can only write data to the RAM but I cannot read anything, not even buffers smaller than 75 bytes. Again, in standard 4-wire mode, this is not an issue, I can use 50MHz and read/write just fine.

I'm a bit confused on what's going on, especially because it seems the transaction is completed but the flag is not set. And also, why it only works for buffers smaller than 75 bytes.