AnsweredAssumed Answered

How does the DSPI driver of the R41Z work?

Question asked by Cristina Alvarez on Jan 16, 2020
Latest reply on Jan 21, 2020 by Sebastián Del Río

Hello community,

I am trying to communicate a R41Z-TA-A to a Serial Flash device (SST25VF040B) which uses the SPI. I've got an example library for the Serial Flash and I want to do my own driver for the flash but with the functions of the examples.

 

First of all I was trying to understand the examples given on the SDK that uses the DSPI. I am using the dspi_polling_transfer as base (although I've change almost everything), the r41z as master and the flash as slave. Here is the code for the configuration of the master:

 

master config

The flash needs the CE or CS (Chip Select or Chip Enable) to be Low in order to be active that's why I set the pcsActiveHighOrLow to kDSPI_PcsActiveLow. Is that enough to set the CS from high to low each time that I want to send a command from the r41z to the flash or should I do something else in addition?

 

Next problem: As I mentioned I want to send simple commands, a byte bit by bit with each clock cycle (that's how the flash works) so I am trying to use the simplest functions of the DSPI driver as following:

For the second function (Send_Byte) I'm not sure if I have to send bit by bit (the commented code) or if the function DSPI_MasterWriteData allready sends the byte bit by bit with each clock cycle. After sending that byte the flash is suppossed to send back another byte, but I get always the same answer so I guess I'm doing something wrong. So here's the second question: does any function of the driver send a byte bit by bit with each clock cycle? Am I using correctly the DSPI_MasterWriteData function? Should I use a different one?

 

Also I would need the same for the Get_Byte function because I'm also not sure if the reading is ok or not.

 

Finally I post here the main code:

 

Thank you all for your time. 

Regards,

Cristina.

Outcomes