Page 1 of 1
GLK TTL Cannot change baud rate
Posted: Tue Mar 03, 2009 11:13 am
by vedavis
GLK24064 rev 2.0 board re-wired for TTL. Writing and Reading Customer Data ('254 / 52 / data' and '254 / 53') at the default 19,200 is no problem. I then send Change Baud Rate Command '240 / 57 / 16' to change to 115,200, send the same Customer Data commands, but I get no communication back from the display (I see no activity on an oscilloscope monitoring the display's transmit line). Change Baud Rate command does not work for any baud rate except 19,200. It's as though the command is not working at all.
Posted: Tue Mar 03, 2009 11:58 am
by Raquel
Try 254 / 57 / 16 instead of 240 / 57 / 16.
Posted: Tue Mar 03, 2009 12:05 pm
by vedavis
> Try 254 / 57 / 16 instead of 240 / 57 / 16.
Typo: here's the actual code:
s[ 0 ] = 254;
s[ 1 ] = 57;
s[ 2 ] = 16;
send_Display_Direct( s, 3 );
Posted: Tue Mar 03, 2009 12:17 pm
by Raquel
Good. After sending the command, make sure that you re-initialize your port to 115200 because the change takes effect immediately.
Posted: Tue Mar 03, 2009 12:32 pm
by vedavis
> ...make sure that you re-initialize your port to 115200...
If I get your drift, the processor should change baud rate after sending the command.
Here is the actual code, starting at 19,200.
----------------------------------------------
send_Company_Info(); // sends 254 / 52 / "THWING-ALBERT CO"
// I see data on the oscilliscope, so I know it's going out
if( compare_Company_Info() ) // sends 254 / 53, sees same characters back
{
// switch display to 115,200
s[ 0 ] = 254;
s[ 1 ] = 57;
s[ 2 ] = 16;
send_Display_Direct( s, 3 );
// switch microcontroller to 115,200
if( SerialSetRate( SER_C, BR_115200 ) )
{
send_Company_Info(); // sends 254 / 52 / "THWING-ALBERT CO"
// I see data on the oscilliscope, so I know it's going out
if( !compare_Company_Info() ) // sends 254 / 53, expects same characters back
{
retval = 2; // nothing comes back; returns error
}
}
}
Posted: Tue Mar 03, 2009 12:50 pm
by Raquel
Hi,
If you break the code temporarily to check if the display has changed to 115200 baud; ie. instead of sending command 254 / 52 / 16 bytes, send data to display on the screen, like "THWING-ALBERT CO" and see if you get it displayed on the screen.
Posted: Tue Mar 03, 2009 1:03 pm
by vedavis
> ...send data to display on the screen...
I got garbage [>BB@]. Do I need flow control?
Posted: Tue Mar 03, 2009 2:05 pm
by Raquel
Try installing manual override and then try the code again.
Maybe, for some reason there is a lock on the baud rate. Please see sections 2.2 and 12.3 of the
manual.
Posted: Wed Mar 04, 2009 12:08 pm
by vedavis
I reset the Data Locks. No luck. To insure the Rabbit RCM3200 microcontroller was changing speed, I measured one data bit; it was approx. 8.6 microseconds, which is the 115.2K bit width. Here's the code I used. It prints company info for the 19,200, but not at 115,200.
(BTW, I have seen this work using Mogd Sharp and RS-232. I then removed the three zero-ohm resistors on the 232 pads and added two jumpers to the TTL pads.)
EDIT: I have used I2C as well without issues.
EDIT: I have tried a new GLK24064; same thing.
----------------------------------
Code: Select all
static char inBuffer[ 256 ];
static char outBuffer[ 256 ];
void read_Company_Info( void ) {
char s[ 24 ];
int i = 0;
char isDone = 0;
SerialPutcC( 254 );
SerialPutcC( 53 );
delay( 2 );
while( !isDone ) {
if( SerialRecvCountC() ) {
s[ i ] = SerialGetcC();
i++;
delay( 2 );
}
else
isDone = 1;
}
if( i == 16 ) {
printf( "%s\r\n", s );
}
}
void main( void ) {
SerialInitC( BR_19200, // Port and rate
SER_8BITS, SER_IP2, // 8 bits, IP 2
inBuffer, sizeof inBuffer, // Input buffer and size
outBuffer, sizeof outBuffer ); // Output buffer and size
// Uncomment the lines below to remove data locks
// SerialPutcC( 254 );
// SerialPutcC( 203 );
// SerialPutcC( 245 );
// SerialPutcC( 160 );
// SerialPutcC( 0 );
read_Company_Info();
// switch to 115200 baud on the display
SerialPutcC( 254 );
SerialPutcC( 57 );
SerialPutcC( 16 );
SerialSetRate( SER_C, BR_115200 );
read_Company_Info();
for(;;){}
}
Posted: Wed Mar 04, 2009 1:43 pm
by vedavis
Found the issue, Raquel!
The Change Baud Rate command needs a delay after the command is sent. I tried one second and the code now talks to the display. I can you provide a delay value once I test several permutations.
Vernon.
Posted: Wed Mar 04, 2009 3:56 pm
by Raquel
Neat. Glad to hear you have figured things out.