Artik 710 / S5P6818 ADC issue


#1

I need the high speed 1MS/s ADC data acquisition rates as listed in the Artik 710 specs. Unfortunately, the sysfs method provided by Artik is not fast enough. I also need one of the built in PWMs and 10 GPIO ports, so the Arduino IDE is not usable either. I have written code to modify the ADC registers (using mmap), but am unable to get any true readings from the ADCs.

I have the S5P6818 Users manual (v0.00), which appears to still need a lot of work. Most of the sections are taken verbatim from the S5P4418 Users manual.

It is unclear how to enable the PCLK for the ADC (if even needed).
And I am unsure of the functionality of the new parts of ADCCON (ADC_DATA_SEL, TOT_ADC_CLK_Cnt).

Any help would be appreciated.


#2

@Seneca37, sadly i haven’t personally used the S5P6818…

Looking thru the ADC section of the datasheet i found:

http://wiki.friendlyarm.com/wiki/images/8/8b/SEC_S5P6818X_Users_Manual_preliminary_Ver_0.00.pdf

I would start with the default prescaller currently used in the iio driver:

Did you stick the iio driver in continuous mode? TI has a pretty good step by step here:

http://processors.wiki.ti.com/index.php/Linux_Core_ADC_Users_Guide#Continuous_Mode

Regards,


#3

Thank you for your quick response.

  1. I do not think that the exynos_adc.c is appropriate for the ARTIK 710 unit. The register definitions do not correspond with the User’s Manual (and I see you found that). There is a nexell.c file in the kernel, and the V2 definitions match the manual. However, the prescaller is actually calculated from the clock rate, and the sample rate. I have no clue which clock is controlling the ADC. On page 122 of the manual, it states that the PCLK has a max freq of 166MHz - but I do not know what value the system has this set for.

I did try the value of 49 as suggested by exynos_adc.c, but did not get good results. My test program is currently only looking at ADC1, and I either short the input to Gnd, or apply the 1.8V from the board. But the ADC values I read in are just floating around.

  1. Continuous mode. First, I am not a Linux guru. I am guessing that I would need to update/change the kernel in order to use that feature. Issuing the command ./iio_generic_buffer (as root) resulted in a No such file message. But I do not think this would help me anyway. I need to read 32 ADCs, Our engineer has built a board to interface with the Artik system, such that 16 ADCs are muxed on 1 channel, and 16 on another.
    We have 5 gpios going to 1 mux, and 5 to the other. So I need to set the GPIOs to the appropriate channnel id value, read in ADC1 and ADC2, then update the GPIOs for the next channel. After all 16 channels on each mux have been read, I am timestamping the data. With the ARTIK IDE/Sysfs system, I was able to read all 32 ADCs in 4ms. But we need that time down to <1ms. I did find an article about “caching” the file ids, and was able to get the data acquisition down to 0.4ms/32 ADCs - However the data was garbage. If I do not close the files, Sysfs will not update them.

Again Thanks,


#4

Awesome, so the ARTIK 710’s ADC is not mainline…

Found it here:

They do have a “sample_rate” device tree option, so you could bump the value in the device-tree to force faster read’s…

Do you have IIO_BUFFER enabled in your config? Except your 32 ADC -> 2 Real ADC mux kinda defeats the purpose of the continuous buffer… Doing a 32 ADC -> 8 Real ADC would have made it more efficient. But in your case, it’s the GPIO’s to toggle the ADC mux is really causing the delay…

Regards,