From: mgodinho <me....@gm...> - 2009-03-23 04:55:57
|
List, I am using a slightly modified sertest and LED-Flasher routines, where I take in a serial data stream into robostix's UART1 , and then get it to display on my PC screen when I ssh into the gumstix. The problem is that the data doesn't display properly. When I plugged the device straight into into my PC, the first chunk of data is: fa ff 3e 00 c3 fa ff 0d 76 00 50 10 02 04 80 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 50 10 02 00 0e 00 04 00 00 00 05 00 00 00 00 00 00 00 00 0e However, the gumstix/robostix sees it at: 00 81 b0 79 81 79 a2 5f df fb f7 ff ff ff df ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff fd ff 5f df fb ff e3 ff f7 ff ff ff f5 ff ff ff ff ff ff ff ff e3 This is the modified LED-Flasher file: #include <avr/io.h> #include <stdio.h> #include "a2d.h" #include "Hardware.h" #include "Timer.h" #include "UART.h" int main(void) { FILE *u0; FILE *u1; InitHardware(); // The first handle opened for read goes to stdin, and the first handle // opened for write goes to stdout. So u0 is stdin, stdout, and stderr u0 = fdevopen( UART0_PutCharStdio, NULL ); u1 = fdevopen( NULL, UART1_GetCharStdio); while( 1 ) { if ( UART1_IsCharAvailable() ) { char ch = getchar(); printf( "%c", ch ); } } return 0; } The reader portion of sertest was modified as such: /***************************************************************************/ /** * Thread which processes the incoming serial data. */ void *ReaderThread( void *param ) { while ( 1 ) { char ch; int bytesRead; if (( bytesRead = read( gPortFd, &ch, 1 )) < 0 ) { fprintf( stderr, "Serial port read failed: %s\n", strerror( errno )); exit( 1 ); } /* if ( gDebug ) { if (( ch < ' ' ) || ( ch > '~' )) { fprintf( stderr, "Serial Read: 0x%02x '.'\n", ch ); } else { fprintf( stderr, "Serial Read: 0x%02x '%c'\n", ch, ch ); } } */ // putc( ch, stdout ); printf("%02x ", ch); } return 0; } // ReaderThread I've double checked all my settings such as baud rate, parity, stop bits and data length bits. Any help is appreciated. -- View this message in context: http://www.nabble.com/Serial-data-stream-into-Robostix-tp22654339p22654339.html Sent from the Gumstix mailing list archive at Nabble.com. |