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 » tempsensor blank LCD

July 10, 2011
by BlueFusion
BlueFusion's Avatar

I just got my NerdKit Friday and set it up that night. It was a pain to get the avr-gcc libraries working correctly on Gentoo, but I finally get them working (seemingly) correctly.

My first problem that I am experiencing is that while doing the tempsensor_edu project, my LCD remains blank and nothing is output to serial. This is after removing the battery and unplugging the USB cable, switching to run mode, and plugging battery then USB cable in. Just blank, nothing doing. I tried the tempsensor sample program and the same thing - no output to LCD or serial. I just can not get it to do anything. The connections are all made just as in the picture and description as far as I can tell but just to be safe, I attached a picture.

It does work fine with the initload program. I even altered the code a bit to display a personalized message without issue. I did have to remove the "-j .text" from the Makefile to get it to display all of the LCD lines.

FWIW, I do get the "ba" boot code from the MCU over serial, but nothing thereafter. Absolutely nothing. I tried 3 different batteries - the one in the kit, and 2 from 2 different brand new packs of 9V batteries.

July 10, 2011
by Rick_S
Rick_S's Avatar

Try the non _edu version of the tempsensor project and see if it compiles and runs. If it does, then you missed something when you were writing your program.

Rick

July 10, 2011
by BlueFusion
BlueFusion's Avatar

Like I said above, I tried the tempsensor example code (non _edu one) and it had the same exact result. I get no output (except the boot code) via serial or on the LCD.

July 10, 2011
by BlueFusion
BlueFusion's Avatar

By the way, here is a picture of the setup:

http://richgannon.net/2011-07-09_12-22-02_158.jpg

July 10, 2011
by Rick_S
Rick_S's Avatar

Sorry, missed that. I don't see anything wrong with your setup (other than I can't see the contrast resistor... but I assume it's there). I'm not a Linux person so I don't know exactly what you see when compiling... but do you see the process when you type make? Does avrdude do it's thing and connect and verify? I'm assuming you modified the tempsensor makefile since you stated you modified the initiallad makefile.... Maybe a Linux person will step in and help out.

Rick

July 10, 2011
by BlueFusion
BlueFusion's Avatar

Here is the output when making and writing:

