ctag-fh-kiel / bela-ctag

Resources regarding Bela CTAG boards
2 stars 2 forks source link

Connecting a Potentiometer via SPI Using CTAG Beast in non-BELA mode #3

Open tonylangley opened 4 years ago

tonylangley commented 4 years ago

Hi,

I'm trying to interface a 10K potentiometer via a MCP3008 ADC over SPI to the Beaglebone Black running the ctag_bone_debian_v0.1.2.img release.

Will this be possible or should I interface the potentiometer a different way?

Thanks in advance, Tony

ctag-fh-kiel commented 4 years ago

Hi Tony, You should be able to use SPI with the standard (non-bela) image. The audio codec uses bit-banged SPI through GPIO freeing up the HW SPI peripheral. If you are on the bela image SPI is blocked by bela for ADC/DAC.

Best, Robert

tonylangley commented 4 years ago

Thanks Robert. That’s good to know the SPI bus is free in this mode.

Any chance you could point me to any info on how to enable the SPI on this ctag_bone_debian_v0.12 release? I tried a few ways of doing this by updating the /boot/uEnv.txt file but couldn’t work it out!

Thanks, Tony

tonylangley commented 4 years ago

I was able to get SPI running with the following:

sudo sh -c "echo 'BB-SPIDEV0' > /sys/devices/platform/bone_capemgr/slots"

tonylangley commented 4 years ago

So I'm able to get SPI running temporarily using the command above, but when I add this line to /boot/uEnv.txt

uboot_overlay_addr4=/lib/firmware/BB-SPIDEV0-00A0.dtbo

...I'm unable to get the SPIDEV0 device to load at boot without commenting out the following line above:

dtb=am335x-boneblack-ctag-face.dtb

This line is creating a device-tree-override which seems to prevent any subsequent uboot_overlay_options to take effect.

Once I comment this out, I can verify the SPI devices as follows:

ls -al /dev/spi*

As I want to use both the CTAG Beast and SPI, do you have any suggestions on how can I enable this at boot time?

henrix commented 4 years ago

Hi,

A workaround for this would be to automatically execute the bone cape manager script

sh -c "echo 'BB-SPIDEV0' > /sys/devices/platform/bone_capemgr/slots"

via rc.local.

You can find some information about rc.local here.

Another solution would be to enable SPIDEV in the base device tree am335x-boneblack-ctag-face.dtb. However, this would require to create a different base device trees for each required hardware configuration.