how to use ADC in CYBT-343026-01

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AkJa_4647796
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

hello, Is there any document related to how to use ADC. I am using CYBT_343026-01 and want to use two adc fro temperature and battery services. is there any example?

0 Likes
1 Solution

Hi AkJa_4647796 ,

CYBT-343026-01 uses 10 bit for DC measurements & 12 bit for Audio channels.

The full scale count   is the supplied voltage (3.3V)

There are two APIs :

wiced_hal_adc_read_raw_sample   This will read a 16 bit in 1 sample directly from the register. In this case the full scale value is in signed 16 bits

wiced_hal_adc_read_voltage will do averaging and from the first 10 bits and give an averaged value of say 7 samples. This is done by firmware internally .

So if you wants to sample at very high rate, then you  can use raw samples (wiced_hal_adc_read_raw_sample   ) but that may have noise. So you have to get few samples and then take an average.

Regards,

Anjana

View solution in original post

5 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello AkJa_4647796

Please refer to example available in WICED SDK - /20706-A2_Bluetooth/apps/snip/hal/adc

Regards,

Anjana

Thank you for you response AnjanaM_61

I have use the hal_adc example and got result in serial terminal. But in CYBT-343026-01 documents, they have mentioned as - ADC for audio (12 bits) and DC measurement (10 bits).

accorcing to the code

raw_val = wiced_hal_adc_read_raw_sample( ADC_INPUT_P33);               //which is GPIO_3  pin no 22

voltage_val = wiced_hal_adc_read_voltage( ADC_INPUT_P33);

WICED_BT_TRACE("Raw value of ADC Channel %d \t: %d\t\t", CHANNEL_TO_MEASURE_DC_VOLT, raw_val);

WICED_BT_TRACE("Voltage value of ADC Channel %d(in mV)  : %d\r\n\n", CHANNEL_TO_MEASURE_DC_VOLT, voltage_val);

i am getting output of voltage with 0.050mv difference. but the raw count is -18333 to 17937. in datasheet they have mentioned 10 bits(1024) adc for DC measurement.

And  ANALOG core supply i.e VDDC is the internal voltage?

And in CYW920706WCDEVAL Hardware User Guide

it is mentioned J30 = Short this jumper to connect GPIO P15 to VDDIO for battery monitoring applications.

i am not using EVAL Board. and they have not mentioned any pad name GPIO_5 or P15.

In adc.h file ADC_INPUT_P33           =   0x15,   //GPIO 5    so does that men i am using the same adc channel.

About ADC Electrical Characteristics in CYBT-343026-01 (CYW20706-A2) . this has some technical details.

Thank You.

0 Likes

Hi AkJa_4647796 ,

CYBT-343026-01 uses 10 bit for DC measurements & 12 bit for Audio channels.

The full scale count   is the supplied voltage (3.3V)

There are two APIs :

wiced_hal_adc_read_raw_sample   This will read a 16 bit in 1 sample directly from the register. In this case the full scale value is in signed 16 bits

wiced_hal_adc_read_voltage will do averaging and from the first 10 bits and give an averaged value of say 7 samples. This is done by firmware internally .

So if you wants to sample at very high rate, then you  can use raw samples (wiced_hal_adc_read_raw_sample   ) but that may have noise. So you have to get few samples and then take an average.

Regards,

Anjana

Thank you for your help AnjanaM_61

0 Likes

Hello AnjanaM_61​,

i am applying 2.75 volt to ADC pin (P38 = 11 pin of cybt-343026-01 pad), but while reading adc voltage i am getting output as 2666mv (approx 0.1v difference)

wiced_hal_adc_set_input_range(ADC_RANGE_0_3P6V);

voltage_val = wiced_hal_adc_read_voltage(ADC_INPUT_P38);

WICED_BT_TRACE("Voltage value of ADC Channel %d(in mV)  : %d\r\n\n", ADC_INPUT_P38, voltage_val);

What could be the problem?

0 Likes