hi, Im trying spi communication using S32K148 with VN9D30Q100F.
Occasionally, when receiving SDO data from the VN9D30Q100F to the S32K148, the SPI error bit in the global status bit of the response data (SDO) is set to 1.
I think a reason of this error is that the time between the chip select signal goes low and the sdi is sent is too long.
in VN9D30Q100F's data sheet, max time of CSN(chip select) low to output valid is 200ns. but current this time is checked 34.7us.
How can I reduce time?
Hi,
Yes from the code you are using software CS control. After switching to hardware CS, it should be faster, also you can change the PCSSCK value by baremetal code to adjust the time.
Best wishes,
Jeremy
Is that only one solution?
actually i don't know how to write bare metal code.
and if some solution to set values in PCSSCK using components library is exist, could you tell me about that? or could you show me a picture of PCSSCK bare metal code examples?
Hi Han,
please try
LPSPI0->CCR &= ~LPSPI_CCR_PCSSCK_MASK;
LPSPI0->CCR |= LPSPI_CCR_PCSSCK(0x03);
In this case, LPSPI0 is used, and PCSSCK is set to 0x03.
When you chose Hardware CS, CS pin is controlled by hardware. It will be set automatically when you call MasterTransfer().
Best wishes,
Jeremy
Does the CS pin(PTA15) controlled by GPIO instead of SPI?
If true, 1 method to reduce time is that making the CS pin controlled by SPI and only call MasterTransfer().
Two additional GPIO operation added some unnecessary time consumption in time-limited app.
yes, now i control chip select pin using gpio functions.
after than i check time that use only gpio funtions. in this case, consumed time was verry short.
i think SPI_MasterTransfer function consumed long time.
and how can i control CS pin using call MasterTransfer()?