adc_watchdog#
Overview#
The SAR ADC watchdog example shows the simplest way to use the SAR ADC driver.
In this example, the user-specified channel is used to execute in the normal conversion scan mode. The end-of-conversion, pre-sample, and DMA transfer features of each channel in the conversion chain are disabled. The analog watchdog function is enabled to monitor the conversion result, and the low and high threshold interrupt is enabled, The user should provide a voltage signal to each conversion channel. Running the project, after the channel conversion is completed, the conversion data will be compared with the low and high threshold values. If the conversion data is lower than the low threshold value, the low threshold interrupt will be asserted, if the conversion data is higher than the high threshold value, the high threshold interrupt will be asserted, and if the conversion data is valid, the conversion data will be printed on 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 J20 3-4, press the keyboard three times, and then connect J20 1-4
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 watchdog example.
Please press any key to get the conversion result.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3666.
The channel 1 ADC conversion value is 4070.
Current ADC value is higher than the high threshold.
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 J20 3-4, press the keyboard three times, and then connect J20 1-4
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 watchdog example.
Please press any key to get the conversion result.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3666.
The channel 1 ADC conversion value is 4070.
Current ADC value is higher than the high threshold.
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 watchdog example.
Please press any key to get the conversion result.
The channel 0 ADC conversion value is 4084.
Current ADC value is higher than the high threshold.
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 watchdog example.
Please press any key to get the conversion result.
The channel 34 ADC conversion value is 4095.
Current ADC value is higher than the high threshold.
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 watchdog example.
Please press any key to get the conversion result.
The channel 0 ADC conversion value is 4084.
Current ADC value is higher than the high threshold.
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 channel1 (ADC_CH_01) to voltage supply which is less than 1.8v.
Get ADC conversion data three times.
Connect ADC channel1 (ADC_CH_01) to voltage supply which is more than 1.8v.
Get ADC conversion data one time.
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 watchdog example.
Please press any key to get the conversion result.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3666.
The channel 1 ADC conversion value is 4070.
Current ADC value is higher than the high threshold.
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 channel1 (ADC_CH_01) to voltage supply which is less than 1.8v.
Get ADC conversion data three times.
Connect ADC channel1 (ADC_CH_01) to voltage supply which is more than 1.8v.
Get ADC conversion data one time.
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 watchdog example.
Please press any key to get the conversion result.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3664.
The channel 1 ADC conversion value is 3666.
The channel 1 ADC conversion value is 4070.
Current ADC value is higher than the high threshold.
IMX943-EVK
Hardware requirements
Personal Computer
IMX943EVK board
12V~20V power supply
J-Link Debug Probe
Micro USB cable
Board settings
Set 1.8V voltage input to J9-5 by using DC power supply, press the keyboard three times and then connect 3.3V to J9-5.
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 watchdog example.
Please press any key to get the conversion result.
The channel 5 ADC conversion value is 2064.
The channel 5 ADC conversion value is 2065.
The channel 5 ADC conversion value is 2033.
The channel 5 ADC conversion value is 3945.
Current ADC value is higher than the high threshold.
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
When the example runs successfully, you will see similar information from the terminal shown below.
ADC watchdog example.
Please press any key to get the conversion result.
The channel 5 ADC conversion value is 21903.
The channel 5 ADC conversion value is 22297.
The channel 5 ADC conversion value is 22761.
The channel 5 ADC conversion value is 23149.
The channel 5 ADC conversion value is 23769.
Current ADC value is higher than the high threshold.
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
When the example runs successfully, you will see similar information from the terminal shown below.
ADC watchdog example.
Please press any key to get the conversion result.
The channel 5 ADC conversion value is 21903.
The channel 5 ADC conversion value is 22297.
The channel 5 ADC conversion value is 22761.
The channel 5 ADC conversion value is 23149.
The channel 5 ADC conversion value is 23769.
Current ADC value is higher than the high threshold.