LPSPI Chip Select Frequency S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPSPI Chip Select Frequency S32K144

2,967 Views
vladdamian
Contributor I

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!

190546_190546.jpgchip_select_LOW_period2.jpg

 

190547_190547.jpgchip_select_LOW_period1.jpg

Original Attachment has been moved to: lpspi_transfer_example.zip

0 Kudos
Reply
8 Replies

2,378 Views
vladdamian
Contributor I

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!

0 Kudos
Reply

2,378 Views
razva_tilimpea
NXP Employee
NXP Employee

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

0 Kudos
Reply

2,378 Views
vladdamian
Contributor I

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 !

0 Kudos
Reply

2,378 Views
razva_tilimpea
NXP Employee
NXP Employee

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

0 Kudos
Reply

2,378 Views
vladdamian
Contributor I

Hi,

I have attached the project.

Is basically a demo code from examples with some minor modifications.

Thank you for help again !

0 Kudos
Reply

2,378 Views
razva_tilimpea
NXP Employee
NXP Employee

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

0 Kudos
Reply

2,378 Views
vladdamian
Contributor I

Hi Razvan,

Ok. will check and return with some feedback.

Thank you for help !

0 Kudos
Reply

2,378 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply