Hello,
I am trying to understand some specs regarding SPI functionality on S32K144 processor.
First, I have opened and ran the LPSPI example provided. Then displayed my CHIP SELECT signal to the oscilloscope.
After configuring and checking all data transmited via SPI, I see that no matter what settings I do (related to the baudrate of transmission, BUS clock and other parameter changes), the CHIP select signal always waits between 20us-30us between two succesive transmissions. Other way said, The CHIP SELECT signal is HIGH, data is transmitted, then it goes LOW for aprox 20-30us, then the next data is transmitted.
This has anything to do with the SPI settings, or there are some interrupts used by Operating System (OSIF) to do something else between two consecutive transmissions?
I have attached some pictures (please check Δt value, at the bottom of graphic) .
Thank you!
Original Attachment has been moved to: lpspi_transfer_example.zip
Hi Daniel,
Forgot to mention...
I have used the other method provided in the library. Also, I ran this transfer in DMA mode (for transferring with high speeds):
LPSPI_DRV_MasterTransfer(FSL_SEND, &masterDataSend, &masterDataReceive, BUFFER_SIZE);
So this function also uses some mechanisms for delays, in order to prepare for next message?
PS: I have tested the code provided in the cookbook also. This is working as specified (1us delay between two transfers). I am working to configure this example to run at highest speed, in DMA mode.
Thank you!
Hi Vlad,
Did you use the LPSPI example as it is?
If the answer is yes I think you observe that delay because each transfer is initiated after ADC conversion complete. If you want to evaluate only LPSPI driver I think you should remove ADC and PWM from this example and try to use higher buffer sizes.
The highest frequency tested with LPSPI module is 20MHz in DMA mode and the example code will be available on the next release (EAR 0.8.5).
Best regards,
Razvan
Hi Razvan,
No, I didn't used the example as it was.
1.) The measurement was done after I commented the code related to the ADC and PWM and left just the the LPSPI_DRV_MasterTransfer function inside the infinite loop.
2.) I have used the LPSPI_DRV_MasterTransfer function, which is without blocking.
3.) I have tested various BUFFER_SIZEs.
What else should I try? Maybe I miss something obvious.
Thank you !
Hi,
Please share your project on this thread.
In you project did you use LPSPI_DRV_MasterSetDelay function? This function can configure the parameters like delay between transfers.
Other observation is that is not a good idea to use non-blocking transfers in infinite loop because almost all transfers returns STATUS_BUSY.
For basic tests I used blocking transfers in while loops with various buffers sizes and I didn't observed this issue.
Best regards,
Razvan
Hi,
I have attached the project.
Is basically a demo code from examples with some minor modifications.
Thank you for help again !
Hi,
I checked your project and that delay is caused by the overhead for set-up and finish a transfer.
Also, if you configure the lpspi at 5Mhz the interrupt mode is not suitable for for handling this transfer. Please use DMA.
If you want to enable the DMA please check this post: https://community.nxp.com/thread/456661 .
Best regards,
Razvan
Hi Razvan,
Ok. will check and return with some feedback.
Thank you for help !
Hello Vlad,
The SDK example uses blocking functions that wait for a transfer to be completed. The next transfer is then delayed because a new message needs to be prepared. It should depend on Bus frequency.
Regards,
Daniel