I found my Raspberry Pi board, burned a SD card with the latest Raspbian (2013-05-25). I am able to reproduce the problem.
Here's the code I'm running on the Pi:
Code:
// compile with: gcc -O2 -Wall -o serialdump serialdump.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define PORT "/dev/ttyACM0"
int main()
{
int r, port;
fd_set rfds;
struct timeval tv;
char c;
port = open(PORT, O_RDWR);
if (port < 0) {
printf("unable to open %s\n", PORT);
return -1;
}
while (1) {
FD_ZERO(&rfds);
FD_SET(port, &rfds);
tv.tv_sec = 5;
tv.tv_usec = 0;
r = select(port+1, &rfds, NULL, NULL, &tv);
if (r < 0) {
printf("select error\n");
} else if (r == 0) {
printf("no data timeout\n");
} else if (FD_ISSET(port, &rfds)) {
r = read(port, &c, 1);
if (r == 1) {
printf("%c", c);
} else {
printf("read error\n");
}
} else {
printf("select says data ready, but where?\n");
}
}
close(port);
return 0;
}
Here's the code I'm running on the Teensy 3.0:
Code:
int led = 13;
int count = 0;
void setup() {
Serial.begin(115200);
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
Serial.print("blink # ");
Serial.println(count++);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
}
Later today I'll get the USB protocol analyzer hooked up and look into what's actually happening....