Page 1 of 2

CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 06, 2012 11:37 am
by klaudius666
Hi All.

first of all, many greetings for the developpers of Multiwii, it's a good piece of code !

I'm new to multiwii world and arduino programmation, it's cool, i love flying machine and programmation ;-) .
I ve build a mini Xquad and all is working fine. amazing flying skills.

my actual configuration is

CRIUS SE BOARD. Level on AUX1 and BARO ON aux2.
using multiwii 2.0 release and arduino 1.0.

The problem is CRIUS 3 WIRE LCD (please don't say it's shit even if it's true... but it was just simply working with 1.9).
Something wrong is happenning with communication with main board :

weird characters, offseted etc... bu you can guess it's not random cause you seen partial right text

I tried to fix the bug by changing BITDELAY but it's not the solution : it's worst if i go far from 102 BITDELAY VALUE, more much weird characters.
I made a file diff between 1.9 and 2.0 version. for LCD3WIRE type, it seem the sending serial code is not changed. idem for clearscreen command.

Notice something : when if connect both LCD and USB interface... when i upload the new program, the LCD receive many characters (i suppose they are on the same pin ? it's normal ?)

I know the code 2.0 is working fine on original 3 wire Sparkfun LCD, so my opinion is that someting 'non standard' is implemented in crius LCD to achieve serial reception....

i think that between 1.9 and 2.0, the protocol was not changed... so there is something about timing and crius LCD software must be sensitive to this.
Perhaps an interrupt that push bad values on PINOUT, or make jamming in timing ? perhaps the code is not compiled in the same way ?

was thinking of disabling all interrupts before sending the whole screen refresh and reenabling all after, but it's sound like the delay() func need interrupts to work.

is there a reliable method to do this ?

There are many users of Crius LCD and it would be cool to manage to solve this bug.
Thank you for your suggestions

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 06, 2012 8:40 pm
by dramida
Same bug bothers me also, here is a video with MWC 1.9 working and MWC2.0 malfunctioning.
http://www.youtube.com/watch?v=L7TtpjYjvGo

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 06, 2012 11:14 pm
by klaudius666
I read on some forum that there are some problem with lastest arduino 1.0 with some serial LCD... i'll try to compile MW2.0 with arduino 023 just to see..... the strange thing is that it was working on 1.9 and not noticable change in 2.0.... more strange the sparkfun LCD work (more robust serial read coding i think)

If an experienced arduino coder read this. help or suggestions is welcome ;-)

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 07, 2012 7:36 am
by kalle123
Can confirm that bug.

Arduino uno with LCD keypad shield

sketch "LiquidCrystal Library - Serial Input"

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 07, 2012 8:54 pm
by Alexinparis
klaudius666 wrote:I read on some forum that there are some problem with lastest arduino 1.0 with some serial LCD... i'll try to compile MW2.0 with arduino 023 just to see..... the strange thing is that it was working on 1.9 and not noticable change in 2.0.... more strange the sparkfun LCD work (more robust serial read coding i think)

If an experienced arduino coder read this. help or suggestions is welcome ;-)


I agree, this problem is strange.
The debate is not about the quality of this LCD, but rather why there is a change between 1.9 and 2.0.
The LCD code for bit banging is identical.
Between 1.9 and 2.0, there are mainly:
- new output for ESC and servo, with direct timer definition and port access
- new serial functions with home made interrupts
- 1.0 Arduino
I suppose the problem comes from one of those.
It's identification will probably help to solve other issues in the future.

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 07, 2012 11:58 pm
by UndCon
"new serial functions with home made interrupts"

And the LCD is serial...don't you think that is the problem?

make a small sketch and try with arduino IDE 023 or similar and then with IDE 1.0 and see if there is any change

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 7:45 am
by klaudius666
I'll try to compile 2.0 with arduino 023... i'll give you news about the result...

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 10:54 am
by klaudius666
not working even with 023 arduino IDE....

tested this code :

