Dialog Semiconductor customer support - Global Variable Corrupt https://support.dialog-semiconductor.com/resource-keywords/global-variable-corrupt en Global Variable Overwrite Problem https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/global-variable-overwrite-problem

Hi Dialog

We are working on custom board based on DA14681, running SDK 1.0.14.

Problem is that in my code that is based on PxpReporter, i m doing some specific BLE task at high speed. I perform a high speed data transfer over the BLE. Right after that a global variable in my code, gets a garbage value.

After some research, i found out that using global variables in C++, is not a good practice, as it can be accessed and overwrite from anywhere. Then i converted that global variable from uint8_t to INITIALISED_PRIVILEGED_DATA uint8_t and then it worked fine.

So i have two questions:

1 - Does INITIALISED_PRIVILEGED_DATA has some kind of protected memory? If yes then should i convert all my global varibles to INITIALISED_PRIVILEGED_DATA?

2 - Is using global variables a good practice or a bad practice? From dialog DA14681's programming point of view?

Device: 
Sat, 07 Nov 2020 09:49:20 +0000 mahmed106 385832 at https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/global-variable-overwrite-problem#comments