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

ANCS Hard Fault

Hi, I've created an application using the S110 experimental ANCS demo. I successfully implemented ANCS and then began to structure my application around it. At some point I realized that my ANCS handler was causing a hard fault. The specific situation was:

  1. Connect to iPhone (GAP)
  2. Discovery (service, characteristics, descriptors)
  3. Wait for Notification

So far so good everything worked. However when I got a new notification I would always end up in a hard fault. It turns out the problem was in

static void event_notify(ble_ancs_c_t * p_ancs, const ble_evt_t * p_ble_evt)

and had to do with the .attribute_len field before calling ble_ancs_get_notification_attributes(...)

The default was set to 32. When I changed it to 12, everything started working again (note: I definitely had it working with 32 at some point).

My buffer size for holding the optional portion of the notification is 18

My question is why would changing the .attribute_len from 32 to 12 allow my application to work again, and what was causing the hard fault in the first place?

thank you, akbar

Related