for(uint8_t i='0';i<255;i++)
{
//
// LCDprintChar("\r\n");
LCDprint(0xFE); LCDprint(0x01) ;
//LCDprint(0xFE);
//LCDprint(48);
delay(200);
line1[0]=i;
line1[1]=0;
LCDprintChar(line1);
delay(500);
}

command 0xFE is not recognised... 0xFE and 0x01 are displayed as weird char, then normal char are displayed... missing something ?

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 11:35 am
by Hamburger
maybe it might help to consult the crius lcd documentation for supported command set, if such doc does exist? anyone have such doc?
For MWii the minimum requirement to support currently is
- clear screen (could be handcoded with printing spaces?)
- set cursor to beginning of line N
- print chars

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 1:35 pm
by klaudius666
Hi.

Looked for a doc for crius LCD.... but none....

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 4:56 pm
by klaudius666
the minimum to display on LCD are :

setline(n);
LcdPrint();

Looked at documentation of sparfun serial LCD cause crius lcd seem to be a clone of this.

Perhaps my LCD is bad configured.... there are special command to set number of line and number of char per line, and it's possible to reset baud rate at 9600 during boot splash screen display (it's 9600 during boot splash screen, then can change according to setup in eeprom)....

i uploaded code to MW board when lcd was connected and it was printing a lot of weird character during this... perhaps it sended a command that change configuration of my screen (0x7C followed by 1 or 2 or 3,4,5,6... it possible in the size of the MW code)
therefore... when a boot LCD, it display 20 char (16 on first line and 4 on second line... ) but no chars after.....

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 08, 2012 8:46 pm
by shikra
I left my lcd in during upgrade and it would only show bad characters after.

I had to read documentation and reprogram it to correct defaults....

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 09, 2012 11:23 am
by Dellow
I think that is probably what's caused the problem, as I did the same with mine.

Come on then, Shikra, give us a clue! Where did you find the documentation, or better still, how did you reprogram your LCD?

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 09, 2012 12:50 pm
by UndCon
How do you leave it connected when you upload new firmware?

I use the Sparkfun FTDI adapter and the LCD uses 3 of the same pins - I cannot connect 2 at the time without soldering a separate connector for 1 of them...
(can you post a picture please)

//UndCon

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 09, 2012 3:19 pm
by Dellow
I use the same adaptor, but on the CRIUS board there are seperate pins for FTDI and TTL. The LCD connects to the TTL pins.
See picture -

Crius SE Pins.jpg


I've also tried the following (from the Sparkfun serial LCD datasheet), but I get odd characters where the control codes should be, and only 21 characters fill the screen.
i.e. the first line is filled with 16 characters, and the second line then has 5 characters.
The clear screen command is ignored as well.

void setup()
{
Serial.begin(9600);

}

void loop()
{

Serial.write(0x7C); //put lcd into setup command mode
Serial.write(0x04); // send command for 16 character
delay(100);
Serial.write(0x7C); //put lcd into setup command mode
Serial.write(0x06); // send command for 2 line lcd
delay(100);
Serial.print("Hello"); // Print 'Hello' (the only bit that works!!)
delay(1000);
Serial.write(0xFE); //put lcd into enhanced command mode
Serial.write(0x01); // clear the screen
delay(1000);

}

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 10, 2012 7:08 pm
by klaudius666
For information i Disassembled my crius LCD :

the LCD is a LCM1602C V2.0

the serial to LCD if managed by an AMTEL MEGA48PA

....

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 10, 2012 8:16 pm
by shikra
I think I used arduino terminal or maybe hyperterminal, then typed following:

<control key>r when LCD splash screen displayed. Gotta be quick!

http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF

Dellow wrote:I think that is probably what's caused the problem, as I did the same with mine.

