3608 views|2 replies

104

Posts

1

Resources
The OP
 

How to design a program that can collect sensor arrays using STM32? [Copy link]

As the title says, the project needs to collect the pressure of a contact surface, use a sensor array, and use analog switches to switch and scan the rows. How should such a program be designed? My idea is ADC collection + DMA transmission. After DMA transfers a row of data, implement channel switching in the DMA interrupt? I wonder if this is feasible? Another method is TIM+ADC+DMA. Use TIM to trigger ADC and control the sampling rate of ADC. ADC_RegularChannelConfig(ADC1, ADC_Channel_9,10, ADC_SampleTime_480Cycles); Does this sentence control the sampling rate of ADC? It already exists, so why can we use TIM timer to control its sampling rate? When TIM is used to control the sampling rate of ADC, what is the difference between the two marked triggering methods? /* ADC1 regular channel 12 configuration **********************************/ ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = ENABLE; //ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;//áD£êêê2′ ADC_InitStructure.ADC_ContinuousConvMode=DISABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_Rising; ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_TRGO;//_TRGO timer trigger? ? ? // ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T2_CC2;//What is the difference with the above? ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion =10; ADC_Init(ADC1, &ADC_InitStructure); // /* Enable ADC1 DMA */ // ADC_DMACmd(ADC1, ENABLE);

stm32纠错2.jpg (57.57 KB, downloads: 0)

stm32纠错2.jpg
This post is from stm32/stm8

Latest reply

Usually, the multi-channel AD of the MCU is multiplexed. If a single channel always occupies the AD, the resources will be wasted. The sampling rate and reading frequency of each channel can be configured. For example, the sampling rate of CH1 is configured to 100Khz, the sampling rate of CH2 is configured to 50Khz, the overflow interrupt of TIM1 is used as the trigger source, and then the overflow frequency is configured to 10HZ, that is, the MCU will read the data of CH1 and CH2 10 times per second. ADC_SampleTime_480Cycles is related to the sampling rate, and ADC_ExternalTrigConv_T2_TRGO is related to the frequency of your data reading. See the figure for the interrupt source configuration.  Details Published on 2018-3-22 19:52
Personal signature淡泊明志 宁静致远
 

525

Posts

235

Resources
2
 
Usually, the multi-channel AD of the MCU is multiplexed. If a single channel always occupies the AD, the resources will be wasted. The sampling rate and reading frequency of each channel can be configured. For example, the sampling rate of CH1 is configured to 100Khz, the sampling rate of CH2 is configured to 50Khz, the overflow interrupt of TIM1 is used as the trigger source, and then the overflow frequency is configured to 10HZ, that is, the MCU will read the data of CH1 and CH2 10 times per second. ADC_SampleTime_480Cycles is related to the sampling rate, and ADC_ExternalTrigConv_T2_TRGO is related to the frequency of your data reading. See the figure for the interrupt source configuration.

捕获.PNG (46.44 KB, downloads: 0)

捕获.PNG
This post is from stm32/stm8

Comments

Thanks for the answer, I learned something new!  Details Published on 2018-3-24 19:12
 
Personal signature爱电子,爱生活
 

104

Posts

1

Resources
3
 
wsdymg posted on 2018-3-22 03:52 Usually the multi-channel AD of the microcontroller are multiplexed. If a single channel always occupies the AD, the resources are wasted. The sampling rate and reading frequency of each channel can be...
Thank you for your answer, I learned a lot!
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