I have been working on "merging" SDK for Mesh's lightswitch client example and SDK v14.2.0 UART server example, mostly following the document on this site, with some changes where applicable.
I ended up with a firmware where the NUS application works fine, but there is no mesh activity. RTT log from the mesh side report up to Setting up access layer and models
.
Could anyone give me an idea on what I am missing?
Here is my project: ble_app_uart_and_mesh.zip
And here is how I have the SDKs set up:
- Mesh v0.10.0-a root
- bin
- CMake
- ...
- nRF5 SDK v14.2.0 root
- components
- config
- ...
- project
- ble_peripheral
- ble_app_uart_and_mesh
- ble_peripheral
Update 1
Debugging shows that in my SD_EVT_IRQHandler(void)
:
void SD_EVT_IRQHandler(void)
{
nrf_sdh_evts_poll();
/* Fetch SOC events. */
uint32_t evt_id;
while (sd_evt_get(&evt_id) == NRF_SUCCESS)
{
nrf_mesh_on_sd_evt(evt_id);
}
/* Fetch BLE events. */
uint16_t evt_len = sizeof(m_ble_evt_buffer);
while (sd_ble_evt_get(&m_ble_evt_buffer[0], &evt_len) == NRF_SUCCESS)
{
nrf_mesh_on_ble_evt((ble_evt_t*) &m_ble_evt_buffer[0]);
evt_len = sizeof(m_ble_evt_buffer);
}
}
Code execution does reach while (sd_evt_get(&evt_id) == NRF_SUCCESS)
, but never go inside the loop. I suspect that nrf_sdh_evts_poll()
consumed all events and therefore no event got passed to the mesh modules. Could this be the issue? And if so, how could I fix it? I tried to look into nrf_sdh_evts_poll()
, but frankly speaking it is really foreign...
Update 2:
Fixed issue in Update 1 by modifying nrf_sdh_ble.c
and nrf_sdh_soc.c
:
nrf_sdh_ble.c
static void nrf_sdh_ble_evts_poll(void * p_context)
{
...
while (true)
{
...
// Added Mesh handler
nrf_mesh_on_ble_evt(p_ble_evt);
}
...
}
nrf_sdh_soc.c
static void nrf_sdh_soc_evts_poll(void * p_context)
{
...
while (true)
{
...
// Added Mesh handler
nrf_mesh_on_sd_evt(evt_id);
}
...
}
Now nrf_mesh_on_sd_evt()
and nrf_mesh_on_ble_evt
are called for sure. However other handlers in the mesh SDK, for example, mesh_evt_handler()
in provisioner.c, are never reached. I am out of clue again