cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8 fail in two analog measurements!!

Jesus Villanueva
Associate II
Posted on May 02, 2017 at 03:32

Hi to everybody!! I'm really concerned about an issue with my MCU. When I use direct current in two channel inputs of the ADC converter, I can see the data and the measurement of the two channels in a right way (I use Matlab and Docklight to receive the signal trough the USART). The problem appears when I start to measure a sine wave, then  just one of the two channels works and the other one measure zero. I use now an operational adder circuit before the input of the ADC and without it, that channel wich works, send the highest value (4095) while the other one remains at zero. What could be the problem, should I add an adder non inverter at the input of the ADC channel, it's the MCU? I really appreciate your help and thank you very much from now!!

#stm32f103
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on May 16, 2017 at 17:22

Hi, Avatar! From now I'm really sorry for don't answer before, but I want to share you how did I solve that problem: The first thing was to draw all the circuit and follow it line by line, then I replaced the adder circuit by one made with an LM317. Then I noticed that the signal to measure wasn't properly amplified, the circuit was wrong and then I had to make a new amplifier circuit, but this time more simple, with just two resistors, instead of all the scheme for the instrumentation amplifier.

As magic, the two channels for the ADC started to work properly and all its send by USART. I searched how to use the UART, but I guess this MCU don't have this feature on it. Now I'm playing with the acquisition speed of the ADC channels and how this can work with the speed of the USART port to send a good signal to the computer. Thank you very much and we'll keep in contact!!!

View solution in original post

4 REPLIES 4
AvaTar
Lead
Posted on May 02, 2017 at 09:40

Hard to judge from the given description, but did you check the ADC input signals with as scope ?

I suggest to follow the data path through your setup, and verify each one:

  • analog input at the ADC
  • converted values in memory
  • UART transmission
  • received data in your PC application

(I use Matlab and Docklight to receive the signal trough the USART).

Are your sure the bandwidth matches, i.e. the UART transmission can keep up with incoming data ?

Posted on May 03, 2017 at 01:38

Hi Avatar, thank you for answer. Yes I do, I use an oscilloscope to watch the sine wave. And well, add the measurement to the memory could be useful, but the problem is not how to receive, because that already does, I can receive the data from the two channels without problems when I use direct current, the issue it's when I try to measure the sine wave just one of the channels works.

I use an instrument amplifier after the source of the sine wave and before the ADC chanel on MCU, but even when I ignore this stage of the circuit just one channel works.

I'll check out this amplifier but the question still's up

Posted on May 03, 2017 at 07:35

I can receive the data from the two channels without problems when I use direct current, the issue it's when I try to measure the sine wave just one of the channels works.

If I understood your initial post correctly, this assumption is based on data/results you receive within your Matlab program.

I suggest to capture a sine wave (or part of it), and view it in a debugger, on your target. To work properly, your sampling code need to fulfill certain bandwidth requirements. With a DC signal, you can't distinguish sequential measurements ...

If the still form a sine wave as supposed, go on to check the UART transmission.

Posted on May 16, 2017 at 17:22

Hi, Avatar! From now I'm really sorry for don't answer before, but I want to share you how did I solve that problem: The first thing was to draw all the circuit and follow it line by line, then I replaced the adder circuit by one made with an LM317. Then I noticed that the signal to measure wasn't properly amplified, the circuit was wrong and then I had to make a new amplifier circuit, but this time more simple, with just two resistors, instead of all the scheme for the instrumentation amplifier.

As magic, the two channels for the ADC started to work properly and all its send by USART. I searched how to use the UART, but I guess this MCU don't have this feature on it. Now I'm playing with the acquisition speed of the ADC channels and how this can work with the speed of the USART port to send a good signal to the computer. Thank you very much and we'll keep in contact!!!