cancel
Showing results for 
Search instead for 
Did you mean: 

STM Studio is give zero values randomly

danieloneill9
Associate II
Posted on September 18, 2013 at 08:36

I'm using STM studio to debug a STM32VLDISCOVERY kit.

I have based is on the systimer example project where every 1ms I read some adc values.

When graphing the adc returns (which are scaled) in stm studio I will see regularly see values of zero for captured data.

When I place a breakpoint (using IAR embedded workbench) on an if statement checking for zero the program does not break.

Is this something weird stm studio is doing? i.e when it tries to access a variable being written? I trust the breakpoint more but should I?

Cheers,

Daniel

#stmstudio #stm32 #discovery
1 REPLY 1
S C
ST Employee
Posted on September 18, 2013 at 16:49

Hello,

Reading a value of 0 might occur in case the target is under reset when the STMStudio accesses the RAM. First check if there is any watchdog or unexpected reset, either through the debugger, or by incrementing a 32-bits counter in the 1-ms handler, cleared at main entry point. Displaying such counter in the STMStudio will show any potential reset outside any debugging session.

Then ensure the read variable is global and not overwritten from anywhere else. If not already done, add the ''if 0'' test before and as close as possible to the ADC read instruction.

You can also display the application variable simultaneously with the scaled variable. In order to eliminate a possible overflow case during the variable's scaling.

In direct acquisition mode, the STMStudio accesses data asynchronously with the core. As a result, reading word variables might result in displaying transitory values, as explained in the release notes chapter 3.1. But this cause is not very probable with such kind of application, doing a single read each ms, and with a transitory value=0. Anyway this limitation can be avoided by the synchronized or snapshot acquisition modes, with instrumented application.

Best regards