2014-11-12 09:54 PM
To drive my application I use two DAC in a interrupt. The data sended to the DAC needs to count up and count down between two variable(bits) so that it creates a triangular wave. The maximum value is 4095.
The frequency of the wave needs to be around 100Hz. To create the wave I use TIM2 interrupt.Sysclk = 180Mhz, Tim2Clk = 90Mhz. Interrupt frequency = 100Hz*(4096*2) = 819200 Hz.Problem is that because of the interrupt frquency is 820kHz (what is really high) the Usart interupt routine misses some characters.How can I solve this? The only thing i can come up with is to use DMA for the USART receiving. But better should be to cut the DAC loose from the CPU somehow.2014-11-12 11:29 PM
2014-11-12 11:36 PM
I have thought at the inbuild triangle wave funtion but you only have a limited amount of different amplitudes. And I need to have the option for all the amplitudes.
I am afraid too that the DMA option for USART not resolve the flooding problem of the interrupt where the value calculations and DAC writing takes place2014-11-12 11:44 PM
Sysclk = 180Mhz, Tim2Clk = 90Mhz. Interrupt frequency = 100Hz*(4096*2) = 819200 Hz. Problem is that because of the interrupt frquency is 820kHz (what is really high) the Usart interupt routine misses some characters.
...
How can I solve this?
By reducing the interrupt frequency, and the output rate, which is too high. Check the datasheet. The DAC has output settling times in the range of several microseconds, so it can't follow anyway.
2014-11-12 11:55 PM
2014-11-13 12:26 AM
2014-11-13 12:56 AM
I can not find anything about the settling sime.
From DM00071990.pdf, STM32F427xx/STM32F429xx Datasheet. EDIT: freakin' forum cannot display images ... Look at given document, page 161.2014-11-13 01:53 AM
2014-11-13 02:50 AM
6 microseconds is the maximum, for full swing and max. capacitive load.
You DAC feeding frequency will depend on the accuracy of the output curve you need (which I don't know).It is not necessarily an interrupt frequency, you can prepare a value table and feed it per DMA into the DAC. But interrupts at 800kHz is absurdly high, you waste most of CPU performance for interrupt entry + exit.2014-11-13 03:09 AM
No, it is not possible to start and stop the DMA on arbitrary point in a circular mode. But it could be done in several other ways:
- If a single (or few periods) are needed then you could use larger buffer holding the signal for the whole time needed and run it only once. - Or, use the DMA in dual buffer mode with an interrupt at end of each transfer. Then you could program each of the transfers to start/stop at desired point but you will have only one interrupt per one signal period. It will depend on your exact requirements.