Hello TI team,
I have been trying to implement a very simple application using basic_ble example as baseline on an LP-EM-CC2340R5. The intent is to read a GPIO and then report the state of that pin ('0' or '1') through notifications of a characteristic. A mobile phone could subscribe to the characteristic so it gets constant updates of the GPIO state. Since basic_ble is already using Characteristic 4 to notify, I chose to use that one for the GPIO state report out.
I made the changes outlined below and I can read the value of Characteristic 4 using LightBlue app, but once I Subscribe to it to receive notifications, the board gets hung up, LightBlue looses communication and I need to reset from CCS in order to unblock the board. An interesting note is that I can only connect using LightBlue; Ti SimpleLink Connect finds the board but cannot connect to it.
I feel I am missing something very basic, please let me know what could that be.
This is a description of the changes I made to basic_ble to accomplish this. I am using SimpleLink Low Power F3 version 7.40.00.64.
simple_gatt_profile.h
1. Changed UUID from 0xFFFx to 0xAAAx for Service and Characteristics so I could differentiate from the basic_ble example.
2. Commented out all mentions of Characteristic 5 as I am not going to use it.
simple_gatt_profile.c
1. simpleGattProfile_Char4Props: Added 'GATT_PROP_READ' property so I can read its value through the app.
2. simpleGattProfile_attrTbl: Replaced permission of simpleGattProfile_Char4 from '0' to 'GATT_PERMIT_READ' so I can read its value through the app.
3. SimpleGattProfile_readAttrCB: Added case SIMPLEGATTPROFILE_CHAR4_UUID so it can be read through the app.
4. Commented out all mentions of Characteristic 5 as I am not going to use it.
app_simple_gatt.c
1. Commented out SimpleGatt_notifyChar4 function and every call for it in other functions.
2. Added two functions to report the state of GPIO ('Value' is declared as uint8_t Global Variable at the top):
void GPIO_HIGH()
{
Value = 1;
SimpleGattProfile_setParameter(SIMPLEGATTPROFILE_CHAR4, sizeof(uint8_t), &Value);
}
void GPIO_LOW()
{
Value = 0;
SimpleGattProfile_setParameter(SIMPLEGATTPROFILE_CHAR4, sizeof(uint8_t), &Value);
}
3. Commented out all mentions of Characteristic 5 as I am not going to use it.
empty.c
1. Declared external functions GPIO_HIGH() and GPIO_LOW().
2. mainThread: Added GPIO_setConfig(CONFIG_GPIO_NotifyState, GPIO_CFG_IN_PU).
3. mainThread: Added decision task to notify a HIGH or LOW status of GPIO in while(1) loop:
if (GPIO_read(CONFIG_GPIO_NotifyState))
GPIO_HIGH();
else
GPIO_LOW();