_io_read in interrupts

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

_io_read in interrupts

1,135件の閲覧回数
billnd
Contributor IV

Is it safe to use _io_read functions from an interrupt if IO_SERIAL_NON_BLOCKING has been set? Documentation is a bit ambiguous.

2 返答(返信)

765件の閲覧回数
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Billnd,

The best practice for interrupt is to just flag or signalize something (semaphore, mutex, etc) you shall not execute functions. The stack accumulation could cause a stack overflow in the stack level. I would recomend to start a high priority task that just goes and read when you receive an interruption. The isr will just start the task. Then the task will go, read and go back to sleep.

I hope this helps you.

Regards,

Garabo

765件の閲覧回数
RadekS
NXP Employee
NXP Employee

As Garabo said, it is not correct approach (use _io_read functions from an interrupt).

In fact, there also depends on IO driver implementation.

It is obvious that IO drivers which using interrupts cannot be used inside interrupt routine – for example SPI driver in MQX4.0.2.

Some of IO drivers could work when pooling method is used in driver – for example Legacy SPI driver in MQX4.0.2 but this is rather side effect of trivial implementation of this driver.

So, general recommendation is not to use _io_read functions from an interrupt.