This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able to modify advertisement packet more than once, (without adv_timeout) on interrupt

Hi All,

My goal is to change the advertisement(when not "connected" to ble device) in every SPI Interrupt, depending on the data received i set corresponding data in advertisement packet. The small code snippet that I'm using, is given below.

spi_event_handler : ################################################################################ if (m_rx_buf[0]=='o') { if(connect) err_code = ble_nus_send_string(&m_nus, open_door_str, 10); else { open_door = 1; //sd_ble_gap_adv_stop(); open_door_adv_init(); advertising_start(); } } if (m_rx_buf[0]=='c') { if(connect) err_code = ble_nus_send_string(&m_nus, close_door_str, 10); else { close_door =1; close_door_adv_init(); advertising_start(); } } ########################################################################### The issue that i face here is i am able to change the advertisement packet on first interrupt, but advertisement packet doesn't change afterwards for later interrupts. But i need to change adv_data multiple times. I'm able to change the advertisement packet every time if i wait for adv_timeout. Although, when connected all the messages are sent regularly on every interrupt.

Can anyone please suggest me what's wrong with my method or above code snippet. Any suggestions or help would be appreciated.

Thanks Brajesh

  • RK already answered you on this, but it seems that the relevant part of your code is not called for some reason. If the device is still advertising and haven't HardFaulted/Reset, then there is simply something stopping you from receiving SPI events. From the code you have posted, it is not possible for me to say why this is happening. I would debug further in the SPI part of your code separately, using debug prints to figure out why it is not triggering. There is nothing in the SoftDevice that should affect this, so it must be your configuration options or code.

  • Thanks everyone for suggestions. Actually there was no issue with the code, the issue was i guess battery, when i connect my board to direct supply, advertisement change works fine absolutely, but if it is taking supply from even 10 days old battery, it doesn't change the advertisement every time although it does advertise last data.

    I am facing similar kinda scenario in my other work, will be posing that query seperately. Thanks everyone again.

Related