Come on then, Shikra, give us a clue! Where did you find the documentation, or better still, how did you reprogram your LCD?

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 10, 2012 9:17 pm
by Dellow
Thanks Shikra, I'll give that a try when I'm back home (working away for a few days this week).
I saw the <control key>r sequence in the datasheet, but didn't know how to send the sequence in software. I didn't think of just using a terminal!
I'll let you know if I have any success.

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu Apr 12, 2012 4:15 pm
by Metroid
I had a look an the LCD code.
At first the baud rate of 115200 of the serial3w is wrong. This must be 9600.
The seccond I find out is that the Cruis LCD is a one line LCD display. You must write 40 caraters to the screen to fil the compleet screen, on the second line just the 5 characters.
No special comandcodes for the sparfun LCD work with the CRIUS LCD.

If i find out more, I let you all know.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu Apr 12, 2012 8:02 pm
by Dellow
Quick update, I've tried the Ctrl-r reset using Hyperterminal and it hasn't made any difference.

Metroid, if you're right about it being a 1 x 40 display this would explain why none of the settings I have tried will work.
Looking at the display, it has two lines of 16 characters, making a total of 32 characters. Would this still relate to a 1 x 40?

My understanding of all this is pretty minimal, but I may just take the LCD apart and use it for something else. It's a pity as it's a nice clear display.

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu Apr 12, 2012 10:21 pm
by Metroid
Normal registers of a LCD driver has 40 characters. If you connect the LCD through a TTL UART, like the FDTI programmeren, you can use a terminal to connect to the LCD. You have don this before, I asume. Now you need a terminal program like real term. Whit this you can send one caracter at the time or repead the transmission for more than ones. If you select 40 times the same caracter, the full display will be overwriten by that caracter, exept the first caracter on line 1. There is no clear screen or direct cursor function.
I hope to fined the correct code for this display. The difference of 1.9 or 2.0 is very big. How the line1 and line2 arrays are billd up are very different. I think a complete special LCD library is needed for the Crius LCD.
I also find out that the LCD has a dedicated JTAG 6 pin connexion. A new code can help the interface react like the sparkfun serial LCD. Just an extra to do.
I think to program the ATMEGA to preforme like the Sparkfun is the most easiest way to overcome the problem.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 13, 2012 6:09 pm
by Metroid
It is posible to reprogram the ATMEGA48pa. I have soldert a ISP 6 pin connector on the board. Test a new code and it's working. Not compleet correct yet but where getting there. I have a timing problem with initializing the LCD.

Here a video;

Crius LCD reloaded

Rob

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 13, 2012 8:17 pm
by Dellow
I'm obviously doing something wrong, as I am unable to communicate with the LCD using Realterm, Hyperterminal or the Arduino serial monitor.
I am using gnd, 5v and tx from ftdi to the lcd, but just get occasional garbage.
The only way I have been able to talk to it is by using serial.print through an arduino board.

Edit: Just noticed your video - nice work! I think I'd better leave this to the people with far more expertise than me!

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 13, 2012 9:31 pm
by UndCon
If Metroid posted his code it would be easier :)

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 13, 2012 9:54 pm
by Metroid
Here is the code so fare.
I only have implemented the LCD screen. The next step is the serial communication.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 15, 2012 1:43 pm
by dramida
Metroid wrote:It is posible to reprogram the ATMEGA48pa. I have soldert a ISP 6 pin connector on the board. Test a new code and it's working. Not compleet correct yet but where getting there. I have a timing problem with initializing the LCD.

Here a video;

Crius LCD reloaded

Rob

Well done Rob, i only have one of this Crius LCD's and my laptop died this morning.I am hopeing for the best. /Mihai

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 15, 2012 6:09 pm
by Metroid
I'm busy in AVR studio 5. It is easier to include interrupts. I hope to can go on tomorow.

Normally I program in MPLAB IDE with Pic32 processors. The power of those micro controllers are huge in comparison to the AtMega 48 or even the 2560. This is a new learnig curve for me. New type of registers etc. But I will go on till I have a solution.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 20, 2012 11:12 pm
by Metroid
The Crius Serial LCD code is finished. I have a newprogram works like the sparkfun serial LCD.
http://www.youtube.com/watch?v=-iNE7ysb ... rNU1CHY%3D
There is one thing. You can chane the baudrate but not to 115200. This is also not possible on the sparkfun serial LCD.
You must change some code in the multiwii v2.0.

First ad this in the config.h:

Code: Select all

#define LCD_CRIUS


Next, change in the LCD.pde this:

Code: Select all

#if defined(LCD_SERIAL3W)

to this:

Code: Select all

#if (defined(LCD_SERIAL3W) || defined(LCD_CRIUS)


As last, ad some code afther this:

Code: Select all

  #if defined(LCD_SERIAL3W)
    SerialOpen(0,115200);
  #endif

Here:

Code: Select all

#if defined(LCD_SERIAL3W)
    SerialOpen(0,115200);
  #endif
#if defined(LCD_CRIUS)
    SerialOpen(0,9600);
  #endif


Now you can use the new program your Crius Serial LCD. The square solder pad on the bottom side of the LCD is the MISO for the ISP connector.
Image
ou have the options to solder the header 3x2 pins or just connect.

Open the production file Serial_LCD.elf in your program tool and have some fun.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 20, 2012 11:44 pm
by UndCon
Well done!

Can we use the Sparkfun FTDI adapter that we normally program the Arduino with?
And some wires soldered to the 6 pads on the Crius LCD
//UndCon

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 21, 2012 9:31 am
by Metroid
No, you can not use the FTDI. You must use a STK500 or AVRDUDE like programmer for Atmel chips. These programmers have an ISP interface with 10 or 6 wires.
Use AVRstudio to program the chip. It's like programming a KK flightboard.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 21, 2012 2:17 pm
by Hamburger
buy a usbasp and use avrdude program from within arduino ide wrapper.

Re: CRIUS LCD BUG WITH 2.0

Posted: Sat Apr 21, 2012 4:26 pm
by UndCon
I have an USBASP installed in my TGY9X radio :D but if I remember correctly I bought 2...I have to check in my boxes with electronics.

//UndCon

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 22, 2012 1:46 am
by dramida
Thank you Rob for the effort of codding this LCD. I'll try this new software on my Crius LCD. Wouldn't be more straight to just simply change the baudrate from 115200 to 9600?

Code: Select all

SerialOpen(0,9600);


Anyway, step by step, i am learning the programing technique that the big boys use.

Re: CRIUS LCD BUG WITH 2.0

Posted: Sun Apr 22, 2012 8:16 am
by Metroid
Nope, tried that, didn't work. You must update the AtMega48pa chip on the second PCB.

Rob

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 23, 2012 1:37 am
by erwinf
I have a usbasp programmer that came with my kkboard. Can I use that with avrdude to flash the second pcb? What command line will I use? Will this work?

Code: Select all

avrdude –c usbasp –p m48 –u –U flash:w:seriallcd.hex

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 23, 2012 10:28 am
by Metroid
I don't use AVRDUDE but i think this is the correct settings:

Code: Select all

avrdude -c usbasp -p m48 -U flash:w:Serial_LCD.hex
avrdude -c usbasp -p m48 -U eeprom:w:Serial_LCD.eep

Don't change the fuses.

