This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zigbee SDK on top of FreeRTOS

Hi

I'm trying to use nRF5 SDK for thread and Zigbee 3.2.0 on top of FreeRTOS 9.0 for a Zigbee coordinator.
Since I could not find any coordinator example on FreeRTOS, I started with adding the files etc as of
"Adding dynamic multiprotocol Zigbee support to BLE examples" and followed the init
"Zigbee Multi Sensor with FreeRTOS Example" to my current project, but ran in some issue
directly when calling ZB_INIT("zdo_zc");

I get the following output from zboss, via zb_osif_serial_put_bytes, after that I get stuck in hard fault.
Len:8 Data:0xdead0e0203000000
Len:8 Data:0x7a00820f00f8ff07

Any clues or ideas of what I missed?

Dev setup:
Win 10
gcc-arm-none-eabi-7-2018-q2
FreeRTOS 9.0
nRF5 SDK for thread and Zigbee 3.2.0
nRF52840-DK

libs:
nrf_radio_driver_softdevice.a
libzboss.a (debug version)
s140_nrf52_6.1.1_softdevice.hex

Defines
SOFTDEVICE_PRESENT
S140
RAAL_SOFTDEVICE=1
FREERTOS
ZB_TRACE_LEVEL=0
ZB_TRACE_MASK=0

Parents
  • I proceeded a bit when changing priorities, but got stuck again.

    My stack trace:

    zb_osif_nvram_erase_async() at zb_nrf52840_nvram.c:405 0x28be4	
    zb_nvram_load() at 0x36186	
    zb_zdo_dev_init() at 0x3b910	
    zdo_dev_start() at 0x3baf4	
    zigbee_main_task() at main.c:511 0x2bc2c	
    

    Where I got stuck:

    zb_ret_t zb_osif_nvram_erase_async(zb_uint8_t page)
    {
      zb_uint32_t flash_addr = 0, i;
      zb_int_t ret = 0;
    
      ZVUNUSED(ret);
    
      if (page >= ZB_NVRAM_PAGE_COUNT)
      {
        return RET_PAGE_NOT_FOUND;
      }
      TRACE_MSG(TRACE_COMMON3, "zb_osif_nvram_erase_async page %hd", (FMT__H, page));
    
      flash_addr = ZB_NVRAM_PAGE_BASE_ADDRESS(page);
    
      for (i = 0; i < ZB_NVRAM_PAGE_SIZE / ZB_NVRAM_FLASH_PAGE_SIZE; ++i)
      {
        while (zb_osif_flash_op_progress())
        {
        }
    
        zb_osif_set_flash_op_progress();
        ret = nrf_fstorage_erase(
                    &nvram_fstorage,   /* The instance to use. */
                    flash_addr,        /* The address of the flash pages to erase. */
                    1,                 /* The number of pages to erase. */
                    NULL               /* Optional parameter, backend-dependent. */
          );
        ZB_ASSERT(ret == NRF_SUCCESS);
        if (ret != NRF_SUCCESS)
        {
          return RET_ERROR;
        }
        /* This call is designed to be asynchronous, but currently it is synchronous. */
    
        /* Wait SOC event handler with NRF_EVT_FLASH_OPERATION_SUCCESS or NRF_FSTORAGE_ERASE_RESULT */
        while (zb_osif_flash_op_progress())   <---- Here is where I got stuck forever
        {
        }
    
        flash_addr += ZB_NVRAM_FLASH_PAGE_SIZE;
      }
      zb_osif_flash_erase_finished(page);
      return RET_OK;
    }

    Any clues?

  • Did you manage to get this working?  I managed to get it working by creating a separate higher priority BLE task.  This seems to allow the flash events emitted from the SD to be processed without the ZigBee thread getting stuck.  

Reply Children
No Data
Related