Arduino IDE

Description

(Taken from http://arduino.cc/en/Guide/Environment , more to read there!)

"The Arduino development environment contains a text editor for writing code, a message area, a text console, a toolbar with buttons for common functions, and a series of menus. It connects to the Arduino hardware to upload programs and communicate with them.

Software written using Arduino are called sketches. These sketches are written in the text editor. Sketches are saved with the file extension .ino. It has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino environment including complete error messages and other information. The bottom righthand corner of the window displays the current board and serial port. The toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and open the serial monitor."

Resources

The Arduino IDE can be downloaded here: http://arduino.cc/en/Main/Software

Patch (Only for BRIX2, not necessary for BRIX2 Evaluation Platform)

In order to program the BRIX2 System Controller via the Serial_Traverse sketch, you will need to patch a file (as of Arduino 1.0.4). You can follow the instructions on http://petervanhoyweghen.wordpress.com/2012/11/08/using-the-leonardo-as-usb-to-serial-converter/ or this local copy:

Locate the CDC.cpp file (arduino-1.0.n/hardware/arduino/cores/arduino) and add the lines printed in bold (a patch-file is attached to this page):

void WEAK lineCodingEvent(long baud, byte databits, byte parity, byte charFormat)
{
}

void WEAK lineStateEvent(byte linestate)
{
}

bool WEAK CDC_Setup(Setup& setup)
{

u8 r = setup.bRequest;
u8 requestType = setup.bmRequestType;

if (REQUEST_DEVICETOHOST_CLASS_INTERFACE requestType)
{

if (CDC_GET_LINE_CODING r)
{

USB_SendControl(0,(void*)&_usbLineInfo,7);
return true;

}

}

if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE requestType)
{

if (CDC_SET_LINE_CODING r)
{

USB_RecvControl((void*)&_usbLineInfo,7);
lineCodingEvent(_usbLineInfo.dwDTERate,
_usbLineInfo.bDataBits,
_usbLineInfo.bParityType,
_usbLineInfo.bCharFormat);
return true;

}

if (CDC_SET_CONTROL_LINE_STATE == r)
{

_usbLineInfo.lineState = setup.wValueL;

lineStateEvent(_usbLineInfo.lineState);

// auto-reset into the bootloader is triggered when the port, already
// open at 1200 bps, is closed. this is the signal to start the watchdog
// with a relatively long period so it can finish housekeeping tasks
// like servicing endpoints before the sketch ends
if (1200 _usbLineInfo.dwDTERate) {

// We check DTR state to determine if host port is open (bit 0 of lineState).
if ((_usbLineInfo.lineState & 0x01) 0) {

*(uint16_t *)0x0800 = 0x7777;
wdt_enable(WDTO_120MS);

} else {

// Most OSs do some intermediate steps when configuring ports and DTR can
// twiggle more than once before stabilizing.
// To avoid spurious resets we set the watchdog to 250ms and eventually
...

Tips

So you checked out the entire BRIX svn into a single folder and you hate the Arduino IDE filechooser? You want to have the sketches from the repository inside your sketchbook. Fear not, a softlink will do! Example:

ln -s ~/Brix_Redmine/brix/Firmware/Arduino/MPU9150_Readout/ ~/arduino_sketchbook/

Known Problems (1.0.2)

  • The IDE tends to crash for no reason
  • If no /dev/ttyACMn can be found, maybe your udev crashed. Check with dmesg if the device is listed when connection is established. If not restart udev. To do so, you have to reboot if not root.