UART FF only

Hi All,

I'm having trying getting UART to work on the mega2560. I am using a uLCD-70DT to send serial data to the mega and I know that the LCD is send the right data becuase I can see it on the oscilloscope. But on the mega side of things it only ever reads FF. It knows it has data waiting in the serial queue but everything I call it returns FF. Both the mega and the LCD have the same UART configuration, 9600 8N1. And the grounds for both devices are connected.

I also tried this for fun. I can read and write to the mega itself perfectly fine.

Does anyone have any ideas?


Does anyone have any ideas?

I do. I do. Please call on me.

Post your code!

everything I call it returns FF. returns an int. The value is -1 (0xFFFF) if there is nothing in the buffer. If you store that in an unsigned char it will get truncated to 0xFF.

Show your code.

I do understand that returns -1 if there's nothing in the buffer but Serial#.available() returns 1 so there is something. and I store it as an int and I'm only reading one byte at a time and read() is return 0x00FF not 0xFFFF.

Arduino Mega:

void setup() {


void loop() {

if (Serial1.available()) {


#platform "uLCD-70DT"

#inherit "4DGL_16bitColours.fnc"

#constant maxBuff 50
var cutBuffer1[maxBuff];

func main()
var x := 50;

gfx_ScreenMode(LANDSCAPE) ; // change manually if orientation change

com1_Init(cutBuffer1, maxBuff * 2, 0);
com_SetBaud(COM1, 9600);
print("hello world");

while (touch_Get(TOUCH_STATUS) != 1) // waits until screen it touched before transmitting again.

forever // this as well


but Serial#.available() returns 1

And you know this how?

I had it printing in an earlier revision. I could have also had the if statement be Serial#.available() > 0. In either case if there wasn't a byte available it should return -1 not 0x00FF right?

In either case if there wasn't a byte available it should return -1 not 0x00FF right?

Yes, but, -1 fits in an int. When the value is stored in a byte, it becomes 255 (or 0xFF).

Then why would Serial#.available() return something great than 0 then?

I also tried this loop

void loop() {

and for the most part it would print -1 and only print FF after the LCD transmits.

On a side note, the LCD outputs 3.3V as a HIGH. I don't think this should be an issue tho because a logical HIGH for the arduino is 3V right?

Is whole things was working 3 months ago, and recently got back to this and it's not working anymore. Thats why I'm bring it up in this forum...

I fixed my problem. The LCD firmware has changed in the pass 3 months. I did updated it without looking at the changes. The function call to set the baud rate now require me to pass in the baud rate/10..

Thanks for all the help!