cpu info:nrf5340
software:nrf connect sdk 1.6.1
hi professor,
In the uart interrupt I call k_fifo_put to trigger rx process thread but it is not take effect.What person cause this question?


cpu info:nrf5340
software:nrf connect sdk 1.6.1
hi professor,
In the uart interrupt I call k_fifo_put to trigger rx process thread but it is not take effect.What person cause this question?


Hello,
Have you verified through debugging that k_fifo_put() actually gets called?
Thanks,
Vidar
I'm sure k_fifo_put was called.
I see. So the uart irq is not processed until after gpio irq, even though the uart irq came first.
Is your UART IRQ configured as a Zero latency interrupt by any chance? The documentation states that you should not use kernel APIs from such interrupts and that it can lead to undefined behavior.
I use the "IRQ_DIRECT_CONNECT(SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQn, 0, nrfx_uarte_0_irq_handler,0)" to init uart irq. It is zero latency interrupt. But I use the "IRQ_CONNECT(SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQn, 0, nrfx_uarte_0_irq_handler, NULL, 0)" to init uart irq. The problem remains.So How to init uart irq? Actually I don't need zero latency interrupt.
Please pass 'nrfx_isr' to the IRQ_CONNECT() macro like we do in our nrfx sample here: https://github.com/nrfconnect/sdk-zephyr/blob/c3208e7ff49d22d8271f305344382e9306fdde99/samples/boards/nrf/nrfx/src/main.c#L37
According to the link, I use the "IRQ_CONNECT(SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQn, 0, nrfx_isr, nrfx_uarte_0_irq_handler, 0)" to init uart irq.But the problem remains.
Thanks for confirming. But I'm afraid I can't think of anything else that can cause this behavior. Are you able to share the rest of your code or create a minimal sample that will allow me to reproduce this here?
Edit: Can you show the struct declaration for sensor_operate_t ?
Thanks for confirming. But I'm afraid I can't think of anything else that can cause this behavior. Are you able to share the rest of your code or create a minimal sample that will allow me to reproduce this here?
Edit: Can you show the struct declaration for sensor_operate_t ?
typedef struct
{
void *fifo_reserved;
uint32_t uiSensorState;
}sensor_operate_t;
I'm unable to extract your *.rar file for some reason. Could you please try to upload it again and maybe as a .zip instead?
hi Vidar Berg,
Did you find any problems in my code?
Hi,
I have not found anything that could explain the error, but I notice you have changed the ID numbers you stored to the ucProcessChar[] array, which makes it more challenging to figure out what the original execution sequence was. I also noticed you have reverted back to using zero latency interrupts again. This is not recommended.
Could you try to use SEGGER SystemView as described in the link below to see whether the alg_thread is running after the UART event or not?
https://docs.zephyrproject.org/latest/guides/debug_tools/tracing/index.html
Thanks,
Vidar