I need twoADC channels. I tried to configure using :
CONFIG_ADC= y in prj file,
&adc{
#io-channel-cells = < 0x2 >;
}; in overlay file .. the compile error appears as shown in atteched iamge.
Gulzar Singh

I need twoADC channels. I tried to configure using :
CONFIG_ADC= y in prj file,
&adc{
#io-channel-cells = < 0x2 >;
}; in overlay file .. the compile error appears as shown in atteched iamge.
Gulzar Singh

Hello,
SAADC supports 8 channels- One cannel per single-ended input and two channels per differential input. So, If you want two single-ended inputs- you need to create two separate channel configurations; one for AIN0 and one for AIN1 for instance. It has to be defined from the main.c file. Also if you intend to do periodic sample using PPI or collect the sample as part of interrupt handling like this example I linked before https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/peripherals/adc.html?highlight=adc_channel_cfg#c.adc_channel_cfg ; you have to define this in C file.
Best Regards,
Kazi Afroza Sultana
Hi, I created an application for testng the sampling of 2 channels on AIN0 and AIN1. The files are attached. I have few doubts.
1. In the adc.h, is #define BUFFER_SIZE 2 right or wrong to sample 2 analog channels ? If in future, 3 chhannels are required, may I set #define BUFFER_SIZE 3.
2. In the main file, I adc instantiated by binding and then, set up channels using err = adc_channel_setup() .. function. Is it proper way ?
3. As, I copied the most coe from sample program, what is meaning of following ?
#if defined (CONFIG_BOARD_BMS_NRF5340_CPUAPP)
NRF_SAADC->TASKS_CALIBRATEOFFSET = 1;
4. I wrote two sample functions, as in adc.c. Is this proper way to add to sequence ? If, wrong any where, may you make changes and attache corrected code file ?
5. I called adc sampling functions in repeatitive timer. Is the result of adc from AIN0 and AIN1 be avaialble at same index or at different indices in p_sample_buffer[].


Gulzar Singh
Hello Gulzar,
I have started looking at your files. Could you please send me the whole project so I can try to reproduce it?
Best Regards,
Kazi Afroza Sultana
Hi, here is the code in attached file.

Hi, here is the code in attached file.

I mean the project folder which contain build file, configure file, cmakelist text file and source file. like the following screenshot:

Hi, I just need answer of three queries as shown in attached image.