Using SCB Module as SPI NOR Flash Controller | Cypress Semiconductor
Using SCB Module as SPI NOR Flash Controller
My design - which is built at qty 25 prototype stage - connects a Cypress (formerly Spansion) S25FL512S NOR Flash memory IC with a CYBLE-222014-01 module using SPI. I've set up an SCB module and I'm trying to follow the instructions in the attached pdf given to me by a Cypress FAE. I renamed my SCB module to "SPIM" and my hardware-provided CS pin is called "NOR_CS" because I have a second device on the SPI bus that's using the dedicated SPIM:ss0_m pin for an accelerometer. I have 2 questions, one hardware and 1 software:
Hardware: The FAE advises that, can I force the SPIM:ss0_m pin dedicated to the accelerometer to stay high while I run the SPI bus to access the NOR but I'm not sure of the best way to do this so I'm looking for a recommendation on the best way. Maybe I should have dedicated a pullup resistor for this but that pin's also shared with SWDIO so I'd rather not if at all possible.
Software: In following the instructions, I found problems in slld_hal_example.c (zipped copy attached), it seems that the code was written for an earlier SPI module so not all the API commands match. In the file you'll see pairs of lines like this...
// SPIM_ReadRxData(); // drop a dummy byte // TM OLD LINE
SPIM_SpiUartReadRxData(); // drop a dummy byte
Where the first line is the old original line and the second is my 'translation'. However, there's a line that I can't find an obvious comparison to - now lines 54 and 55 in my file:
// while (0u == (SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE)) // TM OLD LINE
while (0u == (SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE))
That same command appears at line 95. Clearly, all that's needed is to check the status of the SPI bus to make sure that the previously requested transfer has finished but there's no "ReadTxStatus()" API in the list for the SCM module. Again, I'm looking for advice on how to replace this line.
If anyone has done the interface I'm attempting and wants to steer me in a different direction, I'm willing to listen - hopefully what will end up in this thread is a solution for all who follow in my footsteps.