For participants looking for a place to connect with other competitors and enthusiasts.
I’m in the contest, hello everyone!
Awesome, what’s your project if you don’t mind me asking?
It’s all good I don’t mind you asking me that.
I can tell you that the project is related to automotive industry, but for the rest I prefer to wait until publish it.
Are you in the contest as well?
My project involves taking Fast Fourier Transforms of the Analog to Digital converter pins. I’ve done it in Matlab using the a/d converter on an Arduino uno and using Matlab to open the serial port to read the data. Now I want to do it on a microcontroller.
I’ve never used python, micropython or circuitpython. What flavour of python does Giant Board use? Where to I go to start learning how to look at the ports, do A to D conversions etc? The documentation web page is a tad sparse…
Hey, welcome to the forums! The giant board has a unique setup for it’s ADC. They are enabled by default and you can read values directly in Linux using your choice of language. You can see a great example and lots of info here about using the ADC.
The standard Python interpreter on the Giant Board is CPython, the same as you would also use on desktops. I imagine the Unix port of MicroPython should run as well, but there’s probably no reason to use it unless you have special requirements. I don’t know if CircuitPython still has a Unix port, but the recommended way of using CircuitPython libraries is to use Adafruit Blinka on CPython, which is already installed in the standard image. I.e. you can just run
python3 and import CircuitPython modules as if you were on CircuitPython.
I don’t see /sys/bus/iio/devices/iio:device0 on my giantboard, either with the prebuilt giantboard-debian-9.7-1GB-1-17-2020.zip or the newest giantboard-debian-9.12-1GB-5-22-2020.zip.
In fact, I don’t see anything below /sys/bus/iio/devices. I also don’t see anything in dmesg with ‘adc’ in it; supposedly, this should work:
# dmesg|grep at91-sama5d2_adc at91-sama5d2_adc fc030000.adc: version: 800
I do see
CONFIG_AT91_SAMA5D2_ADC is set in the giantboard-tools/patches/kernel/giantboard_defconfig, so if the prebuilt images use this, the driver should be there.
In /sys/bus/platform/drivers I do see at91_adc and at91-sama5d2_adc, so maybe it’s sort of there.
I do have the WiFi featherwing and I2S-NO-MCK overlays enabled, but even if I disable overlays, the above still holds.
What do I need to do to enable the ADCs?
As mentioned in the above post, they are enabled by default. I would double check your path is correct.
Sorry for all the questions today.
I hear you, but I’m using the path as copied from the linked-to article above:
debian@giantboard:~$ sudo ls /sys/bus/iio/devices/iio\:device0 ls: cannot access '/sys/bus/iio/devices/iio:device0': No such file or directory debian@giantboard:~$ sudo ls /sys/bus/iio/devices/ -al total 0 drwxr-xr-x 2 root root 0 Jun 7 21:17 . drwxr-xr-x 4 root root 0 Jun 7 21:17 ..
As you can see, there is nothing within /sys/bus/iio/devices/.
debian@giantboard:~$ dmesg | grep adc [ 0.410000] can: broadcast manager protocol (rev 20170425 t)
there is no adc device message as the article indicates there should be.
Do you see what the article indicates you should in sysfs and in dmesg?
I see what the issue is. I disabled the ADC in the main overlay, I need to make an overlay to re-enable the device. I will push a new image up here in a few minutes that includes an overlay to enable the ADC.
I just pushed up a new image that includes an overlay
GB-ADC.dtbo to enable the ADC, you should then see it under the iio devices.
That did it – thanks so much for the excellent customer service.
Please be aware that the new project submission deadline is now 7th July 2020. Head over to Electromaker.io and start documenting your projects soon!