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

Trouble to read, write and activate notification

Hello comunnity,

I am trying to read, write and activite notification from my server using a central device. The problem is when I use more than 2 times, I got an error of NRF_ERROR_INVALID_DATA But When i do it separetly the code works. Screenshoot

I attached a picture of my output, First I read the Hz, then I write a new HZ, after this I read again the HZ and the end I activate some notifications. Eventhought, after each sentence I put a delay and it's having the same problem

Why is this behavior?

Regards, David Caraveo

Parents
  • Hi,

    What functions are returning the 0x11 error code?

  • Hi,

    When calling sd_ble_gattc_write you will get a BLE_EVT_TX_COMPLETE / BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE when the packet has been transmitted for write commands(write without response). For write requests you will get a BLE_GATTC_EVT_WRITE_RSP when the packet is received by the peer.

    sd_ble_gattc_write() will return NRF_SUCCESS when it has started the write procedure. When you are doing write request you it will return NRF_ERROR_BUSY(=0x11) if a write request procedure is already ongoing,e.g. you have not received a BLE_GATTC_EVT_WRITE_RSP for your previous write request.

    Only one write with response procedure can be ongoing per connection at a time. If the application tries to write with response while another write with response procedure is ongoing, the function call will return NRF_ERROR_BUSY. Either wait for the event BLE_GATTC_EVT_WRITE_RSP before calling sd_ble_gattc_write(), or do Write without Response.

    Relevant Message Sequence Chart:

    image description

Reply
  • Hi,

    When calling sd_ble_gattc_write you will get a BLE_EVT_TX_COMPLETE / BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE when the packet has been transmitted for write commands(write without response). For write requests you will get a BLE_GATTC_EVT_WRITE_RSP when the packet is received by the peer.

    sd_ble_gattc_write() will return NRF_SUCCESS when it has started the write procedure. When you are doing write request you it will return NRF_ERROR_BUSY(=0x11) if a write request procedure is already ongoing,e.g. you have not received a BLE_GATTC_EVT_WRITE_RSP for your previous write request.

    Only one write with response procedure can be ongoing per connection at a time. If the application tries to write with response while another write with response procedure is ongoing, the function call will return NRF_ERROR_BUSY. Either wait for the event BLE_GATTC_EVT_WRITE_RSP before calling sd_ble_gattc_write(), or do Write without Response.

    Relevant Message Sequence Chart:

    image description

Children
No Data
Related