SPI Bus

Discussion in 'UDOO NEO' started by Juan Sebastian Guerrero, Mar 12, 2016.

  1. Juan Sebastian Guerrero

    Juan Sebastian Guerrero UDOOer

    Joined:
    Dec 24, 2015
    Messages:
    9
    Likes Received:
    3
    Hi.
    I'm trying to use SPI Bus between A9(Master) and M4(Slave) cores but I don't know if for use the SPI Bus is necessary loading the module and compile the kernel?
    If is not necessary, please, can you tell me how to use the SPI bus?

    I read
    but I don't understand how to is the implementation of communication.
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Why do you want to use the SPI bus while there is already a fully functional serial bus between the two cores? http://www.udoo.org/docs-neo/Arduino_M4_Processor/Communication.html

    The only downside of this bus is that from straight Linux (bash_ minicom) things don't work so well yet. But access from Python, php and Java works fine. Also the Arduino IDE serial monitor works fine.
    Check out this tutorial http://www.udoo.org/tutorial/udoo-serial-libraries-examples/
    It is written to for the Udoo Quad but wth changing the port to /dev/ttyMCC it works also on a Neo
     
    Last edited: Mar 12, 2016
    modjo likes this.
  3. Juan Sebastian Guerrero

    Juan Sebastian Guerrero UDOOer

    Joined:
    Dec 24, 2015
    Messages:
    9
    Likes Received:
    3
    Hi, thank you for your reply

    I used the serial port with Python, and I can sent and receive data without problem, but when I implement a filter of ultrasonic sensors the communication fails or desynchronized then i think what the cause is the time of processing of data filter, I want to use other communication bus with A9 master for controlling a clock for send and receive data and see if works similar or what happen.
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    OK, strange. What if you connect only 1 sensor? The serial connection stays active? There is also 1 extra pitfall when using serial connection: only send data from the Arduino side when you are sure there is a listening program on the other side. After a reboot the Arduino side is much faster active than the Linux side so the Arduino side can already send a lot of data before a python program is able to read. It will overflow the serial buffer and can even stall the Neo.
    What I do is put the Arduino sketch in a wait/read state until it receives a serial command from Python, then it may send data through serial.

    If you still want to experiment with SPI than you have to enable SPI on the Linux side. It is switched off by default. With the device tree editor you can switch it on. After a reboot it is enabled.

    I really don't know if it is enabled on the Arduino side but I suppose you can use it on the pins using the correct library.
     

Share This Page