Do not know how to access SPI bus from NX chip and ubuntu

Discussion in 'UDOO NEO' started by Dr Bradley W Smith, Aug 31, 2020.

  1. Dr Bradley W Smith

    Dr Bradley W Smith UDOOer

    Joined:
    Aug 25, 2020
    Messages:
    1
    Likes Received:
    0
    Greetings:

    I am new to the environment. So, please don't hate me if this is a really stupid question.

    Does anyone have documentation on how to talk to a device on the SPI bus from the Ubuntu?

    I have done the initial setup, disabled M4 code (with udoom4ctl disable)
    I have mapped the pins to 28, 39, 20, and 21 with the Device tree editor4

    I can read the ADC fine.

    I tried some posted code that includes <SPI.h>, but it does not compile on Ubuntu,as SPI.h doesn't exist (probably for the arduino). I have searched all the ubuntu include files and all I can find is a .../devspi.h

    Can anyone point me to documentation, or a working example of how to send stuff to the SPI directly from Ubuntu in C? Are there library functions?

    One last question, is trying to talk with the SPI bus directly from Ubuntu an unwise idea in the first place?

    Again my apologies here for what is probably a trivial question for the well versed ...

    My Sincere Thanks
    Bradley
     
  2. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    158
    Likes Received:
    17
    Hi Bradley,
    sorry for the late reply.
    I used SPI with Udoobuntu some years ago for getting camera data so it works :) I guess there's a typo where you said '28': it should be 38 for SPI_CLOCK.
    SPI.h seems to be an Arduino library, so if you're going to interface SPI on Linux-side, you have to edit that code using similar Linux libraries. Check how Raspberry gets it: https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md

    Otherwise I suggest you to look for some python libraries to interact with SPI as spidev
     

Share This Page