This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

saadc problem

Hi,I use demo project in

nRF5_SDK_12.1.0_0d23e2a\examples\peripheral\saadc\pca10040\blank\arm5_no_packs\saadc_pca10040.uvprojx.

I made the following changes: 1.add one saadc input 2.channel 0 is connected to VDD,and channel 1 is connected to GND Specific details please check my code:main.c

But, I found a problem, when keil5 simulation, I set a breakpoint in the saadc_callback function, then the results before and after the breakpoint trigger is not the same.

before

image description

image description

after

image description

As you can see,the correct result is

m_buffer_pool[0][ channel 0 , channel 1](m_buffer_pool[1][channel 0 ,channel 1]). But,after the breakpoint trigger,the result is m_buffer_pool[0][ channel 1, channel 0].

If I don't set breakpoints in the saadc_callback function,the reslut is always m_buffer_pool[0][ channel 0 , channel 1](m_buffer_pool[1][channel 0 ,channel 1]).

So, this problem is caused by a breakpoint?Can I get the right answer ? thanks。

  • Hi,

    We are looking into this issue. A few other users have reported seeing this as well. The issue seems to occur when the application is halted, either by a breakpoint, or by disabling interrupts. The next time the SAADC peripheral is started using TASKS_START, a sample is written to RAM. This will cause the buffer to swap channels.

    This issue looks similar to PAN-86, but we are still investigating this. The same workaround seems to solve this issue though; stopping the SAADC using TASKS_STOP, after each EVENTS_END, seems to prevent channel swapping.

    I will report back when we have more information.

    Best regards,

    Jørgen

Related