Wrtiting and SPI Program for Upboard

AdamB New Member Posts: 1

Hi, I am new to the Upboard environment. I have never used a device like this before; my experience is limited to Arduino. I can’t seem to find any examples online on how to use it.

My plan is to use the SPI pins on the board to send data to a DAC, and use additional pins to control Chip Select and LDAC, which is easy enough after looking through documentation.

But for directly using the SPI pins, I am using RPi.GPIO, and I’m not sure if it has direct support to perform an SPI transfer. If there is a better library for this, I would like to know. So, after all that, my question is: How do you write a program to use SPI on the Upboard in Python?

As a secondary question, Python presumably has ways to read in a .csv file from a USB through a library, yes?



  • camillus
    camillus Administrator, Moderator, AAEON Posts: 188 admin
    edited November 2021

    Hi @AdamB,

    We have a Wiki, you can find it here.

    Here is a Quick start guide

    • Depending on your ubuntu version, Follow the guide to install and add the UP Repository on your Ubuntu version. For this guide, lets assume Ubuntu 20.04 and UP Squared device
    • On Ubuntu 20.04 you can follow this guide here
    • Follow the guide to install upboard-extras package and enable HAT functionality from userspace
    • Add Groups and User to groups guide here
    • Next, you can go on the UP Squared pinout page to identify the 40 Pin HAT and in your case the SPI pins
    • Follow the guide to identify SPI device nodes for UP Squared
    • Install ACPI overrides to enable SPI in user space and download the Zip file
    • After that you should be able to see the spi devices ls /dev/spi*

    You will not be able to use the Rpi.GPIO on the Up devices, I will suggest libraries like spidev and libmraa

    You can find some more info about libmraa on the wiki

  • camillus
    camillus Administrator, Moderator, AAEON Posts: 188 admin

    Hi @AdamB,

    We have provided a SPI tutorial that gets reading from an LDR connected to an ADC chip (MCP3004) connected to an UP Xtreme device using spidev library in python3. You can have a look at it.


    Best regards,

Privacy Policy