Page 1 of 2

LK-204-25 can not receive command and text

Posted: Fri Apr 06, 2007 1:34 pm
by ganou
Hi all,

I try to use DSP tms320c2812 to control LK-204-25 LCD and keypad, connecting wiht SCI. I have composed a little program, and debuged it. But the result is worst. I hope the program can first finish clear screen, and then send 80 text to show on LCD. But there is nothing change on the LCD screen. I use TI XDS510USB emulator, and windmill development board "bf3Net F2812 Networking Kit".

In order to show clear, I supply the following description:

1. On the development board and LK-204-25, the SCI connector is DB-9 female connector, so I use a cable that has tow male DB-9 male connectors, and I have swap the RX and TX line in the cable.

2. the LED lights on the development board always light during the program running.

3. the volotage is about 1 V between RX and TX, no matter the program is running or not.

4. the baud rate was set to 19200.

5. When I use uproject.exe to connect LCD, it is normal.

Please the experts give me some advices.

Thanks.

Garrison

the program as following :
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File

// Prototype statements for functions found within this file.
void scia_init(void);
void scia_xmit(int a);

// Global variables
Uint16 sdataA[80]; // Send data for SCI-A
Uint16 rdataA[8]; // Received data for SCI-A
Uint16 sdata_pointA; // Used for setting Cursor Position
Uint16 ClearScreen[2]={0x00FE, 0x0058};
Uint16 SendChar; // character being sent by SCIA


void main(void)
{
Uint16 i;
Uint32 j;
// Uint32 k;

// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();

// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio();
// Setup only the GP I/O only for SCI-A and SCI-B functionality
EALLOW;
GpioMuxRegs.GPFMUX.bit.SCITXDA_GPIOF4 = 1;
GpioMuxRegs.GPFMUX.bit.SCIRXDA_GPIOF5 = 1;
EDIS;

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;

// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();

// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;

// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();

// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
scia_init(); // Init SCI-A

// Step 5.
// Init send data. After each transmission this data
// will be updated for the next transmission

// clear screen.
SendChar = ClearScreen[0];
scia_xmit(SendChar);

while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}


for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay


SendChar = ClearScreen[1];
scia_xmit(SendChar);

while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}


//set original datas for sdataA.

for(i = 0; i<80; i++)
{
sdataA = (sdataA[i-1]+1)&0x00FF;
}

//send text to the LCD LK-204-25,
for(;;)
{
for(i = 0; i<80; i++)
{

if (SciaRegs.SCICTL2.bit.TXRDY==1)
{

SendChar = sdataA;
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
}

for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay


}

}
}

void scia_init()
{
// Reset FIFO's
SciaRegs.SCIFFTX.all=0x8000;

SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE

SciaRegs.SCICTL2.all =0x0000;

SciaRegs.SCIHBAUD = 0x0003;
SciaRegs.SCILBAUD = 0x00CF;


SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset

}

// Transmit a character from the SCI-A'
void scia_xmit(int a)
{
SciaRegs.SCITXBUF=a;
}
//===========================================================================
// No more.
//===========================================================================

Posted: Wed Apr 11, 2007 3:55 pm
by Raquel
Hello ganou,

Thanks for your post.

If I understand you right, when you connect to uProject via a PC, the display is working fine. When you connect to your microcontroller, it does not work. Is this right?

First thing that comes to mind is voltage levels. Normally, when a microcontroller is connected to our displays, TTL levels are used. Please put your LK204-25 to TTL mode (please see manual for doing this).

Best Regards,

Posted: Wed Apr 11, 2007 7:34 pm
by ganou
Hi,

Thank you for your reply.

First, you correctly understood what I described my situation.

In addition, I want to tell more:

1, I connect the LCD through a RS 232 cable with two DB-9 connectors. Because two sides are DB-9 male connectors, so I have swap the threads in the cable.

2. The DSP development board already has had a transceiver chip, and requests SCI communication through its DB-9 female connector.

Please give me more guides. Thanks,

Gansheng
Raquel wrote:Hello ganou,

Thanks for your post.

If I understand you right, when you connect to uProject via a PC, the display is working fine. When you connect to your microcontroller, it does not work. Is this right?

First thing that comes to mind is voltage levels. Normally, when a microcontroller is connected to our displays, TTL levels are used. Please put your LK204-25 to TTL mode (please see manual for doing this).

Best Regards,

Posted: Thu Apr 12, 2007 8:16 am
by Raquel
Hello ganou,

Good. Since your dev board has a transceiver, I suggest that you try out your code on uProject or hyperterminal (take out the LK204-25 aside). If you chose to use uProject, just open up the com port and in the Main tab, there is a rectangular window on the bottom right (with a Clear button under it). You should be able to see if uProject is receiving the data you are trying to send it. If the data looks good, then go back to the LK204-25 and try it out.

Thanks,

Posted: Tue Apr 17, 2007 12:55 pm
by ganou
Hi Raquel,

Thank you for your answer.

Now I can see the contect that I send on the uProject, as you said, but they still cannot show on the LCD.

I have a basic question:
From the manual, I am not sure that the consequence of the sending. For example,
If I want to send command, such as "clear screen", then I send "0x00FE, 0x0058", right?
If I want to send text, such as string"1,2,3", then I directly send"0x31, 0x32, 0x33", right?
If I receive something from key striking, I always receive two word.For example, "21,FF". Is "ff" a signal for key striking?

Thank you,

Gansheng

Raquel wrote:Hello ganou,

Good. Since your dev board has a transceiver, I suggest that you try out your code on uProject or hyperterminal (take out the LK204-25 aside). If you chose to use uProject, just open up the com port and in the Main tab, there is a rectangular window on the bottom right (with a Clear button under it). You should be able to see if uProject is receiving the data you are trying to send it. If the data looks good, then go back to the LK204-25 and try it out.

Thanks,

Posted: Tue Apr 17, 2007 3:06 pm
by Raquel
If I want to send command, such as "clear screen", then I send "0x00FE, 0x0058", right?
If I want to send text, such as string"1,2,3", then I directly send"0x31, 0x32, 0x33", right?
If I receive something from key striking, I always receive two word.For example, "21,FF". Is "ff" a signal for key striking?
First: Yes, you have the command right.. When you send this, you should see the screen cleared
Second: Yes, you have the strings right. When you send these, you should see '123'
Third: You should only be getting 1 byte values. These values typically are from 0x41 to 0x5A.

Posted: Wed Apr 25, 2007 2:32 pm
by ganou
Hi,
Now on uproject I can clearly and correctly see the number that I send from DSP. When I connect the SCI to the LCD, the LCD has nothing changed. Could you give me some suggestion to kick this problem?Thank you!

The following is my code.

#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File

// Prototype statements for functions found within this file.
void scib_init(void);
void scib_xmit(int a);

// Global variables
//Uint16 sdataA[80]; // Send data for SCI-A
Uint16 rdataA[8]; // Received data for SCI-A
Uint16 sdata_pointA; // Used for setting Cursor Position
Uint16 ClearScreen[2]={0x00FE,0x0058};
Uint16 SendChar; // character being sent by SCIA
Uint16 ReceivedKey[10]; //key strike encode from keypad

void main(void)
{
char sdataA[]={"1234567890qwertyuiopasdfghjklzxcvbnm !\n\r"};
Uint16 i;
Uint32 j;
// Uint32 k;
// k=0;

// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();

// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio();
// Setup only the GP I/O only for SCI-B functionality
EALLOW;
GpioMuxRegs.GPGMUX.bit.SCITXDB_GPIOG4 = 1;
GpioMuxRegs.GPGMUX.bit.SCIRXDB_GPIOG5 = 1;
EDIS;

// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;

// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();

// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;

// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();

// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
scib_init(); // Init SCI-B

// Step 5.
// Init send data. After each transmission this data
// will be updated for the next transmission

// first clear screen.
ScibRegs.SCICTL1.bit.TXWAKE=1;
SendChar=0;
ScibRegs.SCITXBUF= SendChar;
while (ScibRegs.SCICTL2.bit.TXRDY==0);

SendChar = ClearScreen[0];
ScibRegs.SCITXBUF= SendChar;

while (ScibRegs.SCICTL2.bit.TXRDY==0);

SendChar = ClearScreen[1];
ScibRegs.SCITXBUF= SendChar;

for(j = 1; j<= 0x0000FFFF; j++)
{
asm(" NOP");
} // delay

//finally, send data and waiting to receive key strike.

for(;;)
{
ScibRegs.SCICTL1.bit.TXWAKE=1;
SendChar=0;
ScibRegs.SCITXBUF= SendChar;
for(i = 0; i<41; i++)
{

SendChar = sdataA;
ScibRegs.SCITXBUF= SendChar;
while (ScibRegs.SCICTL2.bit.TXRDY==0);

}

for(j = 1; j<= 0x0FFFFFFF; j++)
{
asm(" NOP");
} // delay
}
}

void scib_init()
{
// Reset FIFO's
ScibRegs.SCIFFTX.all=0x8000;

ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE

ScibRegs.SCICTL2.all =0x0000;
// SciaRegs.SCICTL2.bit.TXINTENA =0;
// SciaRegs.SCICTL2.bit.RXBKINTENA =0;
ScibRegs.SCIHBAUD = 0x0000;
ScibRegs.SCILBAUD = 0x00F4;
// SciaRegs.SCICCR.bit.LOOPBKENA =1; // Enable loop back
// SciaRegs.SCIFFTX.all=0xC028;
// SciaRegs.SCIFFRX.all=0x0028;
// SciaRegs.SCIFFCT.all=0x00;

ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
// SciaRegs.SCIFFTX.bit.TXFIFOXRESET=1;
// SciaRegs.SCIFFRX.bit.RXFIFORESET=1;

}

// Transmit a character from the SCI-A'
//void scib_xmit(int a)
//{
// ScibRegs.SCITXBUF= a;
//}
//===========================================================================
// No more.
//===========================================================================

Posted: Wed Apr 25, 2007 2:49 pm
by Raquel
Hello ganou,
Now on uproject I can clearly and correctly see the number that I send from DSP. When I connect the SCI to the LCD, the LCD has nothing changed.
When you send say the letter 'A' from the DSP, and check this out in uProject, do you see 0x41? Or, if you check this out with Hyperterminal, do you see 'A' ?

When you send 0xFE 0x58, do you see this on uProject? You might just see a symbol and 'X' if you check this out in Hyperterminal.

If you please simplify the code for now and go back to the simple test. If you see the DSP sending text and commands properly on uProject AND you know that the display works fine with uProject, then you can start putting the DSP and the display together.
5. When I use uproject.exe to connect LCD, it is normal.

Posted: Wed Apr 25, 2007 3:12 pm
by ganou
Hello,

When you send say the letter 'A' from the DSP, and check this out in uProject, do you see 0x41? Or, if you check this out with Hyperterminal, do you see 'A' ?

Yes, the same as you say.


When you send 0xFE 0x58, do you see this on uProject? You might just see a symbol and 'X' if you check this out in Hyperterminal.

Yes.

If you please simplify the code for now and go back to the simple test. If you see the DSP sending text and commands properly on uProject AND you know that the display works fine with uProject, then you can start putting the DSP and the display together.

The problem now I meet is the DSP sending text and commands properly on uproject and Hyperterminal, but when I connect DSP with LCD, there is nothing shown on the LCD.

Could you give me some suggestion on this question?Thanks,

Best,
Gansheng[/b]

Posted: Wed Apr 25, 2007 4:06 pm
by Raquel
Hello,

Ok, sounds good. Now I need you to please make sure that you connect the DSP's RX line to the display's TX line; and the DSP's TX line to the display's RX line.

Thanks,

Posted: Thu Apr 26, 2007 1:22 pm
by ganou
Thank you for your help.

But I am frustrating. Although I send text and command so beartifully from DSP to uproject or hyperterminal, I can not see any change on the LCD. Do you think this problem relate to the voltage level of the transceiver on my DSP board? Because my board is 3.3 V voltage system.How can I check this problem? Thanks,

Gansheng

Raquel wrote:Hello,

Ok, sounds good. Now I need you to please make sure that you connect the DSP's RX line to the display's TX line; and the DSP's TX line to the display's RX line.

Thanks,

Posted: Thu Apr 26, 2007 3:10 pm
by Raquel
Hi Gansheng,
The DSP development board already has had a transceiver chip, and requests SCI communication through its DB-9 female connector.
The DSP running at 3.3V won't matter if it indeed has a RS232 transceiver. Not quite sure of SCI communication, but then if you were able to communicate with uProject and hyperterminal, you should be able to communicate with the display. Please double check all your connections.

Thanks,

Posted: Thu Apr 26, 2007 4:39 pm
by Devid
Hi Ganou,

As Raquel said, I don't think that 3.3V is creating any problem.

If you are able to communicate with uProject(PC), u should be able to do with LCD.

As long as output voltage of your max232 is satisfying RS232 standard u r OK.
voltage should be between
+3 to +12 for logic 0
-3 to -12 for logic 1
I think there is some problem in ur connection or ur intialization.

Please read data sheet properly. :D

Posted: Mon Apr 30, 2007 9:26 am
by ganou
Hello Devid,

Thank you for your answer.

I have check the connecteion for many times and try to use different methods, but I did not find any problem in connection. could you tell me more detail about intialization that you mentioned.

Thank you very much!

Gansheng
Devid wrote:Hi Ganou,


I think there is some problem in ur connection or ur intialization.

Please read data sheet properly. :D

Posted: Mon Apr 30, 2007 10:12 am
by ganou
Hi,

Moveover, I let DSP continue to send data through SCI port , and I use oscilloscope to check the RX and TX, then it can clearly show the wave signal. But if I connect to LCD, I still have not any new information on LCD. If someone supect the cable and connector, I have just used them to connect to PC and worked good.

In addition, in this time if I turn off the power of LCD, then the screen of LCD will flash, only spot or block, no information.

It is weird. Could anyone lend your hands?
Thanks,
Gansheng