Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADC

Analog to Digital Converter (ADC)

ADC Introduction

ADC module block diagram showing bandgap, temperature sensor, and SARADC signal paths

  • ADC module supports temperature and voltage measurement.
  • The ADC is a 10-bit successive approximation analog-to-digital converter.
  • Generates a voltage varying linearly with junction temperature, -40°C to 125°C.
  • The Bandgap generates Vreference and Vtemperature, which are converted into digital output by SARADC.
  • ADC calculation: VIN = dout / 1023 * Vbg
    • e.g. at 25°C: VIN = (516 / 1023) * 1.208 = 0.609 V
  • VIN: sample voltage input via PORT A Function 0:
    • PA04: ADC0
    • PA05: ADC1
    • PA06: ADC2
    • PA07: ADC3

ADC Main Features

Key parameters:

  • Conversion rate up to 100 KS/s; each conversion costs at least 14 clock cycles.
  • Conversion rate can be adjusted by changing the clock frequency or increasing the clock cycles per conversion.
  • Clock frequency base: 16 MHz.
  • adc_tsen_clk (Bandgap clock): 8 MHz to 16 MHz.
  • adc_clk (ADC clock): 0.2 MHz to 1.6 MHz.

DC Characteristics:

ParameterSymbolMinTypMaxUnit
Temperature range-40125°C
Temperature resolution0.6°C
Temperature accuracy-4+4°C
Voltage referenceVBG1.208V
Voltage input rangeVIN0.31.0V
Voltage resolution0.3mV
Voltage accuracy-10+10mV
ADC resolution10Bit
Effective number of bitsENOB9Bit
Differential nonlinearityDNL-1+1LSB
Integral nonlinearityINL-2+2LSB

DMA: 1 RX channel.

Operation Modes

Temperature Sensor

To start the temperature sensor, the bandgap circuit, the related voltage buffers, and ADC should be enabled successively.

Flowchart showing the enable sequence for temperature sensor mode

Voltage Measurement

To start voltage measurement, the external voltage buffer should be turned on instead of the temperature-related voltage buffer, and adc_sel[1:0] should be set to 2'b01 to select the external voltage input for ADC.

Flowchart showing the enable sequence for voltage measurement mode

Start Timing Specification

ParameterMinTypMax
t110 µs
t20 µs
t390 µs

The ADC starts conversion when adc_sample goes high and requires 14 clock cycles to complete. When conversion is complete, adc_data_valid is set high at the 15th clock cycle for one clock cycle. The result adc_dout[9:0] also becomes valid at the 15th clock cycle and remains valid until the next conversion completes.

ADC start timing diagram showing adc_sample, clock, adc_data_valid, and adc_dout signals

Table for Temperature Output

TemperatureTemperature Sensor Output (Typ)
-40°C627
-35°C619
-30°C610
-25°C601
-20°C593
-15°C584
-10°C576
-5°C568
0°C560
5°C551
10°C542
15°C534
20°C525
25°C516
30°C508
35°C500
40°C492
45°C483
50°C474
55°C466
60°C458
65°C449
70°C440
75°C432
80°C423
85°C415
90°C407
95°C398
100°C389
105°C380
110°C372
115°C363
120°C354
125°C346

ADC Interrupts

Each ADC module supports 1 interrupt:

  • s_rx_ch_events: DMA RX channel receive buffer full
  • NVIC IRQn: 121

ADC Registers

Base address: 0x5011_4000

Register NameOffsetSizeTypeAccessDefaultDescription
ADC_RX_SADDR0x000032ConfigR/W0x00000000RX buffer base address configuration register
ADC_RX_SIZE0x000432ConfigR/W0x00000004RX buffer size configuration register
ADC_RX_CFG0x000832ConfigR/W0x00000000RX stream configuration register
ADC_CR_CFG0x001032ConfigR/W0x00000000ADC control configuration register

Register Descriptions

ADC_RX_SADDR — RX Buffer Base Address

  • Address offset: 0x0000
  • Reset value: 0x0000_0000
BitsFieldAccessDescription
[15:0]RX_SADDRR/WRX buffer base address. Read: returns current buffer pointer value during transfer, else 0. Write: sets RX buffer base address.

ADC_RX_SIZE — RX Buffer Size

  • Address offset: 0x0004
  • Reset value: 0x0000_0004
BitsFieldAccessDescription
[16:0]RX_SIZER/WRX buffer size in bytes (max 1 MByte). Read: returns remaining bytes to transfer. Write: sets buffer size.

ADC_RX_CFG — RX Stream Configuration

  • Address offset: 0x0008
  • Reset value: 0x0000_0000
BitsFieldAccessDescription
[5]PENDINGR/WRX transfer pending status: 0 = no pending transfer, 1 = pending transfer in queue
[4]ENR/WRX channel enable and start: 0 = disable, 1 = enable and start transfer. Also used to queue a transfer if one is already ongoing.
[2:1]DATASIZER/WChannel transfer size for uDMA buffer address increment. 10 (const) = +4 (32-bit)
[0]CONTINOUSR/WContinuous mode: 0 = disabled, 1 = enabled. When enabled, the uDMA reloads the address and buffer size and starts a new transfer at the end of each buffer.

ADC_CR_CFG — ADC Control Configuration

  • Address offset: 0x0010
  • Reset value: 0x0000_0000
BitsFieldAccessDescription
[7:0]adc_ana_controlR/WADC IP register configuration (see bit detail below)
[12:8]adc_data_countR/WADC clock cycles per sample (must be ≥ 14)
[13]adc_tsen_enR/WBandgap enable: 0 = disable, 1 = enable
[14]adc_enR/WADC enable: 0 = disable, 1 = enable
[15]adc_rstnR/WADC reset: 0 = default, 1 = reset
[23:16]adc_clkfdR/WADC clock divider (base 16 MHz). adc_clk = 16000 / adc_clkfd kHz. Must yield a frequency between 0.2–1.6 MHz. e.g. adc_clkfd = 80adc_clk = 200 kHz; adc_clkfd = 10adc_clk = 1600 kHz
[25:24]adc_selR/WADC input select: 00 = temperature-related voltage, 01 = external voltage
[27:26]adc_vin_selR/WAnalog input mux: 00 = PA04 (ADC0), 01 = PA05 (ADC1), 10 = PA06 (ADC2), 11 = PA07 (ADC3)

adc_ana_control bit detail:

BitDescription
[0]Bandgap chopper enable: 0 = disable, 1 = enable
[1]Temperature-related voltage buffer: 0 = disable, 1 = enable
[2]Bandgap voltage buffer: 0 = disable (use AVDD as reference), 1 = enable (use Bandgap voltage as reference)
[3]External voltage buffer: 0 = disable, 1 = enable
[4]Temperature-related voltage select: 0 = voltage 1, 1 = voltage 2
[5]Temperature-related voltage filter bypass: 0 = use filter, 1 = bypass filter
[6]Bandgap voltage filter bypass: 0 = use filter, 1 = bypass filter
[7]Reserved