2015-04-14 05:05 AM
2015-04-14 08:07 AM
Don't rely on the debugger. Toggle a GPIO, and review period/duty on a scope.
The DMA likely occurs faster than the reaction time of you or the debugger, it also doesn't stop, the ADC+DMA operate independently of the CPU.Other people who had issues like this tracable to the DMA unit changed FIFO modes, I don't think this is the problem here.Clear the source of the interrupt, not everything.2015-04-22 01:25 PM
Thank you clive.
I changed my code, so that only my interrupt source is cleard by the ISR.But I still didn't get it, how I can test my code, when I can't rely on the debugger?Can you explain that in more detail, please.I want to see that the half transfer interrupt and the full transfer interrupt work correctly. But all I can see is, that both interrupt flags are set at the same time....2015-04-22 04:27 PM
Can you explain that in more detail, please.
When you have a flywheel spinning at 1000 rpm you don't stick your finger in it to check it's speed, right? You have a hall sensor or switch, and you'd measure the frequency of pulses with a scope, or frequency counter. You observe behaviour, you don't interfere with it. First you need to get beyond your ''debuggers are transparent'' mindset. Debuggers are invasive, they change the dynamics of a system, and are very bad for real-time measurements. If you stop in the debugger, other parts of the system continue to spin at very high speeds, certainly beyond your reaction time, and that of reading/writing screen messages. The debugger also doesn't have magically access powers, if it reads USART->DR to display it's content to you it changes the state of USART->SR. If you want to test ADC+DMA+TIM sampling speeds you toggle GPIO pins in the interrupt, or you record a time stamp in a RAM buffer that you can inspect later. If the interrupts fire 1ms apart, by the time you see anything on the screen both will have appeared to have fired. If you want to see them in the debugger consider pushing the periodicity to 10 seconds. You can use a USART or SWV connection to output diagnostic or telemetry information. You measure things over a second, and output information about the number of interrupts observed. There is a role for single-step debugging, and parking a debug view over a peripheral, but there are more effective ways of understand the logic of code execution.