This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Software hang or reset when run to softdevice_handler_init, using nRF1822QFAA and S120 v2.1 and SDK10.0

I am using nRF51822QFAA & S120(v2.1) & SDK10.0.0

The application is to scan nearby ibeacon and send the ID information by UART. But the application always hang / reset when run to here

I step into these lines,

1, SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, NULL);

2,  uint32_t softdevice_handler_init(nrf_clock_lfclksrc_t clock_source,void * p_ble_evt_buffer,uint16_t ble_evt_buffer_size, softdevice_evt_schedule_func_t evt_schedule_func)

3, if (!is_word_aligned(p_ble_evt_buffer))

It reset when hit the third line.

Can any body help me out ?  Many thanks !

Parents
  • Hi,

    As you see from the code, the check ((!is_word_aligned(p_ble_evt_buffer))) will fail if the event buffer is unaligned. In that case, the softdevice_handler_init() function will return NRF_ERROR_INVALID_PARAM, and the default error handler will reset the device unless DEBUG is defined for the project. You can verify that the buffer is unaligned by checking if the p_ble_evt_buffer is divisible by 4 (I expect it is not).

    Most likely the buffer is unaligned due to some optimisation. Which toolchain/compiler are you using, and which flags do you use for the build? If you use GCC, you could force the buffer to be aligned where it is declared, using the aligned attribute.

Reply
  • Hi,

    As you see from the code, the check ((!is_word_aligned(p_ble_evt_buffer))) will fail if the event buffer is unaligned. In that case, the softdevice_handler_init() function will return NRF_ERROR_INVALID_PARAM, and the default error handler will reset the device unless DEBUG is defined for the project. You can verify that the buffer is unaligned by checking if the p_ble_evt_buffer is divisible by 4 (I expect it is not).

    Most likely the buffer is unaligned due to some optimisation. Which toolchain/compiler are you using, and which flags do you use for the build? If you use GCC, you could force the buffer to be aligned where it is declared, using the aligned attribute.

Children
No Data
Related