Reading an Attribute on PRoC4

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi everyone,

   

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:

   

 

   

CYBLE_GATT_HANDLE_VALUE_PAIR_T val_handle;
CYBLE_GATT_DB_ATTR_HANDLE_T data_handle;
CYBLE_GATT_ERR_CODE_T error;
             
data_handle = BTCommand_HANDLE;
uint8 data_length = 12;
uint8 val[data_length];
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...

   

Gregor

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Gregor.

   

You are in the wrong forum here, so it might be that someone knowing the answer to your question will not read it.

   

I would suggest you to ask again using the PSoC4 BLE or PRoC forum.

   

 

   

Bob

0 Likes