I run into the problem of sending 10 Bytes of data, but TDR size is 32Bit. I tried several possibilities, as found in the NXP community:
// for loop: //for ( index = 0; index < sequence_length; ++index) {
// for loop: //LPSPI1->TDR = &txbuffer[index]; /* Transmit data */
// for loop: //}
// cast to 32Bit words
// LPSPI1->TDR = ((uint32_t)txbuffer[index] << 24)
// |((uint32_t)txbuffer[index+1] << 16)
// |((uint32_t)txbuffer[index+2] <<
// |((uint32_t)txbuffer[index+3] ) ;
// LPSPI1->TDR = ((uint32_t)txbuffer[index+4] << 24)
// |((uint32_t)txbuffer[index+5] << 16)
// |((uint32_t)txbuffer[index+6] <<
// |((uint32_t)txbuffer[index+7] ) ;
// LPSPI1->TDR = ((uint32_t)txbuffer[index+8] << 24)
// |((uint32_t)txbuffer[index+9] << 16);
Nothing is working, also receiving more than 32 Bits is not working!
How should the sending and receiving of data greater than 32Bit word file be implemented?
and How should the framesize be adjusted? (I changed it to 80bits)
Hello Maurice,
Could you please elaborate on what exactly does not work?
Can you scope the bus and share it?
I modified the S32K144_Project_LPSPI example from the S32DS IDE to send 80b frames.
Because it does not read the RX data, CFGR1_NOSTALL = 1.
Regards,
Daniel
Hi Daniel,
thank you for the example.
But my problem actual is the change of the framsize during runtime. I have SPI messages that are 3 Bytes long. And then I have to write 10 Bytes and read 10 Bytes. My problem is, that when I watch the framsesize in TCR register, it will only change from 23 bit to 79 bit when I step through. In running mode (without breakpoints) the Framsesize changes somehow to 0x05F...but this value is never been written to the TCR.
Do you have an example where the framesize is changed ? Attached I have
Hi Maurice.
You probably mask the register (read-modify-write operation)
TCR |= new_command;
because
23 = 0x17
79 = 0x4F
0x17 | 0x4F = 0x5F.
Please write the PCR register with a 32b word directly.
TCR = command_framesize_80b;
TCR = command_framesize_24b;
Thank you,
BR, Daniel