rich@solaris ~/Code/tempsensor $ rm *.o *.hex; make
make -C ../libnerdkits
make[1]: Entering directory `/home/rich/Code/libnerdkits'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/rich/Code/libnerdkits'
avr-gcc -g -Os -Wall -mmcu=atmega168  -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o tempsensor.o tempsensor.c ../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o
avr-objcopy -O ihex tempsensor.o tempsensor.hex
avrdude -c avr109 -p m168 -b 115200 -P /dev/ttyUSB0 -U flash:w:tempsensor.hex:a

Connecting to programmer: .
Found programmer: Id = "FDL v02"; type = S
    Software Version = 0.2; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x35

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9406
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "tempsensor.hex"
avrdude: input file tempsensor.hex auto detected as Intel Hex
avrdude: writing flash (10940 bytes):

Writing | ################################################## | 100% 1.46s

avrdude: 10940 bytes of flash written
avrdude: verifying flash memory against tempsensor.hex:
avrdude: load data flash data from input file tempsensor.hex:
avrdude: input file tempsensor.hex auto detected as Intel Hex
avrdude: input file tempsensor.hex contains 10940 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.11s

avrdude: verifying ...
avrdude: 10940 bytes of flash verified

avrdude done.  Thank you.
July 10, 2011
by Rick_S
Rick_S's Avatar

That's odd, it appears to compile and send the file over. I really don't know what is going on. It's probably something staring me right in the face but I sure don't see it. Hopefully another set of eyes will pop in here and be able to help.

Rick

July 10, 2011
by BlueFusion
BlueFusion's Avatar

Rick,

Can you compile the NK provided tempsensor code and send me the .hex file? I will try to write that to the MCU. If it works, then it is simply an issue with the compilation which I can focus on.

My email is gannonr -at- bgsu.edu

Thanks

July 10, 2011
by mongo
mongo's Avatar

I didn't see the 1K resistor for the LCD control. Is it there but hiding behind the regulator? Without that, there won't be much to see on the screen.

July 10, 2011
by BlueFusion
BlueFusion's Avatar

Yes, the 1000 Ohm resistor is there and the LCD works, just not with the tempsensor program.

July 10, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Just a thought. Are you sure that is an LM34, and not a 2n7000. It still should not fail in the way you are describing, but worth double checking.

Does anything happen on the LCD if you remove the LM34?

Humberto

July 10, 2011
by BlueFusion
BlueFusion's Avatar

It is the LM34 (I checked several times as I thought that would be a stupid mistake to make before posting). But a member did email me the compiled hex code which I uploaded. It works!!!

I have the output as expected to LCD. Now what I need to figure out is the output to serial. What baud rate and settings do I need? I don't recall reading it in the PDF manual. This is what it looks like:

"ba.....A¢.....A¢.....A¢.....A¢" and so on

July 10, 2011
by BlueFusion
BlueFusion's Avatar

I guess I should also ask what I should look for in the libraries and avr-gcc that would cause the code to not compile correctly? I have Gentoo Linux on all of my computers so Windows not possible to test.

July 10, 2011
by Rick_S
Rick_S's Avatar

115200 bps N81

July 11, 2011
by BlueFusion
BlueFusion's Avatar

Thanks. That's what I have set in minicom, but it still just shows me:

A¢.....A¢.....A¢.....A¢.....

over and over. No numbers or words.

Also, anybody have any idea why it would compile on my laptop but the MCU not do anything with the code compiled on my laptop?

July 11, 2011
by BlueFusion
BlueFusion's Avatar

Ahah! I got the serialpart. The baud had to be increased to 230400 8N1. Now it works great.

But I can not find any reason for the program to not compile and work correctly when compiled on my laptop. Anyone have any suggestions or ideas?

July 11, 2011
by BlueFusion
BlueFusion's Avatar

Made a little bit of progress on the tempsensor problem.

I downgraded from GCC 4.4.5 to GCC 3.4.6 and changed the Mafefile in libnerdkits/ to use -O0 instead of -Os optimization options. The initialload program still works as expected.

Once tempsensor is loaded, instead of getting a blank screen, my LCD flashes "2601" on line 1 and nothing is output via serial. It does not appear to be rebooting, as "ba" is only sent to serial when I pull the battery and reconnect it.

I'm really in need of some ideas here.

rich@solaris ~/Code/tempsensor $ make
make -C ../libnerdkits
make[1]: Entering directory `/home/rich/Code/libnerdkits'
avr-gcc -g -O0 -Wall -mmcu=atmega168  -o delay.o -c delay.c
avr-gcc -g -O0 -Wall -mmcu=atmega168  -o lcd.o -c lcd.c
avr-gcc -g -O0 -Wall -mmcu=atmega168  -o uart.o -c uart.c
make[1]: Leaving directory `/home/rich/Code/libnerdkits'
avr-gcc -g -Os -Wall -mmcu=atmega168  -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o tempsensor.o tempsensor.c ../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o
avr-objcopy -j .text -O ihex tempsensor.o tempsensor.hex
avrdude -c avr109 -p m168 -b 115200 -P /dev/ttyUSB1 -U flash:w:tempsensor.hex:a

Connecting to programmer: .
Found programmer: Id = "FDL v02"; type = S
    Software Version = 0.2; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x35

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9406
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "tempsensor.hex"
avrdude: input file tempsensor.hex auto detected as Intel Hex
avrdude: writing flash (12302 bytes):

Writing | ################################################## | 100% 1.64s

avrdude: 12302 bytes of flash written
avrdude: verifying flash memory against tempsensor.hex:
avrdude: load data flash data from input file tempsensor.hex:
avrdude: input file tempsensor.hex auto detected as Intel Hex
avrdude: input file tempsensor.hex contains 12302 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.25s

avrdude: verifying ...
avrdude: 12302 bytes of flash verified

avrdude done.  Thank you.
July 12, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi BlueFusion,

This seems to me like an issue with avr-libc. Did install these packages from source, or did you use some special Gentoo thing. Im not too familiar with Gentoo's package managers but the internet seems to suggest you use something called crossdev http://wiki.hacdc.org/index.php/Installing_AVR_Toolchain.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that you can connect to certain car computers via the OBD-II port with a microcontroller? Learn more...