Code stops after connection

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
vrabo
Offline
Last seen:2 years 11 months ago
加入:2016-11-04 19:19
Code stops after connection

Hello!
I'm using the ble_security to learn how to pair my custom board and followed the training 05 doc.
I realized the training is older than the SDK so i made the following changes in the ble_security following the tutorial

#define CFG_APP_SECURITY(defined already)
#define EXCLUDE_DLG_SEC (0)(defined already)

//.security_request_scenario=DEF_SEC_REQ_NEVERto
.security_request_scenario=DEF_SEC_REQ_ON_CONNECT

in user_callback_config.h
i noticed the ble_security file had the following:
.app_on_tk_exch_nomitm = user_app_on_tk_exch_nomitm,
.app_on_pairing_succeded = user_app_on_pairing_succeeded,
.app_on_encrypt_req_ind = user_app_on_encrypt_req_ind,

while the tutorial has:
.app_on_tk_exch_nomitm = default_app_on_tk_exch_nomitm,
.app_on_pairing_succeded = NULL,
.app_on_encrypt_req_ind = default_app_on_encrypt_req_ind,

所以我让他们没有任何变化

It compiles but whenever it pairs i can see how the code stops in:
void NMI_HandlerC(unsigned long *hardfault_args)
{
.....
if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n");

if i change.app_on_pairing_succeded = user_app_on_pairing_succeeded,to.app_on_pairing_succeded = NULL,it never gets to that error
Could you explain me why? Should i also change.app_on_tk_exch_nomitmand.app_on_encrypt_req_indto their default values?

Thanks

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi vrabo,

Hi vrabo,

The NMI_Handler indicates that the device is stuck somewhere, so after about 2.6 seconds the watchdog will hit, now in your case, the most probable reason for the NMI to hit in the example that you are using is that the device is trying to access the flash (in the user_config.h file there are two #defines that set if the device will use an external device -spi flash or i2c eeprom- in order to store the bonding data). So i assume that one of those defines is defined and the device stucks when trying to access the flash, if you undefine both of them the SDK will not try to access the flash.

Thanks MT_dialog

vrabo
Offline
Last seen:2 years 11 months ago
加入:2016-11-04 19:19
Thank you!

Thank you!
It worked. So if i don't use flash or eeprom the bt dat will be stored in the cache right? Does that means every time the circuit has no power the bt data will de erased?

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi vrabo,

Hi vrabo,

Yes, since there is no external memory the bonding data will be stored in the Sysram of the device, but if you lose power, the bonding data will also be lost.

Thanks MT_dialog