Example Description
This example demonstrates the Open Shorts Detection circuit on the ADC channels for detecting the pin faults in the system. the example enables the OSD circuit along with the mandatory ADC configurations (see Assumptions below) and diagnoses ADC0-Channel 0 input pin. The open short detection circuit connects a resistor between an analog input pad and either supply or ground. These resistors can be used to estimate the input impedance of the circuit driving the analog input pad thereby detecting if the pad is shorted or open.
Assumptions for the OSD Usage
- ADC is in Single Ended Mode
- Sampling time is increased well above the minimum value
- Atleast 1 uS delay after configuring the OSD circuit to ADC samples
- OSD is not implemented on the CAL 1,2 inputs.
- Divider Resistence tolerances vary widely and are not used for accuracy checks
OSD Circuit configurations
| config | function | Impedance | Voltage on 5K | Voltage on 7K |
| 0 | Zero Scale | 5K // 7K | VSSA | VSSA |
| 1 | Zero Scale | 5K | VSSA | OPEN |
| 2 | Zero Scale | 7K | OPEN | VSSA |
| 3 | Full Scale | 5K // 7K | VDD | VDD |
| 4 | Full Scale | 5K | VDD | OPEN |
| 5 | Full Scale | 7K | OPEN | VDD |
| 6 | 5/12 Scale | 5K // 7K | VSSA | VDD |
| 7 | 5/12 Scale | 5K // 7K | VDD | VSSA |
Qualification process
In the example, ADCA A0 channel is configured and following algorithm is used to check the A0 pin status:
- Configure full scale OSDETECT mode & capture ADC results(resultHi)
- Configure zero scale OSDETECT mode & capture ADC results(resultLo)
- Disable OSDETECT mode and capture ADC results(resultNormal)
- Determine the state of the ADC pin
- If the pin is open, resultLo would be equal to Vreflo and resultHi would be equal to Vrefhi
- If the pin is shorted to Vrefhi, resultLo should be approximately equal to Vrefhi and resultHi should be equal to Vrefhi
- If the pin is shorted to Vreflo, resultLo should be equal to Vreflo and resultHi should be approximately equal to Vreflo
- If the pin is connected to a valid signal, resultLo should be greater than osdLoLimit but less than resultNormal while resultHi should be less than osdHiLimit but greater than resultNormal
| Input | Full-Scale output | Zero-scale Output | Pin Status |
| Unknown | VREFHI | VREFLO | Open |
| VREFHI | VREFHI | approx. VREFHI | Shorted to VREFHI |
| VREFLO | approx. VREFLO | VREFLO | Shorted to VREFLO |
| Vn | Vn < resultHi < VREFHI | VREFLO < resultLo < Vn | Good |
- osDetectStatusVal of value greater than 4 would mean that there is no pin fault.
- If osDetectStatusVal == 1, means pin A0 is OPEN
- If osDetectStatusVal == 2, means pin A0 is shorted to VREFLO
- If osDetectStatusVal == 4, means pin A0 is shorted to VREFHI
- If osDetectStatusVal == 8, means pin A0 is in GOOD/VALID state
- Any value of osDetectStatusVal > 4, means pin A0 is in VALID state
Configurations
- The ADC0 SOC0 is configured sample on the Channel 2.
- The SOC0 Sample and hold window is set to 256 for OSD detection usecase
- ADC0 INT1 is configured for the EOC0.
- SOC0 is triggered by Software.
- OSD circuit is enabeld for ADC0, Channel 2 (see below execution)
External Connections
ADC0-SOC0 Samples on Channel 2.
- on AM263Px CC E2 or AM261x-SOM E1, with HSEC Dock
- Feed Analog input to ADC0_AIN2 - HSEC PIN 15
- on AM263Px LP
- Feed Analog Input to the ADC0_AIN2 - J7 Pin 66
- on AM261x-LP
- Feed Analog Input to the ADC0_AIN2 - J7 Pin 63
Watch Variables
osDetectStatusVal - OS detection status of voltage on ADC Channel. adcResult - a digital representation of the voltage on ADC Channel. */
Supported Combinations
| Parameter | Value |
| CPU + OS | r5fss0-0 nortos |
| Toolchain | ti-arm-clang |
| Board | am263px-cc, am263px-lp |
| Example folder | examples/drivers/adc/adc_open_shorts_detection/ |
Steps to Run the Example
- When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).
- When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)
- Establish connections as mentioned in External Connections section
- Launch a CCS debug session and run the executable, see CCS Launch, Load and Run
- Using watch variables, view the ADC conversion results.
- View the ADC conversion results in UART console logs
See Also
ADC
Sample Output
Shown below is a sample output when the application is run,
An Open Pin sample result
ADC Open Shorts Detection Test Started ...
config | Result | Mean Result |Result without OSD on
0 | 43 | 2056 |4095
1 | 11 | 2056 |4095
2 | 12 | 2056 |4095
3 | 4095 | 2056 |4095
4 | 4095 | 2056 |4095
5 | 4095 | 2056 |4095
status : APP_ADC_OSDETECT_STATUS_OPEN
ADC Open Shorts Detection Test Passed
All tests have passed!!
A Pin Shorted to VREFLO sample result
ADC Open Shorts Detection Test Started ...
config | Result | Mean Result |Result without OSD on
0 | 0 | 1 |0
1 | 0 | 1 |0
2 | 0 | 1 |0
3 | 6 | 1 |0
4 | 2 | 1 |0
5 | 1 | 1 |0
status : APP_ADC_OSDETECT_STATUS_SHORTED_TO_VREFLO
ADC Open Shorts Detection Test Passed
All tests have passed!!
A Pin Shorted to VREFHI sample result
ADC Open Shorts Detection Test Started ...
config | Result | Mean Result |Result without OSD on
0 | 4095 | 4092 |4095
1 | 4095 | 4092 |4095
2 | 4095 | 4092 |4095
3 | 4095 | 4092 |4095
4 | 4095 | 4092 |4095
5 | 4095 | 4092 |4095
status : APP_ADC_OSDETECT_STATUS_SHORTED_TO_VREFHI
ADC Open Shorts Detection Test Passed
All tests have passed!!