justapotato213 opened a new pull request, #16011:
URL: https://github.com/apache/nuttx/pull/16011

   ## Summary
   
   This PR is from inspace. 
   
   This PR adds an experimental driver for the Texas Instruments 4 channel 16 
bit ADS1115 ADC.  The driver uses I2c and a software trigger, and implements 
the ADC driver interface from NuttX. 
   
   This PR also adds code to register the ADS1115 on RP2040 based boards, which 
was used for testing. 
   
   The PR also includes proper documentation for the ADS1115. 
   
   ## Impact
   
   The ADS1115 can be used with NuttX! 
   
   ## Testing
   
   Testing was done using the I2C0 bus on a Pico. 
   
   Testing included running the `adc` example app, with software triggering 
enabled, a group sample size of 8 and `ADC_FIFOSIZE` set to 9 to store all 8 
channels of measurement in the FIFO after a software trigger. 
   
   The ADS1115 was tested with a 3.3V source connected to A0. and another with 
a GND source connected to A1 and all other pins left floating. The PGA was set 
to the highest value, 6.144V, as other values are not large enough to capture 
the full voltage. 
   ```
   nsh> adc -n 1
   adc_main: g_adcstate.count: 1
   adc_main: Hardware initialized. Opening the ADC device: /dev/adc1
   Sample:
   1: channel: 0 value: 17446
   2: channel: 1 value: 14276
   3: channel: 2 value: 62656
   4: channel: 3 value: 0
   5: channel: 4 value: 17445
   6: channel: 5 value: 65534
   7: channel: 6 value: 2882
   8: channel: 7 value: 2873
   ```
   In this test, the values were within what was expected from the test setup. 
   Channel 0 measures the differential between A0 and A1, which is 3.3V and 
ground. After converting to volts (value * 6.144)/2^15, the result is 
3.271125V, which is within the expected range. 
   Channel 1 measures the differential between A0 and A3, which is expected to 
be the difference between 3.3V and a floating pin, resulting in a measured 
value of 2.67675V, which once again is expected. 
   Channel 2 measures the difference between A1 and A3, which is gnd and a 
floating pin. The ADS1115 outputs a 16bit value in two's complement, but the 
`adc` example app does not support this, which is why the result is off. 
Converting to a voltage, this value is -0.54V, which is expected  between gnd 
and a floating pin. 
   Channel 3 measures the difference between the two floating pins, which is 
why the value is 0. 
   Channel 4 through 7 are the single ended inputs, where it compares A0 to A3 
to GND. Converting each value results in a voltage of 3.2709375V, -0.000375V, 
0.540375V and 0.5386875V respectfully, which are all within the expected 
ranges. 
   
   Continuous and single shot modes were tested, and also work as expected. 
   
   The comparator / ALRT/RDY pin were also tested briefly by connecting an LED 
to the output and seeing it flash on and off. This test succeeded and showed 
the chip sending the signal, but I lack the equipment to test further beyond 
this. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to