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

ANCS resets after deleting bond on dev board

Hi,

I have a problem that the ANCS keeps resetting my board, so I was able to reproduce the problem on the PCA 10028 dev board.

Conditions:

  • iOS 8.x or 9.x
  • No app needed on iOS. This is on settings->bluetooth
  • SD 110
  • ANCS nordic implementation as is on SDK 9.0
  • Check on serial port.

The steps to reproduce the problem are:

  • Bond iOS device to ANCS. Leave it connected.
  • Reset dev board with button 2 pressed, to erase all bonds
  • Watch on the serial term how ANCS keeps resetting.

What I have been able to see on the sniff is that when iOS tries to connect after the board resets, ANCS rejects the ENC request due to the bond not existing (it was erased) After that when the timeout on the ANCS to check if the line is already encrypted asks for Bonding, now it is the turn of iOS to reject the request.

After that ANCS does not responds anymore. It has not reset yet and the connection is still active, but all retries from iOS for Rcvd By Type Request are just acknowledged but not answered.

I am attaching a wireshark file with this. Bonds erased.pcapng and a print of the serial terminal...Screen Shot 2015-12-03 at 3.59.50 PM.png

HELP!!!

  • When you clear the bond on only one of the devices, the other one does not know about it. To fix this, you should delete the bond info on the iphone as well.

    Is this a normal use case for your device? Do you need to make this scenario work?

  • There are a thousand situations for which the bond could be deleted from the peripheral device, for which iOS would not know beforehand. A common example would be that another iOS or Android did a DFU. The big problem is ANCS resetting instead of having a procedure to re-bond or a check-point to make a decision instead of resetting.

  • I see. Are you using the ANCS example from the SDK? If the device reset, it is probable because APP_ERROR_CHECK encounters an error. Can you try to find out which function returns the error? Add either a print or breakpoint in app_error.c

  • I cannot catch where is resetting. I already tried all of the APP_ERROR_CHECK in the ANCS example to try to pin it down. I think it might be reseting inside the SD. I was hopping you would have better luck trying to find exactly where it resets. That is the reason I documented how to reproduce the problem.

  • The APP_ERROR_CHECK call will end up in app_error_handler in app_error.c. If DEBUG is defined, it will do the following:

    m_error_code = error_code;
    m_line_num = line_num;
    m_p_file_name = p_file_name;
    
    UNUSED_VARIABLE(m_error_code);
    UNUSED_VARIABLE(m_line_num);
    UNUSED_VARIABLE(m_p_file_name);
    __disable_irq();
    while(1) ;
    

    Here you can see the error code, the line where is was coming from, and the file it was coming from.

1 2 3