Reading an Attribute on PRoC4 | Cypress Semiconductor
Reading an Attribute on PRoC4
I'm pretty new to the whole Bluetooth topic and even to programming any ARM processor, so please excuse if the following questions sound a bit "simple" :-). I searched through the forums and wasn't able to solve the following problem:
I simply want to read out an attribute, that I've created in the BLE component in PSoC Creator (it's called BTCommand and has length 12).
So here's my code:
data_handle = BTCommand_HANDLE;
uint8 data_length = 12;
val_handle.attrHandle = data_handle;
val_handle.value.val = val;
val_handle.value.len = data_length;
error = CyBle_GattsReadAttributeValue(&val_handle, &cyBle_connHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);
So, the first time i execute the code, it seems to work and in the variable called val, i can afterwards see the content of the attribute (that i've created). So I guess it basically works.
The problem is that right after the execution, the processor get's into a unknown state (or something similar) and actually ends up in the "CySysSleep" routing (and never get's out again). I seems strange to me, since i don't send the module into sleep mode...
The "error" value is "CYBLE_GATT_ERR_NONE" after first execution, so this seems to be correct.
Maybe someone knows how exactly to read out a simple attribute and knows what i'm doing wrong. Would appreciate the help...