Re: #mqtt #mqtt

Boie, Andrew P

Unless I'm missing something there's nothing preventing you from calling fifo APIs inside an ISR.

Otherwise, there would be assertions about it in kernel/queue.c



From: users@... [mailto:users@...] On Behalf Of Prabhu Vinod, Karthik
Sent: Tuesday, February 5, 2019 9:22 AM
To: Lubos, Robert <robert.lubos@...>; users@...
Subject: Re: [Zephyr-users] #mqtt


Thanks for the reply lubos.  Ok,  because I am slightly confused since I ran k_is_in_isr() inside evt_handler inside MQTT_PUBLISH and it returned 1 which means the code was running inside an ISR.


Many Regards,

Karthik Prabhu Vinod


Help save the planet by choosing not to use single use plastics. Pick paper, bamboo or metal cutlery and carry your own bag to the grocery store. Every little thing you do makes an impact.


From: <users@...> on behalf of "Lubos, Robert" <robert.lubos@...>
Date: Tuesday, February 5, 2019 at 12:29 AM
To: "Karthik Prabhu Vinod (Intel)" <karthik.prabhu.vinod@...>, "users@..." <users@...>
Subject: Re: [Zephyr-users] #mqtt


Hello Karthik,


MQTT event callback will run in the same thread from which you call `mqtt_input` function. So in case you call it from ISR (not recommended), the event callback will also run from ISR. I’m not sure how Zephyr’s test engine works internally, but perhaps it’s tests are run from ISR context. So while the code in the test might be fine to read and analyze, perhaps you should move it to real sample if you want to play with it.


I’m also not sure that you problems pertain from calling `k_fifo_put` form the IRQ context. According to documentation, this kernel function is safe to call from ISR, and I know it is used that way in existing code.



Robert Lubos


From: users@... [mailto:users@...] On Behalf Of Prabhu Vinod, Karthik
Sent: Monday, February 4, 2019 19:22
To: users@...
Subject: [Zephyr-users] #mqtt



This is a request for tips and advice or any other suggestion. I am trying to populate a fifo queue here: .  I realized i cant do that directly because I get a data access violation since the mqtt callback runs in a ISR. I verified this by k_is_in_isr().

So I delegated or offloaded the k_fifo_put work to a system work queue. Now, k_fifo_put runs inside a system work queue thread. But even then, I get an Unaligned data access.

I know there is not enough data to troubleshoot, But am I doing something obviously wrong. Any comments or hints or tips?

I did reference a lot of samples while trying this.

Join to automatically receive all group messages.