2012-12-05 05:06 AM
Hello everyone, I'm trying to generate sine wave using DAC from the STM32F0 discovery kit from 1hz to 10khz, and use ADC to read back the signal, TIM2 is used to clock the sine_table>>DMA>>DAC, by changing TIM2.Period I can have the required frequencies but I noticed distorted sine wave at lower frequencies, anyway the difficult problem is to read the signal back by ADC1.
how to maintain like a 200-300 sample/frame for that range, I tried to use TIM2 to trigger both DMA for DAC and ADC but at lower frequencies, ADC will see only a part of the signal, while at higher frequncy will capture many cycles of the sine wave, my question is how to sync both DAC and ADC through DMA so ADC will just cover one cycle of the sine wave throuth the frequency range? any help or clue is appreciated2012-12-10 03:34 PM
One problem may be that the DAC, even with the internal buffer on does not have enough drive current for the ADC input at short sample times. Read the F0 data sheet for DAC output and ADC sampling time and input impedance characteristics. An external buffer amplifier may be needed.
Consider not using DMA. At each Timer2 interrupt, DAC output the next sine table entry, then ADC input the DAC value. With a bit of logic on the ADC value, you can save one cycle in a buffer for later inspection. Then exit the interrupt. Cheers, Hal2013-12-15 04:03 PM
Hi gho.sam,
I'm trying to develop the same application. Could you help me with the code?Thanks,Gilberto2013-12-15 04:19 PM
Someone who posted once on the forum over a year ago is not going to help you with this.
2013-12-15 04:35 PM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/ADC%20and%20DMA%2c%20again&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=237]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/ADC%20and%20DMA%2c%20again&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=237
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Help%20with%20simple%20ADC%20on%20STM32F4&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=593]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FHelp%20with%20simple%20ADC%20on%20STM32F4&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=5932013-12-16 05:33 AM
Thanks a lot, clive1.
Gilberto