vref_lpadc#
Overview#
The vref example shows how to use the vref driver.
In this example, we first get the default trim value of the VREF and measure the VREF output through the LPADC to get the default output voltage. Adjust the trim value by 30 steps to create a 20mv (300.54/3=20mv) voltage difference, The theoretical voltage value should be 20mv greater than or less than the default output voltage, then use the LPADC to measure the VREF output again, the measured voltage value should close to the theoretical voltage.
Supported Boards#
FRDM-IMXRT1186
Hardware requirements
Type-C USB cable
FRDM-IMXRT1186 board
Personal Computer
Board settings
Change Jumper J27 from 1-2 to 2-3
Connect ADC CHA1 (J51-8)(GPIO_AD_14) to VREFO(J37-1).
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
When the demo runs successfully, the log would be seen on the OpenSDA terminal like:
vref lpadc example
vref default trim value is: 7
vref default output voltage is 1194.595mv
current setting trim value is 37
current theoretical voltage is 1214.595mv
current actual voltage is 1214.817mv
Due to the errata051385, the ADC reference voltage is connect to the VDDA_ADC_1P8.
MIMXRT1180-EVK
Hardware requirements
Mini/micro USB cable
MIMXRT1180-EVK board
Personal Computer
Board settings
Connect ADC CH7A (J41-2) to VREFO(J10-1).
Prepare the Demo
Connect a USB cable between the host PC and the OpenSDA USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
When the demo runs successfully, the log would be seen on the OpenSDA terminal like:
vref lpadc example
vref default trim value is: 7
vref default output voltage is 1194.595mv
current setting trim value is 37
current theoretical voltage is 1214.595mv
current actual voltage is 1214.817mv
Due to the errata051385, the ADC reference voltage is connect to the VDDA_ADC_1P8.