QSPI on TC377 with iLLD

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

cross mob
IvanoBono
Level 3
Level 3
25 sign-ins 10 sign-ins 10 replies posted
[aurix TC377; iLLD_1_0_1_13_0__TC37A; tasking IDE]

I am implementing the SPI by relying on the IfxQspi_SpiMaster_initChannel, IfxQspi_SpiMaster_initModule, and IfxQspi_SpiMaster_exchange functions.
It works regularly but I have seen that every sending / receiving of data is done using:
SpiIf_Status IfxQspi_SpiMaster_exchange (IfxQspi_SpiMaster_Channel * chHandle, const void * src, void * dest, Ifx_SizeT count)
where I have to specify the send buffer, the receive buffer and the length.
I have to read the data from an ATMEL memory and I have to send a page read command (0xD2) followed by 3 bytes that identify the address to be read, and finally by many DUMMY bytes equal to the number of bytes I have to receive
The atmel, for the first 4 bytes (command reception phase) returns 0xFF, then starts with the actual data.
So if I have to receive 256bytes I have to prepare a send buffer of 260byte (with the first 4 filled in with the command and address) and a reception buffer of another 260byte (in which the first 4 bytes must be filled with 0xFF and then they will start the data)
If the page I was supposed to read had to be inserted into a 256byte array it forces me to make another copy by taking only the good data from the receive buffer and copying it back into my array.

It seems to me a little optimized procedure ...

The alternative could be to break the command into 2: one for the command and one for receiving the data, but to do this I have to give up the automatic CS management because otherwise at the end of the first command the CS is disabled by interrupting the procedure.

Is this really the case or is there some alternative way that I have not identified?

Thank you in advance.
0 Likes
0 Replies