cancel
Showing results for 
Search instead for 
Did you mean: 

BlueNRG stops advertising after some time

hardware
Associate II
Posted on September 28, 2015 at 19:19

Hi,

I'm having trouble with advertising: it seems that after some time, the module stops advertising.

The actual time after the issue appears seems to be grossly related to the Advertising_Interval_Min & Advertising_Interval_Max values. The lower the values, the shorter the time the issue appears.

Values such as 0x800 and 0x900 (default) seems to encounter the issues after days but values such as 0x20 and 0x30 encounter the issue after minutes.

When the advertisement stops, it is still possible to connect to the module, using it's address.

Below is some code to reproduce the issue, this code is running on a

STEVAL-IDB003V1 with firmware bluenrg_6_4_Mode_2-32MHz-XO32K.img Although the same issue appears on multiple prototype boards with similar firmware.

♯ Reset BlueNRG/BlueNRG-MS

RESET()

if ACI_HAL_SET_TX_POWER_LEVEL(En_High_Power=0,PA_Level = 4) != 0x00:

    ERROR(''ACI_HAL_SET_TX_POWER_LEVEL FAILED'')

♯ Set Random Address

if HCI_LE_SET_RANDOM_ADDRESS(Random_Address = 0x123) != 0x00:

    ERROR('ERROR SETTING RANDOM ADDRESS')

♯ Init GATT

if  ACI_GATT_INIT()!=0x00:

    ERROR('ACI_GATT_INIT FAILED')

♯ Init GAP as peripheral device

status,_,_,_=  ACI_GAP_INIT(Role=PERIPHERAL)

if status !=0x00:

    ERROR('ACI_GAP_INIT CALL FAILED')

♯ Add service

Status,Serv1Handle=ACI_GATT_ADD_SERVICE(Service_UUID_Type=0x02, Service_UUID_128=0x1,Service_Type=1,Max_Attribute_Records=3)

Status,CharHandle=ACI_GATT_ADD_CHAR(Service_Handle= Serv1Handle, Char_UUID_Type=0x02,Char_UUID_128=0x2,Char_Value_Length=20, Char_Properties=0x08, Security_Permissions=0x00, GATT_Evt_Mask=0x01, Enc_Key_Size=0x07,Is_Variable=0x01)

Status,Serv2Handle=ACI_GATT_ADD_SERVICE(Service_UUID_Type=0x02, Service_UUID_128=0x3,Service_Type=1,Max_Attribute_Records=8)

♯ lock

Status,Char1Handle=ACI_GATT_ADD_CHAR(Service_Handle= Serv2Handle, Char_UUID_Type=0x02,Char_UUID_128=0x4,Char_Value_Length=20, Char_Properties=0x08, Security_Permissions=0x00, GATT_Evt_Mask=0x01, Enc_Key_Size=0x07,Is_Variable=0x01)

♯ unlock

Status,Char2Handle=ACI_GATT_ADD_CHAR(Service_Handle= Serv2Handle, Char_UUID_Type=0x02,Char_UUID_128=0x5,Char_Value_Length=20, Char_Properties=0x08, Security_Permissions=0x00, GATT_Evt_Mask=0x01, Enc_Key_Size=0x07,Is_Variable=0x01)

♯ endride

Status,Char3Handle=ACI_GATT_ADD_CHAR(Service_Handle= Serv2Handle, Char_UUID_Type=0x02,Char_UUID_128=0x6,Char_Value_Length=20, Char_Properties=0x18, Security_Permissions=0x00, GATT_Evt_Mask=0x01, Enc_Key_Size=0x07,Is_Variable=0x01)

def setDisco():

    PRINT(''DISCONNECTED'')

    status = ACI_GAP_SET_DISCOVERABLE(Own_Address_Type = 0x01, Advertising_Interval_Min=0x800, Advertising_Interval_Max=0x900)

    return status

♯ Put device in connectable mode

status = setDisco()

if status !=0x00:

    ERROR('ACI_GAP_SET_DISCOVERABLE CALL FAILED')

while (True):

    event = WAIT_EVENT()

    if event.event_code == HCI_DISCONNECTION_COMPLETE:

        status = setDisco()

        if status !=0x00:

            ERROR('ACI_GAP_SET_DISCOVERABLE CALL FAILED')

#advertising #bluenrg
13 REPLIES 13
Posted on March 09, 2016 at 15:19

Dear Customer,

sorry but I'm reading again your post...you should use the fw :bluenrg_6_4_Mode_2-16MHz-XO32K.img'' (16 MHz high-speed crystal and external 32 kHz low-speed crystal binary image)

regards,

GM

Zhenhua Huang
Associate
Posted on June 19, 2017 at 00:23

Has anybody resolved this issue yet?

We found BlueNRG-1 lost single in a week without a clear reason. This is no BT interrupt anymore.

Even reset(watchdog, system reset) could not bring the BT back. It looks BT is not in the reset field.

Only power cycle could resolve this issue.

The BT stack is very sensitive to the time. Erasing a flash page needs 21.5mS, this could easily crash the BT stack. Nor writing a page without a break.

Either, disable interrupt for miliseconds is risky as well.

But, we are still not 100% sure what is the root cause to kill the BT stack.

It is very low rating. 

grzegorz
Associate III
Posted on June 21, 2017 at 14:29

I have the same problem. Here is a screenshot from Android phone. The dark blue line is BlueNRG-MS visibility. There were no connections made. It's not a problem with visibility after disconnection.

0690X00000607QeQAI.png
Posted on June 21, 2017 at 22:25

Hi, Niemirowski:

We found Flash operation will screw up BT stack. We only do the Flash operation when BT is idle and arranged 24 BlueNRG-1 under test. Let's see what will happen in one week.

Locke