Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
leonng
Level 3
Level 3
First like received First like given 10 questions asked

Hi there,

I'm trying to follow the TLF35584 data sheet (P.220) to clear IF flag.

After it triggers the NMI (ERS1), I try to use SPI during the NMI. Then, the SPI keep busy after calling "IfxQspi_SpiMaster_exchange". The iLLD library and DMA is used for SPI.

leonng_0-1652848592818.png

Can I use SPI with DMA during NMI? Or Is there a better way?

best regards,

leon

0 Likes
1 Solution
Prudhvi_E
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 25 likes received

Hello,

Thanks for the trial & update.

NMI implementation generally may be simple like storing the necessary debug information and ensuring the safe system because of the Trap. But if an SPI exchange is necessary, check if you exit from the NMI with interrupts enabled and wait in a loop then the ISR is triggered.

But if you want to execute the entire operation in the NMI context then you may need to follow previous approach which is working.

Regards,

Prudhvi.

View solution in original post

0 Likes
3 Replies
Prudhvi_E
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 25 likes received

Hello,

Are Interrupts enabled after ESR1 is triggered ? The flags that are checked for the status is updated only in the ISR called either after successful exchange or an error.

Also, I think the NMI has higher priority than the normal Tasks and ISRs and after a successful SPI exchange an ISR should be triggered and as NMI execution is still in progress, I suspect that this is blocking normal execution and hence the status flags are not set. Could you please check if this is a possibility in your case?

Also, is there any configuration done for PORT Emergency Stop corresponding to SPI pins when NMI is triggered?

Regards,

Prudhvi.

0 Likes

Hello,

Yes, after triggering ESR1, the NMI is run.

It is the problem that the NMI has the highest priority. The SPI ISR cannot be triggered at the moment. Then, I try to directly call the ISR, and it works. However, it doesn't seem like a good solution.

leonng_0-1653444354034.png

I don't make any change for PORT Emergency Stop.

best regards,

Leon

 

0 Likes
Prudhvi_E
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 25 likes received

Hello,

Thanks for the trial & update.

NMI implementation generally may be simple like storing the necessary debug information and ensuring the safe system because of the Trap. But if an SPI exchange is necessary, check if you exit from the NMI with interrupts enabled and wait in a loop then the ISR is triggered.

But if you want to execute the entire operation in the NMI context then you may need to follow previous approach which is working.

Regards,

Prudhvi.

0 Likes