S32K144EVB-Q100 LPSPI communication fail in button interrupt (IRQ)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K144EVB-Q100 LPSPI communication fail in button interrupt (IRQ)

跳至解决方案
2,401 次查看
Kavin-Sun
Contributor II

 

LPSPI not working  in  button interrupt (IRQ) using  S32K144

 

 

Hi everyone, 

I tried SPI communication in button interrupt handler.

But, it was not working. 

Hardware :    S32K144EVB-Q100 

Software :      lpspi_transfer_s32k144  (S32DS Project Example) 

                       --> Modified SW3 button interrupt function. 

 

1) Firstly, I use S32DS sample example. 

KavinSun_0-1634616968796.png

 

2) I attached 'button PTC13 interrupt ' 

KavinSun_1-1634617000450.pngKavinSun_2-1634617016762.pngKavinSun_3-1634617033019.png

 

 

In main( ) function , it is good working.

But, after when I push button SW3 , SPI was not work interrupt function in buttonISR(void). 

I attached software source. 

Please help me!. 

Thanks very much. 

0 项奖励
回复
1 解答
2,380 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

By debug your project, I find that it stuck at OSIF_SemaWait. The OSIF_SemaWait using interrupt of Systick, but the interrupt of Systick was pending.

OSIF_SemaWait.png

Would you please configure the priority of PORTC(your button isr) or Systick. So that the interrupt of Systick is able to run.
For example: 
INT_SYS_SetPriority(PORTC_IRQn,1);

By the way:
The Interrupt service routing should be a small non-blocking code, but you have a master blocking transfer function in your handler.
I would recommend to use interruption, or a flag in the handler of the interrupt to signal a new transfer.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
2,381 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

By debug your project, I find that it stuck at OSIF_SemaWait. The OSIF_SemaWait using interrupt of Systick, but the interrupt of Systick was pending.

OSIF_SemaWait.png

Would you please configure the priority of PORTC(your button isr) or Systick. So that the interrupt of Systick is able to run.
For example: 
INT_SYS_SetPriority(PORTC_IRQn,1);

By the way:
The Interrupt service routing should be a small non-blocking code, but you have a master blocking transfer function in your handler.
I would recommend to use interruption, or a flag in the handler of the interrupt to signal a new transfer.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

2,378 次查看
Kavin-Sun
Contributor II

Dear Robin_Shen

Thanks a lot !!!

It was work if I add below line. 

KavinSun_0-1634704224435.png

"I would recommend to use interruption, or a flag in the handler of the interrupt to signal a new transfer."--> I understand your recommend. I will do it. 

 

Have good day.!

0 项奖励
回复