cancel
Showing results for 
Search instead for 
Did you mean: 

Extern variable from main.c not updated in p2p_server_app.c file in stm32wb for two cores

IRakh.1
Associate III

Hello

I set the variable  uint8_t test as  test = test + 1 in main.c

and send this variable via BLE in p2p_server_app.c to PC with next command

P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, (uint8_t *) (&local));

Also, set it in  main.h extern uint8_t test

and include the header in both files main.c and p2p_server_app.c

But when I send this variable from the  p2p_server_app via Bluetooth to PC it is sent stable value, not updated value every time. it seems to me that this STM32WB is dual-core and apparently each core works separately. it turns out I can consider changes for "test" only once, how can I make the p2p_server_app.c takes updated value from main.c

// main.h

extern uint8_t test;

// main.c

#include "main.h"

uint8_t test= 0;

while (1)

 {

test = test + 1;

}

// p2p_server_app.c

#include "main.h"

P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, (uint8_t *) (&local));

0 REPLIES 0