uLCD-144 4D problem with Duemilanove

Hi,
I have a uLCD-144 from 4D. It works without problems with an arduino Mega2560, but it fails with Duemilanove.
It is very simple to manage: it uses serial communication to send some specific command. For instance, to inizialize it you have to send 0x55 and it should respond with 0x06 (ACK).
I wrote a simple sketch that send 0x55 and wait for something from serial and in the mega2560 it works, but in duemilanove doesn't.
I can't understand why...

Thank you!

Andrea

Code...

Kari

Sorry :slight_smile:

void setup()
{
   Serial.begin(9600); 
   delay(1000);
   
   Serial.write(0x55);
   while(!Serial.available());
   Serial.print(Serial.read(), HEX);
}

void loop()
{
}

Then it must be physical coneection problem, or broken device.

Kari

I agree...
but the same display works with the same code in the mega2560. And I tried it with two duemilanove and it doesn't work...

Thank you

Andrea

I was talking about the Duemilanove...
:wink:

It's time to check your circuit, could you show us how it is put together?

Cheers,
Kari

That's how I connect the display:

Display Arduino
5 (RES) RESET
6 (GND) GND
7 (RX) TX
8 (TX) RX
9 (VIN) +5

Thank you

What comes to my mind is that your TX and RX are swapped, could it be?

Kari

Do you have the USB plugged in at the same time? Try disconnecting it.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

What comes to my mind is that your TX and RX are swapped, could it be?

Yes, it is right, because the display tx and rx are from "the display point of view"...

Do you have the USB plugged in at the same time? Try disconnecting it.

I tried but nothing change...
It is unbelievable!
Same code, same wiring! I just move wires from the mega to the duemilanove!

Thank guys for your time!

a.periz:
Sorry :slight_smile:

void setup()

{
  Serial.begin(9600);
  delay(1000);
 
  Serial.write(0x55);
  while(!Serial.available());
  Serial.print(Serial.read(), HEX);
}

void loop()
{
}

Now I must ask, what this does, and is this really everything?

Kari

In this pdf:
http://www.4dsystems.com.au/downloads/Serial-Display-Modules/uLCD-144(SGC)/Docs/uLCD-144-SGC-DS-rev1.pdf
at page 10 they said to wait up to 500ms from reset to send the autobaud command (0x55) so I wait 1s. The display waits until 5s for this command.
Then the display should answer with the ACK (0x06), so I wait for that.

Thank you

a.periz:
That's how I connect the display:

Display Arduino
5 (RES) RESET
6 (GND) GND
7 (RX) TX
8 (TX) RX
9 (VIN) +5

Thank you

What pin numbers actually, in both cards, mega and duemilanove?

Kari

Pin numbers are the same in both cards:
0 for RX
1 for TX

I can't really understand...

Thanks kari!

Which of the four USARTS in the Mega2560 are you using to communicate with your uLCD-144? Is it the same one that is used by the bootloader to download your sketches? In the Duemilanove there is only one USART which is used for both purposes, and therein may lie the reason for the differences in operation.

Don

floresta:
Which of the four USARTS in the Mega2560 are you using to communicate with your uLCD-144? Is it the same one that is used by the bootloader to download your sketches? In the Duemilanove there is only one USART which is used for both purposes, and therein may lie the reason for the differences in operation.

Don

If the pins are the same, then it is the same USART, is it?

What is not clear, is that are you monitoring this information on the IDE's serial monitor? Or how do you tell that serial port is receiving that data?

I mean, you cannot use this only serial port for LCD and monitoring at the same time, are you sure you use the same code? Something is missing here...

Cheers,
Kari

Yes, the USART is the same.
Yes, I am using the IDE's serial monitor to look for the answer...

I have just tried to remove the atmega328p from the duemilanove and build an easy circuit on a breadboard with this code:

void setup()
{
   pinMode(13, OUTPUT);
      digitalWrite(13, HIGH);  
  delay(300);     
  digitalWrite(13, LOW);  
  delay(300);  
  
    Serial.begin(9600);
    delay(500);
    Serial.write(0x55);
    while(!Serial.available());
    

}

void loop()
{
    digitalWrite(13, HIGH); 
  delay(1000);             
  digitalWrite(13, LOW);
  delay(1000);           
}

so if it works the led connected to pin 13 should blink...but nothing...

a.periz:
In this pdf:
http://www.4dsystems.com.au/downloads/Serial-Display-Modules/uLCD-144(SGC)/Docs/uLCD-144-SGC-DS-rev1.pdf
at page 10 they said to wait up to 500ms from reset to send the autobaud command (0x55) so I wait 1s. The display waits until 5s for this command.
Then the display should answer with the ACK (0x06), so I wait for that.

Thank you

Did you read the material that follows the information that you have mentioned? It gives a possible reason for the auto-baud routine to fail and it tells how the display will react if the routine fails. How does your display react?

Don

I read it...it tells to be sure that the tx line is high in the beginning. Hence, I also tried to force the tx pin high (digitalWrite(1, HIGH)), but nothing..
Where are you reading in the document?

The display doesn't display anything and this is good because it means that it received the auto-baud command, but in I try to send other command to draw something, nothing happend..

Thank for your time!

Andrea

The display doesn't display anything and this is good because it means that it received the auto-baud command ...

And -- since you are not receiving anything and since it does not respond to your subsequent commands it means that you are not communicating. So it appears that the display thinks it received an auto-baud command, but it also appears that it is different from the one that you sent - exactly as the data sheet said might happen.

I read it...it tells to be sure that the tx line is high in the beginning. Hence, I also tried to force the tx pin high (digitalWrite(1, HIGH)), but nothing..

It looks like this is the part that you have to work on. You may not be getting the line high within the 100 mS window that they give you.

Are you using the 4Display shield? It's schematic shows a connection to the reset line of the display which can be controlled by the Arduino. You could implement this line even without the shield and try keeping the display reset until you have time to drive the Tx line high.

Don