10587 views|8 replies

90

Posts

0

Resources
The OP

ADC sampling problem of STM32F103 [Copy link]

How can I sample continuously?

My current method is: ADC12 samples the voltage and current of phase AB, ADC3 samples the voltage and current of phase C, CC2 and CC3 of TIM1 are used as triggers, DMA transmits the sampled data, calculates once after half of the transmission is completed, performs the next sampling during the calculation, and resamples the data to DMA after the full transmission is completed.

The problem is: the voltage of each phase will crosstalk into the current channel, that is, if only voltage is added without current, the current can be sampled!

The following is the ADC configuration program:

/* ADC1 configuration ---------------------------------------------------------*/
ADC_InitStructure.ADC_Mode = ADC_Mode_RegSimult;
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC2;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfChannel = 2;
ADC_Init(ADC1, &ADC_InitStructure);


ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
ADC_Init(ADC2, &ADC_InitStructure);

ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC3;
ADC_Init(ADC3, &ADC_InitStructure);

/* ADC3 regular channel3 configuration, measure current in C*/
ADC_RegularChannelConfig(ADC3, ADC_Channel_1, 1, ADC_SampleTime_7Cycles5);
/* ADC3 regular channel10 Configuration, measure voltage in C*/
ADC_RegularChannelConfig(ADC3, ADC_Channel_10, 2, ADC_SampleTime_7Cycles5);

/* ADC2 regular channel6 configuration, measure current in B*/
ADC_RegularChannelConfig(ADC2, ADC_Channel_0, 1, ADC_SampleTime_7Cycles5);
/* ADC2 regular channel11 Configuration, measure voltage in B*/
ADC_RegularChannelConfig(ADC2, ADC_Channel_11, 2, ADC_SampleTime_7Cycles5);

/* ADC1 regular channel7 configuration, measure current in A*/
ADC_RegularChannelConfig(ADC1, ADC_Channel_13, 1, ADC_SampleTime_7Cycles5);
/* ADC1 regular channel12 Configuration, measure voltage in A*/
ADC_RegularChannelConfig(ADC1, ADC_Channel_12, 2, ADC_SampleTime_7Cycles5);
This post is from stm32/stm8

Latest reply

                                 This is not a problem with the ADC, but a problem with the front-end analog channel. In addition, the results obtained by directly measuring crosstalk are generally very confusing. It depends on your measurement method. It is recommended to test the analog signal, that is, do not connect the actual signal, use an ideal signal source to simulate the input. If the result is normal, then your signal processing circuit is not done well. Signal conversion, isolation, reference potential, all of these need to be checked one by one. ADC is actually a delicate thing.  Details Published on 2010-4-20 22:00

53

Posts

0

Resources
推荐
                                 What does it mean to “sample current without adding current, only adding voltage”?
This post is from stm32/stm8

81

Posts

0

Resources
2
提示: 作者被禁止或删除 内容自动屏蔽

78

Posts

0

Resources
3
The ADC input is the output of the op amp. A 1K resistor was originally connected in series, but later it was replaced with 0ohm, but the result was the same.
The only difference between uninterrupted sampling and ordinary sampling is that data processing and other calculations are required while sampling.
This post is from stm32/stm8

73

Posts

0

Resources
4
                                 Using an oscilloscope, there is no crosstalk between the pins. The problem should be inside the chip.
This post is from stm32/stm8

64

Posts

0

Resources
6
That's right. If no voltage value is added, the buffer value after voltage sampling is around 2048. After adding current signal, there will be data in the voltage buffer that obviously deviates from the value of 2048. It is equivalent to having voltage. And this value increases with the increase of current.
If you only start ADC sampling and DMA transmission without doing anything else, this situation will not occur.
This post is from stm32/stm8

66

Posts

0

Resources
7
" If you only start ADC sampling and DMA transfer and do nothing else, this situation will not occur. "

What does "do nothing else" mean? Did your "other things" change the contents of the DMA buffer, causing your wrong judgment?
This post is from stm32/stm8

85

Posts

0

Resources
8
                                 No current, only voltage?
This post is from stm32/stm8

67

Posts

0

Resources
9
This is not a problem with the ADC, but a problem with the front-end analog channel. In addition, the results obtained by directly measuring crosstalk are generally very confusing. It depends on your measurement method. It is recommended to test the analog signal, that is, do not connect the actual signal, use an ideal signal source to simulate the input. If the result is normal, then your signal processing circuit is not done well. Signal conversion, isolation, reference potential, all of these need to be checked one by one.

ADC is actually a delicate thing.
This post is from stm32/stm8

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

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