NordicSemiconductor / Nordic-Thingy52-FW

Nordic Thingy:52 software development kit. This kit is designed to assist users in developing their own custom firmware for Thingy. Please see http://www.nordicsemi.com/thingy for the latest news and software releases.
Other
210 stars 133 forks source link

Setting adv_params.timeout to 0 causes error boot loop #13

Closed rpiper closed 6 years ago

rpiper commented 7 years ago

On both the Android and iOS Thingy apps, if the Advertising Timeout is set to 0, and then the app disconnects, the Thingy goes in to a perpetual error boot loop with the red LED.

The only way that I have found to fix this is erase and reflash thingy_v1.1.0.HW_1.0.hex. This erases the settings loaded into m_ble_config. I don't believe there is any other way to force the Thingy to load the factory defaults from m_ble_default_config.

I was able to power on with the button pressed to force into the bootloader. Performing a DFU update of the v1.1.0 does work, but doesn't erase the settings in flash. After the DFU completes, it is still in the red LED boot loop.

The problem might be that in Limited Discoverable mode advertising, BLE_GAP_ADV_TIMEOUT_LIMITED_MAX = 180, and I don't think you can use a value of 0. This is allowed in General Discoverable mode by using BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED = 0. I'll have to debug it more, but I think a simple bounds check on adv_params.timeout will prevent this.

rpiper commented 7 years ago

This discussion confirms my findings https://devzone.nordicsemi.com/question/1562/advertising-with-no-timeout/

koffes commented 7 years ago

Thank you for bringing this to our attention. This has already been corrected in our central repository and will be part of a future firmware release. You are also correct, with the present implementation the flash storage will only be set to default when the major or minor (not bugfix) FW version changes.

jorgenmk commented 6 years ago

As of current master/release v2.0.0 this issue should be resolved. (advdata_flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE)