GLK TTL Cannot change baud rate

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

GLK TTL Cannot change baud rate

Post 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.
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Try 254 / 57 / 16 instead of 240 / 57 / 16.
Raquel Malinis
Design and Development
Matrix Orbital
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

Post 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 );
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Good. After sending the command, make sure that you re-initialize your port to 115200 because the change takes effect immediately.
Raquel Malinis
Design and Development
Matrix Orbital
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

Post 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
}
}
}
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post 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.
Raquel Malinis
Design and Development
Matrix Orbital
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

Post by vedavis »

> ...send data to display on the screen...

I got garbage [>BB@]. Do I need flow control?
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post 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.
Raquel Malinis
Design and Development
Matrix Orbital
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

Post 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(;;){}
}
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
vedavis
LCD Geek
Posts: 21
Joined: Wed Jul 02, 2008 5:24 am

Post 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.
---------------
Vernon Davis
Thwing-Albert Instrument Company
vdavis@thwingalbert.com
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Neat. Glad to hear you have figured things out.
Raquel Malinis
Design and Development
Matrix Orbital
Post Reply