From: Nadir B. <na...@sc...> - 2005-12-18 17:49:20
|
Dave, please help, I am very frustrated. My configuration: connex/robostix with UART0 connected to PXA ST and "gumstix" connected to laptop through TTL-to-RS232 I am connecting GPS to robostix UART1. I cannot figure out the C code on Robostix to "retransmit" strings from GPS on UART1 to UART0, so gumstix board can read it. Thanks for your time. Sincerely, Nadir. --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/ |
From: Dave H. <dhy...@gm...> - 2005-12-18 19:07:57
|
Hi Nadir, > My configuration: connex/robostix with UART0 connected to PXA ST and > "gumstix" connected to laptop through TTL-to-RS232 > > I am connecting GPS to robostix UART1. > > I cannot figure out the C code on Robostix to "retransmit" strings from G= PS > on UART1 to UART0, so gumstix board can read it. So you've got jumpers to connect UART0 to PXA-ST right? Just checking, casue nothing will work without them. You can use sertest to check if anything is coming in over the STUART port. Are you using your own code? or trying to use the UART sample code that's provided? If you have a main loop, like the one in Flash-LED.c then you'll need to make a few changes. The function WaitForTimer0Overflow only returns once every 10 msec and you'll need to poll for serial data more frequently than that. With the sample code, you would basically just do something like this: if ( UART1_CharIsAvailable() ) { char ch =3D UART1_GetChar(); UART0_PutChar( ch ); } If you're using WaitForTime0Overflow, then you need to code it this way ins= tead: uint16_t prevCount =3D gTickCount; while ( gTickCount =3D=3D prevCount ) { if ( UART1_CharIsAvailable() ) { char ch =3D UART1_GetChar(); UART0_PutChar( ch ); } } The sample UART code is interrupt driven and uses a circular buffer (whose size can be configured using Config.h) If you want to do it by accessing the registers directly, then do something like: // Check to see if a character is available if ( ( UCSR1A & ( 1 << RXC )) !=3D 0 ) { uint8_t ch =3D UDR1; // Wait for empty transmit buffer while (( UCSR0A & ( 1 << UDRE )) =3D=3D 0 ) { ; } // Send the character UDR =3D ch; } With the polled approach you run the risk of losing characters if you don't poll frequently enough. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |