lpspi component Master configuration

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

lpspi component Master configuration

1,449 Views
dearwww2000
Contributor I

When I run example 'lpspi_transfer_s32k118' project , transfer one byte, will product twice interrupts 'void LPSPI0_IRQHandler(void)'.

Question : How to send byte in main-loop, and receive SPI data in ISR 'void LPSPI0_IRQHandler(void)'?

(purpose : only once go to ISR.)

Tags (3)
0 Kudos
3 Replies

1,345 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi 王 从伟

The SDK example uses the LPSPI_DRV_MasterTransferBlocking API function, this will set the interrupt mode for the transmission and the reception, these represent two interruptions. If you want to trigger only one time the interruptions when you send, you could set NULL the reception buffer:

LPSPI_DRV_MasterTransferBlocking(SEND, &masterDataSend, NULL, BUFFER_SIZE, TIMEOUT);

But if you pass null, the received bytes are ignored.

Hope this helps

Best regards

Jorge Alcala

0 Kudos

1,345 Views
dearwww2000
Contributor I

Dear Jorge Antonio Alcala Vazquez

I need only reception interrupt to get the slave-chip response word.

So I don't need send word interrupt.

But I can't known how to do ?

0 Kudos

1,345 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi 王 从伟

Similar as only sending, you can only receive, but you have to pass NULL to the parameter of sendBuffer.

LPSPI_DRV_MasterTransferBlocking(SEND, NULL, &masterDataReceive, BUFFER_SIZE, TIMEOUT);

Hope this helps

Best regards

Jorge Alcala

0 Kudos