I am trying to hook openthread with freeRTOS.
Short story: the current state of my implementation is that I get a hardfault after succesfully calling mqttsn_client_search_gateway, but before receiving any data on the other end on the mqtt-sn gateway. The stack at this point starts in
> strace
warning: Couldn't determine the static tracepoint marker to probe
Static tracepoint 16 at 0x7d8a: file nRF5_SDK\external\freertos\portable\GCC\nrf52\port.c, line 104.
Long story:
From freeRTOS, I am mostly interested in tasks and message queues.
My skeleton implementation has 2 tasks:
1. the openthread processing thread:
and starting it like in one of the examples:
The other task is a state machine to handle different states in the connection process:
- initializing the thread structures
- joining a thread network: role changes to CHILD or ROUTER
- searching for a mqtt-sn gateway
- connecting the mqtt client, etc.
Here's how I start the state machine task (ConnectionStateMachine is a singleton for some other reasons later on) :
and the StateMachine method:
where state is the state, and event is the transition.
To transition from a state, one needs to call:
The idea is that the callback in openthread and mqtt are on the context of the Thread task, and I can quickly wake up my StateMachine by adding a message to the queue:
I can reach this part, and even transtion to the next state, where I call mqttsn_client_init and then call mqttsn_client_search_gateway successfully, with a return code NRF_SUCCESS. After this, I do not see any data transmitted to the gateway, not reaching the event handler callback set in the init function, and quickly (a few seconds) crashing in a hardfault originating from nRF5_SDK\external\freertos\portable\GCC\nrf52\port.c:104 in
At this point I have no ideas what to try to debug anymore. Any help is highly appreciated.
Thanks,
Edgar