cancel
Showing results for 
Search instead for 
Did you mean: 

How to read values from characteristics (BLE / BLUENRG-M2)?

Gruman
Associate

Good day.

I'm pretty new to BLE and I've a pretty hard time getting the hang of it.

I'm using the Sensor Demo example, delivered with the X-Nucleo-BNRG2A1.

I've now a custom board with the BlueNRG-M2 as a coprocessor with a STM32F030C8T6 (SPI).

The electronic receives commands from an App via several characteristics and depending on the commands, uC will enable/disable a TRIAC and Relay. There are a 3 ADC Channels, which are polled and the values written to 3 characteristics. This works perfectly fine.

I've issues reading values written by the App.

From what I've gattered, the read should be doable with the following commands:

aci_gatt_read_char_value(); or aci_gatt_read_using_char_uuid();

But both of them only returns a BLE Status (And I get an Error of 0x47).

How can I read the values? The programming guide mentions events. How can I tackle those?

tBleStatus Read_ProgramID(void)
{
  tBleStatus ret;
  ret = aci_gatt_read_char_value(connection_handle, ProgramIDHandle+1);
  if (ret != BLE_STATUS_SUCCESS){
    PRINT_DBG("Error while reading ProgramID characteristic: 0x%02X\n",ret) ;
    return BLE_STATUS_ERROR ;
  }
  return BLE_STATUS_SUCCESS;
}

connection_handle gets written with 0x801 and the ProgramIDHandle 0x16.

Any information and help would be appreciated.

Thanks

Best regards

0 REPLIES 0