2024-11-04 12:58 AM
Hi,
We're testing an SPC58NN84E7 and encountering an issue with the ADC in DMA mode.
Our debugger is an SPD5-UDESTK interfaced via OpenOCD.
When inspecting the ADC's DMA result buffer through the debugger, all values appear valid. However, unexpected behavior occurs when attempting to read the buffer:
For instance, in the DMA callback, we simply assign test = buffer[11], where test is a global uint16_t variable.
On the first callback execution, the debugger shows that test is assigned the correct value from buffer[11] (e.g., 985). However, on subsequent executions, test retains the first value (985), regardless of the current value in buffer[11]. Even if buffer[11] contains a different value (e.g., 987), test remains 985.
Setting test to a different value (e.g., 42) before the assignment has no effect—it still reverts to the initial value (985). This issue persists regardless of how we access the buffer, whether by filling an array or printing values. The first read is correct, but subsequent reads return the initial value, even though the debugger shows the buffer holding different values that align with expected voltages.
We've attached screenshots from the first three callback executions for reference.
Eventually, we identified the issue: we had to disable the Data Cache and Instruction Cache. Re-enabling the Instruction Cache may be possible, as the issue appears limited to data.
Has anyone encountered a similar issue or could offer insight into what might be happening here?
Thank you in advance for your assistance.