2020-11-16 11:01 AM
Hello,
I am trying to use the memcpy function to transfer data from the ADC data buffer to a separate data buffer, but when I call memcpy, only the first 1400 of 6000 samples gets copied, while the remainder of the buffer does not get updated. I noticed this when I added a breakpoint after the memcpy function and when I output the new data on a DAC and saw the following on an oscilloscope, where the green toggle indicates when the HAL_ADC_ConvCpltCallback function is called, and the blue is the data being output by the DAC after being copied from the ADC buffer. The function being read at the ADC is a simple ramp function:
I am wondering if there is any specific reason this may be occurring. I am using DMA for the ADC (Continuous DMA requests enabled) and a DAC on the STM32F413 MCU. The only thing being done in the callback is a flag being set.
Thanks,
MC
Solved! Go to Solution.
2020-11-16 11:10 AM
Sure sounds like you're only copying 1/4 of the buffer, or only 1/4 of the buffer is populated. Perhaps there is an error due to interpreting X uint32_t values as X bytes instead of 4X bytes, or similar. It should not be hard to debug by setting a breakpoint at memcpy and comparing the source and destination buffers before and after.
2020-11-16 11:10 AM
Sure sounds like you're only copying 1/4 of the buffer, or only 1/4 of the buffer is populated. Perhaps there is an error due to interpreting X uint32_t values as X bytes instead of 4X bytes, or similar. It should not be hard to debug by setting a breakpoint at memcpy and comparing the source and destination buffers before and after.
2020-11-16 11:17 AM
I had not realized that I had the incorrect size in the memcpy function. I changed that and got the expected output, Thank you!