About the ChibiOS port...Have you had any trouble with the serial port behavior using arduino HardwareSerial? It seems Fat16Lib has been using them successfully in the demos. However, I have issues when using them in my own code. Here is an example on Mega1280:
#include <ChibiOS.h>
#include <util/atomic.h>
static WORKING_AREA(waSerialHandler,256);
static msg_t SerialHandler(void *arg)
{
Serial.begin(9600);
String inputStr = "";
inputStr.reserve(200);
volatile uint8_t count = 0;
char inChar = 0;
while (true)
{
if (!Serial.available()) chThdYeild();
else
{
do
{
inChar = (char)Serial.read();
if(inChar=='c')
{
Serial.println("Count: "+count);
Serial.println("Output string: " + inputStr);
}
inputStr.concat((String)inChar);
count++;
}while (Serial.available());
}
if (count >= 10)
{
Serial.println(inputStr);
Serial.flush();
count=0;
inputStr = "";
}
// chThdSleep(1);
}
}
void setup() {
// put your setup code here, to run once:
cli();
halInit();
chSysInit();
Serial3.begin(9600);
chThdCreateStatic(waSerialHandler,sizeof(waSerialHandler),NORMALPRIO +100, SerialHandler, NULL);
}
void loop() {
// put your main code here, to run repeatedly:
chThdSleep(10);
}
This code doesn't do anything other than wait for 10 characters to arrive on the serial port, then print them. My intention is to use a thread to parse data coming in on one, check for conditions, the use another thread to drive another port to send modified data. Trouble is, if I type a string like "1234567890-" into the terminal, I usually only get two characters printed.
Is this a problem in the port? Should I be modifying the chibiOS uart drivers to support Uart2 and Uart3(only 0 and 1 are currently included in the driver file)?