Delay with GPIO as Chip Select at LPSPI Transfer

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

Delay with GPIO as Chip Select at LPSPI Transfer

533 Views
Berni22_05
Contributor I

Hi everyone,

 

i tried to use an GPIO as CS for LPSPI Transfers with the Transfer API. At the MCUXpresso Config Tool there must be a PCSx selected at the Peripherals section. I use the function "LPSPI_MasterTransferNonBlocking" with the transfer struct to transmit/receive data.

The CS is asserted bevor entering the TransferNonBlocking function and is deasserted at the Callback of the LPSPI1. The issues is that the CS gets High a long time after the transfer is completed.

Without using a GPIO (CS is managed by Transfer function) the CS is disabled immediately after completion.

Is there any possiblity to use CS as GPIO without setting a PCSx at the MCUXpresso Config Tool?

How can i avoid the delay with CS as GPIO?

 

Board: MIMXRT1170-EVK

MCUXpresso IDE: v11.4.1

I am very garteful for creative suggestions.

Best regards

Berni

 

 

 

 

Labels (1)
0 Kudos
1 Reply

511 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Berni22_05 ,

   Thank you for your interest in the NXP MIMXRT Product, I would like to provide service for you!

  Answer your two questions:

1 . Is there any possiblity to use CS as GPIO without setting a PCSx at the MCUXpresso Config Tool?

=>Answer: In fact, even in the peripheral LPSPI you select PCS0 as the chip select, it's OK. As the detail CS pin, you should still need to configure the correct pin mux, so in the pinmux, you still can configure your required pin as the GPIO function, not the LPSPI CS function.

2 How can i avoid the delay with CS as GPIO?

=>Answer:  As the GPIO is using the code to control it, so, it will have delay more than the IP controlled PCS pin, so to the delay, you may just can minimize it, but can avoid, as you know, SPI API control need time, then GPIO control code also need time. now, if you want to minimize the CS, just need to find the correct code area, then insert your GPIO control, eg, when the SPI is finished the transfer, the related flag is set, then you check that flag is set, then insert the GPIO pull up code.

This is my own testing experience.

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos