XMC4500 relax kit - Spi communication

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16808
Level 1
Level 1
Hello, everybody,

I want to implement the SPI communication to a serial Falsh Memory.
I took a look at the example of the SPI communication with the flash memory on the XMC4500 relax kit.
The example works and can also be used for external flash memory, if you set the pin and channel accordingly.

My question for this, in the data sheet of the two flash memories the bits are transmitted on rising clock edge and read on falling clock edge.
However, the settings in the SPI master are inverted (transmit on falling clock edge/ receive on rising clock edge).
Images of the oscilloscope show that the signals are transmitted correctly. But why is the inverted setting correct?

I wrote a class that implements the SPI communication with the flash memory.
For a newly created project writing, reading and deleting works. If I copy the class into my current project,
which contains several processes and apps, only writing and deleting will work, but not reading. The settings are identical for both projects.
You can see from the oscilloscope images that the clock of a working project pauses after each word and then continues with the next word.
For the non-functioning project, the query of the status register is functional. However, the data of the memory cannot be read out.
The oscilloscope images show that the clock is oscillating over the entire receiving time and that the Slave Select does not increase at the end.
When debugging, this is reflected in the remaining line:
while(SPI_MASTER_NVM.runtime->rx_busy);

Sorry for the long text. I hope you can help me with the problem.

Many thanks and greetings
Tobi
0 Likes
1 Reply
User16808
Level 1
Level 1
Hello,

It's works now a little bit better.

I changed the mode from interrupt (as it is in the example code) to direct.
Deleting works and reading is done for any number of bytes. But writing doesn't work perfectly.
Depending on how many bytes I write, message is correct. But there is no pattern recognizable.
256 bytes can be written without errors. At 8, 14 and 41 bytes, however, an error occurs,
but 7 and 9 bytes can be written again. On the basis of the oscilloscope pictures it can be seen
that the slave select line goes high in the middle of the data transfer of the payload to be sent.
The behaviour is not apparent with the other data sets.

I hope, you have an idea, why it can be.

Kind regards
Tobi
0 Likes