2858 views|2 replies

664

Posts

104

Resources
The OP
 

STEVAL-IDB007V1 ADC Test 1 [Copy link]

  This post was last edited by gs001588 on 2018-1-26 03:10
STEVAL-IDB007V1 ADC Test 1
This evaluation and challenge is mainly to detect the battery power, so ADC conversion must be used.
By comparing the three ADC sample programs DMA, PDM, and Polling, I think Polling can meet the requirements for single conversion. Therefore, this post only introduces and analyzes the Polling sample program.
Test project path “BlueNRG-1_2 DK 2.5.0\Project\BlueNRG1_Periph_Examples\ADC\Polling\MDK-ARM\BlueNRG-1\Polling.uvprojx”, use Keil project.
Open Keil project. We only care about two files “ADC_Polling_main.c” and “BlueNRG1_it.c” under “User”. “ADC_Polling_main.c” is the main program and “BlueNRG1_it.c” is the interrupt service program. Don’t worry about the others.
“BlueNRG1_it.c” contains only one tick clock interrupt service, which is relatively simple. It is used for delay in the main program.
Open the main program “ADC_Polling_main.c”. It contains header files, global variables for timing delay, definition of ADC initialization structure, millisecond delay function (based on tick clock), and ADC configuration.
System initialization, platform identification, LED1 initialization (for flashing in the program), serial port configuration (serial port prints ADC information), tick reference clock timing 1ms initialization, ADC configuration and main loop. Let's focus on the ADC part.
Take a look at the function "ADC_Configuration()". ST's consistent style is to start the corresponding clock before operating the peripherals. What do the next five parameter settings mean? Let’s take a look at them in conjunction with the comments and data sheet.
“ADC_OSR_200”——Well, there is no choice. This is the only one to use for DC acquisition.
“ADC_Input_AdcPin12”——Differential acquisition to eliminate common-mode interference; it is also possible to test the loop current by connecting a milliohm sampling resistor in series.
“ADC_ConversionMode_Single”——Yes, a single acquisition is enough, no need for cyclic acquisition.
“ADC_ReferenceVoltage_0V6”——Sampling reference voltage 0.6V
“ADC_Attenuation_9dB54”——Since the acquisition range is 0 to 3.6V, the Attenuation needs to be set to 9.54
“ADC_Init()” assigns the initial structure parameters to the registers, and ignore “ADC_Calibration(ENABLE)” and “ADC_AutoOffsetUpdate(ENABLE)” AD calibration and automatic offset update for now, just use them. ADC_Init(&xADC_InitType);
/* Enable auto offset correction */ ADC_Calibration(ENABLE); ADC_AutoOffsetUpdate(ENABLE);[/code] The “ADC_Cmd(ENABLE)” function starts a new ADC conversion. It is just for use. It judges the conversion completion flag. If the conversion is completed, it reads the ADC data, prints the data output to the serial port, flashes the light, delays, and starts the next conversion.
I like the style of ST. The sample program is relatively simple and the comments are sufficient.
The program simulation runs at full speed.
Use the serial port to check the ADC data
Try to test the voltage of several points
The serial port prints and displays the voltage value of each point. Compared with the multimeter's measured values of 3.298V, 1.370V, and 1.928V, the BlueNRG-1's ADC conversion accuracy is already very good, and its linearity is also pretty good. What else do you want?
So far, the ADC simple test is complete.
Then let's take a look at the ADC's value and voltage conversion, which is also a more interesting point of BlueNRG-1. It seems to be complicated. It is divided into 5 situations.
According to the data sheet,
For the Farad capacitor voltage measurement in the challenge, the ADC needs to use the “ADC_ConvertBatterySensor” mode.
928V, BlueNRG-1's ADC conversion accuracy is already very good, and the linearity is also good, what else do you want.
So far, the simple ADC test is completed.
Then let's understand what the ADC value and voltage conversion are like, which is also a more interesting point of BlueNRG-1, which seems to be complicated. It is divided into 5 situations.
According to the data sheet,
For the Farad capacitor voltage measurement in the challenge, the ADC needs to use the “ADC_ConvertBatterySensor” mode.
928V, BlueNRG-1's ADC conversion accuracy is already very good, and the linearity is also good, what else do you want.
So far, the simple ADC test is completed.
Then let's understand what the ADC value and voltage conversion are like, which is also a more interesting point of BlueNRG-1, which seems to be complicated. It is divided into 5 situations.
According to the data sheet,
For the Farad capacitor voltage measurement in the challenge, the ADC needs to use the “ADC_ConvertBatterySensor” mode.
This post is from ST - Low Power RF

Latest reply

The conversion formulas are all written in the BlueNRG-1 ADC library, which is really convenient to use.  Details Published on 2018-1-26 10:16

赞赏

1

查看全部赞赏

 
 

9720

Posts

24

Resources
2
 
The conversion formulas are all written in the BlueNRG-1 ADC library, which is really convenient to use.
This post is from ST - Low Power RF

Comments

Yes, it’s very convenient, ST loves it!  Details Published on 2018-1-26 11:08
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

664

Posts

104

Resources
3
 
littleshrimp posted on 2018-1-26 10:16 The conversion formulas are all written in the ADC library of BlueNRG-1, which is really convenient to use
Yes, it is very convenient, ST loves it!
This post is from ST - Low Power RF
 
 
 

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