Hello, Nordic Team.
In my program, I have to change the value of the characteristic before start. I write:
case ACI_EVT_DEVICE_STARTED:
g_aci_state.data_credit_total = aci_evt->params.device_started.credit_available;
switch(aci_evt->params.device_started.device_mode)
{
// When the device is in the setup mode.
case ACI_DEVICE_SETUP:
{
g_aci_state.device_state = ACI_DEVICE_SETUP;
// Enable flag to start send setup information to the nFR8001.
setup_required = true;
}
break;
case ACI_DEVICE_STANDBY:
{
if (aci_evt->params.device_started.hw_error)
{
// Magic number used to make sure the HW error event is handled correctly.
delay(50);
}
else
{
// Open adv. pipe.
lib_aci_open_adv_pipe(PIPE_AUTOMATION_IO_CORE_SERVICE_USER_NAME_STRING_BROADCAST);
// Need to set
g_need_set = 0;
}
}
break;
}
break; // ACI_EVT_DEVICE_STARTED
As you see, I'm open pipe for advertising and then, in ACI_EVT_CMD_RSP I change the value:
case ACI_EVT_CMD_RSP:
// If an ACI command response event comes with an error -> stop.
if ((ACI_STATUS_SUCCESS != aci_evt->params.cmd_rsp.cmd_status )
&& (ACI_CMD_READ_DYNAMIC_DATA != aci_evt->params.cmd_rsp.cmd_opcode)
&& (ACI_CMD_WRITE_DYNAMIC_DATA != aci_evt->params.cmd_rsp.cmd_opcode))
{
// If we meet one of bad status of command - we start disconnection.
if((aci_evt->params.cmd_rsp.cmd_status == 0x83) && (g_disconnect_started == false))
{
lib_aci_disconnect(&g_aci_state, ACI_REASON_TERMINATE);
g_disconnect_started = true;
}
}
else
{
if (g_need_set == 0)
{
// Some default name
uint8_t def_val[10] = {0x64, 0x65, 0x20, 0x41, 0x54, 0x4d, 0x33, 0x32, 0x38};
// Set name of device.
lib_aci_set_local_data(&g_aci_state, PIPE_AUTOMATION_IO_CORE_SERVICE_USER_NAME_STRING_SET, def_val, 9);
}
}
break;
Then I connect and bond phone to device and everything works correct. But if I restart the device, It doesn't listen any bonds (Bonds saves in EEPROM). So that I have to make bond again and it will work. If I remove lib_aci_open_adv_pipe(PIPE_AUTOMATION_IO_CORE_SERVICE_USER_NAME_STRING_BROADCAST); from code, there is no troubles after reboot, but there is no advertising characteristic (but i need it). So that, It look some trouble in lib_aci library.
I found, that it always some such troubles with reboot, if I use lib_aci_set_local_data or lib_aci_open_adv_pipe in ACI_DEVICE_STANDBY.
Is this is a known issue and is there any known solutions to fix it ?
Best regards
Vladislav