cancel
Showing results for 
Search instead for 
Did you mean: 

Basic STM32WB Notification question?

SWenn.1
Senior III

Good morning.

I am using a NUCLEO-WB55 board and nRF Connect to prototype a design.  I am trying to understand notifications. Using the attached picture I am hoping someone can answer my question.  The characteristic a1725a01.... has read, notification and indication properties on it.  I have enabled notifications.  Characteristic a1725a02 has read and write properties on it.  Both characteristics (a01 and a02) read the same variable.  If I write to characteristic a02 and then read characteristic a02 I get what I wrote (as one would expect).  The question I have is:

With a01 notifications enabled should I expect that a01 automatically updates with the value (recall a01 and a02 point to the same variable) or do I have to intentionally read a01 to get the value to update?

 

Thank you.

SWenn1_0-1709391554067.png

 

5 REPLIES 5
DS.4
Senior II

I believe that if you want that kind of behavior do :

 

automatically:

1. NRF: Write data X to a0, read it if you want, you are allowed.

2. ST:  Event:  a0 written with data X. (believe st has this event in most of its examples )

3. ST: Write ( "Pass" ) the data X to a1 with a method that sends a notification. ( your added logic)

4. NRF: Notification of data X on a1. ( "automatically" )

 

manually: (changing steps  (3), (4) ) 

3. ST: Write ( "Pass" ) the data X to a1 with a method that doesn't send a notification.

4. NRF: Read data X out of a1. (manually)

 

 

SWenn.1
Senior III

DS.4

thanks for the reply...new to this at this end so I am struggling thru things.

I have W/R/Notifications on one characteristic (Stevenotify) at this end now.

The CubeMX automagically creates custom_app.c and places two functions within it:

1. void Custom_Stevenotify_Update_Char(void)

2. void Custom_Stevenotify_Send_Notification(void)

both functions call the same function with the same opcode but a different payload

Custom_STM_App_Update_Char

This function does nothing more than aci_gatt_update_char_value

Given that the opcode is the same I do not understand what the value of the 2 initial functions do other than update the same value.  Can you explain?

I only call function 2 above and it seems to work.  I am not sure the value of 1.

if I remember correctly they are not the same,

as aci_gatt_update_char_value gets different input parameterts.

 

Something like : 

aci_gatt_update_char_value( WITH_NOTIFICACTION) - this is what I prev called "automatically", you don't have to manually read it using NFC app, the app will receive data "automatically". (event-driven) as the update of the char. also sends the data.

 

aci_gatt_update_char_value( ONLY_UPDATE_CHARACT_DATA_NO_NOTIFICATION) - this is what I prev called "manually" ( polling) . You update char. without sending, then you go to your NFC app and press read ("manually"), and only then you get the data.

 

hope it helps

SWenn.1
Senior III

No....There is absolutely no difference in the call between the two.  Both functions (1 & 2 above) call the same function aci_gatt_.....and the function does not have any parameters to indicate notification or no notification.

I have found that MANY times when I put a break point at this function that the payload, which the debugger shows as correct, never gets transferred to my phone on when I do a read.  Is there some low level functions that could be getting called WITHOUT going thru this aci_gatt_.....call that may be overwriting my payload and sending the wrong data to the phone?

Try this one:  aci_gatt_update_char_value_ext , it lets you better control what is being done via parameters