I use the AVRStudio programmer tool to program the chip. It doesn`t work with usbasp.

Rob

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 23, 2012 9:20 pm
by brerax
Thank you Metroid.

I used my USBasp interface and the kkMulticopter Flash Tool 0.60 to flash my Crius LCD.
This combination worked for me and now I can connect this LCD to my Crius SE MultiWii board with 2.0.

The most difficult thing was actually to solder the six pins to the board.

Re: CRIUS LCD BUG WITH 2.0

Posted: Mon Apr 23, 2012 9:49 pm
by Metroid
Your welkom.

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 24, 2012 1:35 am
by erwinf
brerax wrote:Thank you Metroid.

I used my USBasp interface and the kkMulticopter Flash Tool 0.60 to flash my Crius LCD.
This combination worked for me and now I can connect this LCD to my Crius SE MultiWii board with 2.0.

The most difficult thing was actually to solder the six pins to the board.


What did you select in the flash tool to flash the LCD? DId you also flash the eep file and how?

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 24, 2012 5:43 am
by brerax
erwinf wrote:
brerax wrote:Thank you Metroid.

I used my USBasp interface and the kkMulticopter Flash Tool 0.60 to flash my Crius LCD.
This combination worked for me and now I can connect this LCD to my Crius SE MultiWii board with 2.0.

The most difficult thing was actually to solder the six pins to the board.


What did you select in the flash tool to flash the LCD? DId you also flash the eep file and how?

I selected usbasp as the programmer, atmega 48PA as the controller and then Serial_LCD.hex as the file.
No, I did not flash anything more then the the Serial_LCD.hex file.

Image

Re: CRIUS LCD BUG WITH 2.0

Posted: Tue Apr 24, 2012 1:33 pm
by erwinf
brerax wrote:
erwinf wrote:
brerax wrote:Thank you Metroid.

I used my USBasp interface and the kkMulticopter Flash Tool 0.60 to flash my Crius LCD.
This combination worked for me and now I can connect this LCD to my Crius SE MultiWii board with 2.0.

The most difficult thing was actually to solder the six pins to the board.


What did you select in the flash tool to flash the LCD? DId you also flash the eep file and how?

I selected usbasp as the programmer, atmega 48PA as the controller and then Serial_LCD.hex as the file.
No, I did not flash anything more then the the Serial_LCD.hex file.



Ok thanks. Will try it tonight :)

Re: CRIUS LCD BUG WITH 2.0

Posted: Wed Apr 25, 2012 11:29 pm
by Quad FRITZ
Hi-

Before I reflash my crius LCD- is the new FW downwards compatible to multiwii 1.9 ?

Thanks a lot for all the great work!

(FYI: I am new here- and love Crius SE boards! Working on FPV Hexa with I2C GPS- probably with new 2.0 dev ver... Tons of questions to come ;-). :ugeek:

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu Apr 26, 2012 10:31 pm
by Metroid
Its must be downwards compatible. It works on the same protocol as the serial3w. Make sure multiwii v1.9 works with the a baudrate of 9600.

Rob

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 27, 2012 2:39 am
by yokoyoko
Thank you Great information Metroid.

My CRIUS LCD renewal came back from dust box.

I used.
USBasp interfase.
kkMulticopter Flash Tool 0.60.
Serial_LCD.hex.

My CRIUS LCD is working very fine with MultiWii 2.0. :D

But I'm a hothead. I already orderd a sparkfun LCD..;;;;;;;;;; :?

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri Apr 27, 2012 4:02 pm
by Metroid
@yokoyoko
That's a shame.


But, nice to hear that all of you like the new firmware.

Rob.

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu May 03, 2012 9:51 pm
by Quad FRITZ
I also really like it!
Thank you so much for the effort- much better then before, also with 1.9. :)

Re: CRIUS LCD BUG WITH 2.0

Posted: Thu May 17, 2012 5:24 pm
by raptor30
someone please post the 2.0 sketch with modified LCD code for Crius LITE?
I'm not good in editing sketches :)
thanks in advance

Re: CRIUS LCD BUG WITH 2.0

Posted: Wed May 23, 2012 7:58 pm
by roguel
@metroid

Great work, any chance on sharing the source? I would like to ad some feature to also use the LCD as a serial monitor for an arduino board I'm working on. ([CR][LF] is not working now, just shows jibrish)

btw, It took me several hours to find out that I actually got my crius LCD delivered with your firmware in it... ? I thought somehow avrdude didn't update. Looks like crius is reading the multiwii forum as well. ;-)

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri May 25, 2012 10:16 am
by Metroid
@ Roguel
A LCD screen does not understand Line Feed and Cursor Return. For this you must use the option Set Cursor Position 0x80 + Position.
It's Nice to here that Crius has updated there firmware.

If you want to ad some extra's, here is the solutions for AVRStudio 5.1.

Rob

Re: CRIUS LCD BUG WITH 2.0

Posted: Fri May 25, 2012 6:59 pm
by roguel
Thanks for sharing! Will experiment a little in the weekend.