NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » LCD Display incorrect

October 24, 2009
by iphitus
iphitus's Avatar

The LCD isn't correctly displaying the programmed output. It is only displaying the last line programmed to be displayed, at the first line of the LCD. However the original pre-programmed message that it had when it arrived worked fine.

To give you an idea, when running initialload.c, it gave this exact display:

Line 1:     is alive
The rest of the lines are blank.

Something similar happens for the temperature sensor too. I've rewired the whole set twice with no result. The temperature sensor readings seem to be correct as it's only 2 degrees of a cheap thermometer that I have here.

Some information and more output on this pastebin entry

Thanks,

James

ps: Just a suggestion for the instructions. on page 26, it has the instruction for LCD pin 3, however the rest of the pin out is on the next page. I rewired the LCD by the later instructions and couldn't work out why it didnt work - I was missing LCD pin 3. Maybe copy that instruction to the rest of the pinout.

October 24, 2009
by mikedoug
mikedoug's Avatar

I will agree that the wiring instructions for the LCD in the documentation are tough to follow. With this many wires, a table format might be a better way to go.

It's odd that your communication seems to work with the LCD (you see data); but the movement commands don't appear to be working. Check the voltage drop across your + and - power rails -- make sure they're 5V (or nearly 5V).

You might go into lcd.c and toy with delays and the like. Perhaps bump the delay_us calls in lcd_write_nibble() to 2 or 3 (as the comment says those are the only delays that work here).

Just to test things out, perhaps the NerdKits guys can send you the .hex file of the originally loaded program -- that way you can double check that things are still kosher with your nerdkit. You'd want the originally loaded .hex in case something has changed in the code base since that original...

Good luck!

MikeDoug

October 25, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi James,

I have a theory that I'd like you to test. One of the LCD wires is responsible for determining whether the nibble (4-bits) being transmitted is data or a command, and it's possible that for whatever reason that one connection is bad and it is essentially treating everything as data. This is the wire going between LCD pin #4 and microcontroller pin #13 (PD7). Can you triple-check this connection, or even see if the result changes if you remove that wire entirely?

I am also e-mailing you the originally-loaded .hex file so you can give that a try and verify that it's behavior hasn't changed. If that's still the case, then we know the problem is on the compiler/code side of things. Best,

Mike

November 02, 2009
by iphitus
iphitus's Avatar

Thanks for the responses! Sorry I've taken a while, I'm in the middle of my exam period and haven't had much time to spare.

I loaded the hex sent to me by Mike and they ran perfectly, both tempsensor.hex and preload.hex. However any code built locally still behaves incorrectly.

MikeDoug: Made those modifications to lcd_write_nibble, no change.

Thinking it might be my toolchain, I've rebuilt gcc-avr and avr-libc with no optimisations, (upstream packages were built with -O2) however no change. Might there be some other issue with the output?

Thanks for your help. I've provided some more information, and sent an email with the hex compiled by my gcc.

James

Software Versions: avrdude 5.6 avr-libc 1.6.7 gcc-avr 4.4.1 distro: Arch Linux

avr-gcc -v

iphitus(~/projects/avr/Code/tempsensor)$ avr-gcc -v
Using built-in specs.
Target: avr
Configured with: ../configure --disable-libssp --disable-nls --enable-languages=c,c++ --infodir=/usr/share/info 
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --prefix=/usr --target=avr --with-gnu-as 
--with-gnu-ld --with-as=/usr/bin/avr-as --with-ld=/usr/bin/avr-ld
Thread model: single
gcc version 4.4.1 (GCC)
November 02, 2009
by iphitus
iphitus's Avatar

oh, and removing the wire of LCD#4/MCU#13 caused the screen to scroll text continuously. Replacing it again stopped the scrolling, however the output is still the same incorrect output.

November 27, 2009
by timonvo
timonvo's Avatar

Hi,

I've got exactly the same problem. The proposed fixes didn't work either. Could it be that this has something to do with the version of avr-gcc/avr-libc. When installing it on gentoo I had a few problems I had to fix, and saw some directories like avr4, avr5, avr51...?

What version setup did the staff use for the initially loaded program? And could someone send me the original hex files too? (timonvo at gmail dot com)

I'll keep you posted with my findings.

Greets, Timon

avr-gcc -v

Using built-in specs. Target: avr Configured with: /var/tmp/cross/avr/portage/cross-avr/gcc-4.4.2/work/gcc-4.4.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/avr/gcc-bin/4.4.2 --includedir=/usr/lib/gcc/avr/4.4.2/include --datadir=/usr/share/gcc-data/avr/4.4.2 --mandir=/usr/share/gcc-data/avr/4.4.2/man --infodir=/usr/share/gcc-data/avr/4.4.2/info --with-gxx-include-dir=/usr/lib/gcc/avr/4.4.2/include/g++-v4 --host=x86_64-pc-linux-gnu --target=avr --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libmudflap --disable-libssp --disable-libgomp --enable-cld --with-python-dir=/share/gcc-data/avr/4.4.2/python --disable-libgcj --enable-languages=c --enable-shared --disable-threads --disable-bootstrap --disable-libgomp --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.4.2 p1.0' Thread model: single gcc version 4.4.2 (Gentoo 4.4.2 p1.0)

November 27, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi Timon,

I just e-mailed you some original hex files. Please let me know what happens.

iphitus, how did you resolve your situation? I know that Humberto send you some *.o files to compile against, but I don't think we've heard back from you since then.

Mike

November 27, 2009
by iphitus
iphitus's Avatar

Sorry, got a new job and haven't had much time.

Just tested it now. You guys were right, it was optimisations on libnerdkit. Removed them and also set them to -O0 and it works as expected. The optimisations in the tempsensor Makefile are fine at -Os.

Thanks!

November 28, 2009
by timonvo
timonvo's Avatar

Thanks iphitus. That works great.

Good luck with your new job.

Timon

August 27, 2012
by fixedPoint
fixedPoint's Avatar

Sorry to bring this thread back from the dead, but is there any chance you can expand on the solution to this problem? I'm having the same issue with avr-gcc 4.7.0 on a Mac. I tried removing the -Os flags from the makefiles for just libnerdkits and both libnerdkits and initialload, but neither worked. I still just get "is alive" on the first line of the lcd and nothing else.

Thanks, Steve

August 27, 2012
by fixedPoint
fixedPoint's Avatar

Please disregard -- the posted solution works. I had forgotten to delete the object files in libnerdkits to force the re-compilation.

August 29, 2012
by thinairart
thinairart's Avatar

You don't have to sacrifice compiler optimizations to fix this issue. See this thread for the code fix to the Nerdkits LCD library that will solve the issue for gcc 4.7:

http://www.nerdkits.com/forum/thread/2118/#post18932

August 29, 2012
by Ralphxyz
Ralphxyz's Avatar

thinairart, you should do a reference in the Nerdkits Community Library.

In fact you might add a little more detail.

Threads here in the forum are essentially lost unless there is someone like you that keeps mentioning them while the Library is a constant reference source.

To learn how to make a library entry just sign in and then you can edit a existing page to see how it was composed, just don't save when you exit.

The library uses the same stupid Markdown engine as the forum so you use the same syntax.

Also instructions on doing links are on the bottom of this page, for your link do:

[Fix this Issue](http://www.nerdkits.com/forum/thread/2118/#post18932)

That gives you Fix this Issue

Ralph

Post a Reply

Please log in to post a reply.

Did you know that NerdKits believes in the importance of a mixture of meaningful topics, clear instruction, and engaging projects? Learn more...