adc_interrupt#
Overview#
The SAR ADC interrupt example shows the simplest way to use the SAR ADC driver.
In this example, three channels (channels 0, 1, and 2) are used to form a conversion chain, these three channels are executed in the normal conversion scan mode. The end-of-channel interrupt, pre-sample, DMA transfer and watchdog features of each channel in the conversion chain are disabled, and the end-of-chain interrupt is enabled. The user should provide a voltage signal as input to each conversion channel. When running the project, type any key into the debug console to get these three channels’ conversion result, when the conversions in the chain are completed, the end-of-chain interrupt will be triggered, and if the result of channel conversion is valid, it will be printed to the debug console.
Supported Boards#
IMX952LPD5EVK-19
Hardware requirements
Personal Computer
IMX952LPD5BB-19-REV-A EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Use the jumper to connect the J20 1-2, 3-4, 5-6
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4070.
The channel 1 ADC conversion data is 3734.
The channel 2 ADC conversion data is 2055.
IMX95LPD5EVK-19
Hardware requirements
Personal Computer
IMX95LPD5BB-19-REV-A EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Use the jumper to connect the J20 1-2, 3-4, 5-6
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4070.
The channel 1 ADC conversion data is 3734.
The channel 2 ADC conversion data is 2055.
FRDM-IMX95
Hardware requirements
Personal Computer
IMX95LPD5BB-19-REV-A EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Connect J9-5 to J2-3
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4063.
The channel 2 ADC conversion data is 1379.
The channel 3 ADC conversion data is 682.
FRDM-IMX952
Hardware requirements
Personal Computer
IMX952LPD5BB-19-REV-A EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Populate a 100k resistor at R213, and a 200k resistor at R215
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 34 ADC conversion data is 4084.
The channel 2 ADC conversion data is 2047.
The channel 3 ADC conversion data is 1365.
FRDM-IMX937
Hardware requirements
Personal Computer
IMX937LPD5BB-19-REV-A EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Connect J9-5 to J2-3
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4063.
The channel 2 ADC conversion data is 1379.
The channel 3 ADC conversion data is 682.
MCIMX93-EVK
Hardware requirements
USB Type-C cable
MCIMX93-EVK board
J-Link Debug Probe
12V~20V power supply
Personal Computer
Board settings
Connect ADC channel0 (ADC_CH_00) to voltage supply which is 1.8v.
Connect ADC channel1 (ADC_CH_01) to voltage supply which is 1.65v.
Connect ADC channel2 (ADC_CH_02) to voltage supply which is 0.9v.
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.
Connect a USB Type-C cable between the host PC and the J1401 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4070.
The channel 1 ADC conversion data is 3734.
The channel 2 ADC conversion data is 2055.
MCIMX93W-EVK
Hardware requirements
USB Type-C cable
MCIMX93W-EVK board
J-Link Debug Probe
12V~20V power supply
Personal Computer
Board settings
Connect ADC channel0 (ADC_CH_00) to voltage supply which is 1.8v.
Connect ADC channel1 (ADC_CH_01) to voltage supply which is 1.65v.
Connect ADC channel2 (ADC_CH_02) to voltage supply which is 0.9v.
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.
Connect a USB Type-C cable between the host PC and the J1401 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 0 ADC conversion data is 4070.
The channel 1 ADC conversion data is 3734.
The channel 2 ADC conversion data is 2055.
IMX943-EVK
Hardware requirements
Personal Computer
IMX943EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Set 0~3.3V voltage input to below ADC channels by using DC power supply ADC channel 4(J9-2) ADC channel 5(J9-5) ADC channel 6(J9-8)
Please note this application can’t support running with Linux BSP!
Prepare the Demo
Connect the 12V~20V power supply and J-Link Debug Probe to the board, and switch SW4 to power on the board.
Connect a micro USB cable between the host PC and the J31 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 re-power up your board or launch the debugger in your IDE to begin running the example.
Running the demo
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 4 ADC conversion data is 3962.
The channel 5 ADC conversion data is 3734.
The channel 6 ADC conversion data is 2055.
FRDM-MCXE31B
Hardware requirements
Type-C USB cable
FRDM-MCXE31B board
Personal Computer
Board settings
Connect the J4-8 to a voltage source.
Prepare the Demo
Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) 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
This demo will measure the Bandgap via ADC0 channel 48, measure VREFH via ADC0 channel 55, measure user defined voltage via channel 5. In this demo, the user defined voltage is 1.67v.
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 48 ADC conversion data is 12031.
The channel 55 ADC conversion data is 32765.
The channel 5 ADC conversion data is 16698.
FRDM-MCXE32B
Hardware requirements
Type-C USB cable
FRDM-MCXE32B board
Personal Computer
Board settings
Connect the J4-8 to a voltage source.
Prepare the Demo
Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) 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
This demo will measure the Bandgap via ADC0 channel 48, measure VREFH via ADC0 channel 55, measure user defined voltage via channel 5. In this demo, the user defined voltage is 1.67v.
When the example runs successfully, you will see similar information from the terminal shown below.
ADC interrupt example.
Please press any key to get the conversion result.
The channel 48 ADC conversion data is 12031.
The channel 55 ADC conversion data is 32765.
The channel 5 ADC conversion data is 16698.