3254 views|5 replies

23

Posts

0

Resources
The OP
 

STM32 timer triggers ADC to collect data and send it to the host computer [Copy link]

Now our school requires writing a program to realize the timer triggering ADC to collect data and send it to the host computer for drawing

I set up a six-byte DMA buffer to store the data collected by the ADC, and then transfer it to the serial port through DMA. The sampling frequency is 1Khz. I set the timer to update the interrupt once every 0.001s. The timer interrupt function collects data and then makes a serial port DMA request. However, I don't know whether the timer will continue to generate update interrupts when the interrupt service function is in progress. I would like to ask if there is any design idea with clearer logic.

This post is from stm32/stm8

Latest reply

You can also use PWM to trigger the ADC. You can query the triggering method of the ADC below and select a method according to the above method. I have tried it, it is very easy to use, and it can also use PWM without output   Details Published on 2023-3-24 20:06
 

1022

Posts

0

Resources
2
 

There is definitely no problem with the 1mS interrupt, and the collection is not mentioned, but there is a problem if it is not sent in the 1ms cycle, because there is a delay in window communication and the task may not be completed.

This post is from stm32/stm8
 
Personal signatureچوآن شـين
 

114

Posts

6

Resources
3
 

The serial port may be too slow, so you can use USB to transfer data.

Or reduce the 1ms interruption frequency so that the serial port speed can keep up.

This post is from stm32/stm8

Comments

What I want is to write the ADC acquisition program in the timer interrupt program. Every time an interrupt is generated, data is collected and then transmitted. I don't know if this is possible.  Details Published on 2022-6-7 21:12
 
 

23

Posts

0

Resources
4
 
vincentc543 posted on 2022-6-6 09:06 It may be stuck because the serial port speed is not fast enough. You can use USB to transfer data. Or reduce the 1ms interrupt frequency so that the serial port speed can keep up.

What I want is to write the ADC acquisition program in the timer interrupt program. Every time an interrupt is generated, data is collected and then transmitted. I don't know if this is possible.

This post is from stm32/stm8
 
 
 

1022

Posts

0

Resources
5
 

The timer cycle triggers ADC, DMA transfer, and then ADC completes the interrupt to get data and hands over a flag to MAIN. In the main program, a query loop is performed. If there is a flag from ADC, USART communicates to PC, clears the flag, and then waits for the next ADC end flag.

This post is from stm32/stm8
 
Personal signatureچوآن شـين
 
 

1022

Posts

0

Resources
6
 

You can also use PWM to trigger the ADC. You can query the triggering method of the ADC below and select a method according to the above method.

I have tried it, it is very easy to use, and it can also use PWM without output

This post is from stm32/stm8
 
Personal signatureچوآن شـين
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list