User Tools

Site Tools


Sidebar

Launch of Linino.org

wiki:lininoonearduinoide

Linino ONE board can be programmed trough the Arduino IDE.

One of the main development area on Linino Boards was the communication between MCU and MPU trough SPI.

The actual MCU present on Linino ONE board is the Atmel 32u4, that is connected to the MPU (AR9331) trough SPI and UART peripherals.

On Linino it is possible to use the SPI to communicate between MCU and MPU using, on linux side, the SPI as an usual tty, called ttySPI0, and from MCU perspective as a Stream class, called StreamSPI0.

This is described in details here.

If for example you need to use the MCU UART to connect to anothe device, you can export the linux console trough the spi using the following sketch:

/*
  Linino ONE SPI-to-Serial
 
 Allows you to use the Yun's 32U4 processor as a
 serial terminal for the linino processor through SPI interface
 
 Upload this to an Linino ONE then open the serial monitor at 115200 
 to see the boot process of the linino processor. You can also use the serial monitor
 as a basic command line interface for the linino processor using
 this sketch.
 
  The circuit:
 * Linino ONE
 
 created March 2014
 by mimmoLinino
 
 */
 
#include <StreamSPI.h>
 
long lininoBaud = 115200;
 
void setup() {
  Serial.begin(115200);      // open serial connection via USB-Serial
  StreamSPI0.begin(); // open serial connection to Linino
}
 
void readCharFrom(Stream &in, Stream &out, bool echo)
{
  char c = (char)in.read();     // read from USB-serial
  out.write(c);             //    otherwise write char to Linino
  if (echo) in.write(c);                  // write to USB-serial
  if (c == '\r') {
    out.write('\n'); // add the newline char when carriage return char is received
    if (echo) in.write('\n');  // add the newline char when carriage return char is received
  }
}
 
void loop() {
  // copy from virtual serial line to uart and vice versa
  if (Serial.available()) {           // got anything from USB-Serial?
    readCharFrom(Serial, StreamSPI0, true);
  }
  if (StreamSPI0.available()) {          // got anything from Linino?
    readCharFrom(StreamSPI0, Serial, true);
   }
}

How to use Arduino IDE

It is possible to find the patch applied to the current Arduino IDE version 1.5.6 to the linino fork and build it for your platform as described here.

It is possible to download the binary files:

Upload the first sketch on Linino ONE

Once installed the Arduino IDE, launch it and select the Linino ONE as board:

It is possible to select also the port to connect the board.

There are two options:

  • serial interface
  • network interface

now you can upload the sketch on the Linino ONE board.

If you use the network interface, the linino password will be requested. Please enter the password doghunter and continue to the sketch upload.

Once the done with the upload the red led on the Linino ONE will blink.

/var/www/wiki.linino.org/data/pages/wiki/lininoonearduinoide.txt · Last modified: 2014/06/02 17:18 by administrator

2014 © dog hunter llc and the Linino Community. Linino.org is a dog hunter sponsored community project. Credits