View Single Post
  #1   Spotlight this post!  
Unread 08-02-2012, 14:11
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Usage of serial port on cRio

We're having a lot of difficulty using the serial port on the cRio to interface with devices.
  • Console out switch is off.
  • Tried with an RS232 compass sensor
  • Tried with an Arduino spitting out a single byte in a loop
  • Confirmed correct serial data on both devices with a logic analyzer and Portmon

When running some very simple code (I sure hope I'm just doing something wrong) - the cRio will read some data (slowly) and then crash.

Code:
virtual void TeleopPeriodic() {
  int n = com.GetBytesReceived();
  if (n > 0) {
      char *buffer;
      printf("Reading\n");
      com.Read(buffer, n);
      printf("Done reading\n");

      for (int i = 0; i < n; i++) {
          printf("%d 0x%X\n", n, buffer[i]);
      }
}
Screenshot attached.
Attached Thumbnails
Click image for larger version

Name:	machine_check_error.png
Views:	28
Size:	55.1 KB
ID:	11800  
Reply With Quote