I would like to confirm my understanding of Problem sending 6 bytes to multiple services using sd_ble_gatts_hvx
I use nrf52832 sdk13.0.0
BLE SPI is master. I dropped the SCK to 1 Mhz I send x18 bytes of data to slave, just to generate the SPI clock.
I receive all x18 bytes on MISO. I can view it with analyzer. I also see the correct data in m_rx_buf, in IAR watch window.
I have x3 BLE services. I update characteristic with this
our_termperature_characteristic_update(&m_our_service, &testchar[0]);
sr2_termperature_characteristic_update(&m_sr2_service, &testchar[6]);
sr3_termperature_characteristic_update(&m_sr3_service, &testchar[12]);
So the plan is to update service 1 with data[0] to [5] Service 2 with data[6] to [11], and service 3 with data[12] to [17]
I made all the changes in xxx_service.c
// OUR_JOB: Step 2.H, Set characteristic length in number of bytes
attr_char_value.max_len = 6;
attr_char_value.init_len = 6;
uint8_t value[6] = {0x16, 0x15, 0x14, 0x13, 0x12, 0x11};
I changed characteristic to int8_t
// ALREADY_DONE_FOR_YOU: Function to be called when updating characteristic value
void our_termperature_characteristic_update(ble_os_t *p_our_service, int8_t *temperature_value)
If I pass the pointer to the first 6x bytes of the 18-byte array, all is fine. Charateristics of ALL three services are updated correctly.
our_termperature_characteristic_update(&m_our_service, &testchar[0]);
When I try to update a service with next six bytes, ALL three services fail.
So services update with &testchar[0]); but fail with &testchar[6]);
our_termperature_characteristic_update(&m_our_service, &testchar[6]);
So
// ALREADY_DONE_FOR_YOU: Function to be called when updating characteristic value
void our_termperature_characteristic_update(ble_os_t *p_our_service, int8_t *temperature_value)
{
// OUR_JOB: Step 3.E, Update characteristic value
if (p_our_service->conn_handle != BLE_CONN_HANDLE_INVALID)
{
uint16_t len = 6;
Perhaps I do not understand the sending mechanism correctly, but at least the first 6-bytes of the array are sent correctly, without fail.
Passing the pointer to the next six bytes is where all fails.
Any help appreciated