ADS1115 C library and main.c is attached below
OnSemi RSL-10 module has 4 ADC inputs but on RSL10-Sense-GEVK only one ADC input is available. Due to the availability of only 1 ADC pin user has only 2 options either use this single analog input with any analog mux (i.e. CD4051BE) or use an external ADC to measure multiple analog inputs. And here ADS1115 16-bit ADC is used to measure up to 4 single ended or 2 differential analog signals.
In order to use I2C interface of RSL10 module we need to enable the CMSIS driver for I2C interface as shown below. The CMSIS I2C driver also require device DMA and GPIO libraries and these two should be enabled from RTEConfig.
After enabling all the required interfaces and corresponding libraries when we will built the code, it will result in similar error as shown below.
And the reason of above errors is that DMA is disabled from RTE device header file and we need to modify the RTE_DMA configuration in RTE_Device.h (../RTE/Device/RSL10/RTE_Device.h) file as given below. After enabling the DMA from RTE device header file, above errors will disappear and code will build successfully.
// <e> DMA Configuration // ======================= // // <i> Defines if DMA driver should be enabled. // <i> Default: 1 #ifndef RTE_DMA #define RTE_DMA 1 // Change to 1 if 0 #endif // <e>DMA 0 enabled
Using the ADS1115 C library and main.c files attached below we can print the ADC values using Segger J-Link RTT viewer or Telnet terminal from within the ON-Semi eclipse IDE. RTT viewer is displaying the 6 analog readings and first four are single ended analog values at each channel and last 2 readings are differential values between channels 0 & 1 and 2 & 3.
ADS1115 datasheet: http://www.ti.com/lit/ds/symlink/ads1114.pdf