2024-10-08 03:46 AM
Dear Sir,
When I monitor the data, sometimes the value often accompanied by spikes, such as followed figure.
In my case, I monitor 3 variables that update from ADC registers.
Normally, their values would be around 0.
The signals of ADCvalue[0] and ADC Value[1] appear to be normal.
However ADCValue[2] has some spikes.
When I verify the variables byIDE, the variable does not show these spikes. It always remains around 0.
And I also used a conditional statement to check: if the value is greater than 50 (the maximum spike value is around 260), a counter would increment. However, the counter has always remained at 0, so I believe the actual variable does not have these spikes.
What could be the possible reasons for this?
Best Regards,
2024-10-08 04:11 AM
Additionally, if I add monitoring of other values, there is a chance that the data will return to normal.
For example, as shown in the image, I added two more monitoring variables, offset[0] and offset[1].
At this point, ADCvalue[2] returned to normal.
2024-10-08 04:36 AM
The spikes are about 256 off of the real value. It's a int16_t value which is sometimes positive, sometimes negative.
I would guess that whatever is reading the value is doing so one byte at a time rather than both bytes at once, which causes the issue. For example, if you read the first byte when the value is -1, and the second byte when it changes to 1, the reading will be around -256.
How to fix? Not sure. Perhaps change the acquisition mode or add a trigger such that it doesn't probe the value when they're being updated.
2024-10-08 09:39 AM
Hi @yang2
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Billy
2024-10-08 08:10 PM
Hello TDK,
I think what you said makes a lot of sense. It might really be caused by the fact that it's transmitted as two separate bytes. Thank you for sharing your opinion.