stm32f207 ADC+TIMER+DMA / Poor Peripheral Library Examples
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-04-24 2:19 AM
Hi,
I'm looking to sample a signal (well, 2 actually - quadrature analog signals) at a fixed sample rate, but I'm baffled by the lack of any example in the Standard Peripheral Library on how to achieve this.I would have thought that this would be a pretty standard example, i.e sample x points of a signal at y kHz and store result in memory location z.Can anyone from ST comment on why such a basic (and imo fundamental) example is missing from the Standard Peripheral Library?Does anybody else have an basic example of how this is achieved? There are various incomplete snippets of code if you search in this forum, but elsewhere on the internet I've been able to find zilch.I suspect I'm going to have to go read the manual in depth to figure this lot out...oh joy!Many thanks.Adrian- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-22 7:25 AM
Is this C++ and your samples are inside an object (structure)?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-23 7:08 AM
Turns out my asm 'skills' are even more absent than I thought..
(And basic understanding of C arrays too ... urgh :\ dumb ass on my part)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-23 7:53 AM
Please don't delete posts it damages the integrity of the thread.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-23 9:09 AM
sry , wanted to remove my stupid stuff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-10-25 9:03 AM
Hello,
Empty & repeated posts were removed to clean-up the whole discussion. -Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-01-12 9:20 AM
A fine example.
My question is: Is it possible frequency of ADC module to connect to the pin for synchronization to an external device.For exampleT2_TRGO
-> pin...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-01-12 10:11 AM
You can get a TIM to clock from an external source, both edges I think, by there is some resynchronization latency. Set a Period = 1
The DCMI does permit some parallel input clockingUp vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-06 7:52 AM
void DMA2_Stream0_IRQHandler(void) // Called at 1 KHz for 200 KHz sample rate, LED Toggles at 500 Hz
{
/* Test on DMA Stream Half Transfer interrupt */
if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_HTIF0))
{
/* Clear DMA Stream Half Transfer interrupt pending bit */
DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_HTIF0);
/* Turn LED3 off: Half Transfer */
STM_EVAL_LEDOff(LED3);
// Add code here to process first half of buffer (ping)
}
/* Test on DMA Stream Transfer Complete interrupt */
if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0))
{
/* Clear DMA Stream Transfer Complete interrupt pending bit */
DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0);
/* Turn LED3 on: End of Transfer */
STM_EVAL_LEDOn(LED3);
// Add code here to process second half of buffer (pong)
}
}
I used this code as above. I set a breakpoint in function
DMA2_Stream0_IRQHandler. It seems to be called. but cannot get into this statement and the condition.
if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0))
Can you give some possiable problems?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-06 8:32 AM
Can you give some possible problems?
Your debugger is interfering with the DMA registers/flags? Your reaction time is below 500 Hz? The timer stops, the DMA errors? Or neither actually stop? If you don't use a debugger, and you put a scope on the LED, do you see it toggle continuously?Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-03-06 10:08 PM
Thanks your advice. So I make a test. If I set the breakpoint here for
TM_ADC_DMA_IRQHandler();
.void DMA2_Stream0_IRQHandler (void) {
uint32_t events;events = (DMA2->LISR >> 0) & DMA_STREAM_FLAGS;
DMA2->LIFCR = events << 0; DMA2_Stream0_Event(events); //tgzTM_ADC_DMA_IRQHandler();
//tgz } It can go into the ''if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0))'' statement. And output information on LCD.