Page 1 of 1

Slow ADC not working

Posted: Mon Sep 05, 2022 10:52 am
by gabvif
Hi all,

I'm trying to read a voltage on the slow ADC through the extension connector, the setup is exactly as described in ... -exm1.html.

I'm using a STEMlab 125-14 with OS v 1.04 build 18 and the standard API.

When I try to read the slow ADC using rp_ApinGetValueRaw(pin, &value); the result is still 0 no matter of which PIN number is selected. I checked using the multimeter that the input voltage on the pin is 1.5 V.

Can someone help me to figure out why?



Re: Slow ADC not working

Posted: Wed Sep 07, 2022 1:26 pm
by redpitaya
Hello gabvif!

The function to get the data from an Analog pin in C code is:

rp_ApinGetValue(pin) => data
(note that there is no Raw at the end of the function)

If you wish to get the raw ADC value, there is currently no such functionality, but you can add a requenst in the Ideas&Features section of the forum.

Re: Slow ADC not working

Posted: Tue Sep 20, 2022 3:08 pm
by gabvif

I checked the source code of the API library on your git, it seems that the rp_AIpinGetValueRaw exists and is used by rp_AIpinGetValue and using the rp_AIpinGetValue result is still 0; maybe I'm checking/using the wrong version.

Anyway, reading the raw value from the IIO device (as below) works fine and is enough for my application.

FILE *fp = fopen ("/sys/devices/soc0/amba_pl/83c00000.xadc_wiz/iio:device1/in_voltage11_vaux8_raw", "r");
uint32_t value = 0;
fscanf (fp, "%u", &value);



Re: Slow ADC not working

Posted: Tue Sep 20, 2022 3:32 pm
by redpitaya
Thank you for the update.

We will test the function and fix it, if it is broken.

Re: Slow ADC not working

Posted: Wed Sep 21, 2022 3:09 pm
by redpitaya
Both rp_AIpinGetValue and rp_AIpinGetValueRaw are working as of latest Beta OS (1.04.28) (tested on STEMlab 125-14)