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 » mac lion tempsensor_edu prob

September 26, 2011
by swragg
swragg's Avatar

I have written .c file I changed makefile as follows

"

GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev/ttyUSB0 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all: tempsensor-upload

tempsensor.hex: tempsensor.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o tempsensor.o tempsensor.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex tempsensor.o tempsensor.hex

tempsensor.ass: tempsensor.hex avr-objdump -S -d tempsensor.o > tempsensor.ass

tempsensor-upload: tempsensor.hex avrdude ${AVRDUDEFLAGS} -e sleep 0.1 avrdude ${AVRDUDEFLAGS} -D -U flash:w:tempsensor.hex:a "

I put switch on circuit board to up position i powered up circuit I entered make in terminal

I got the following response

"

unknown-10-9a-dd-9f-14-1d:~ simonwragg$ cd Documents/Electronics/NerdKits/Code/tempsensor_edu unknown-10-9a-dd-9f-14-1d:tempsensor_edu simonwragg$ make make -C ../libnerdkits make[1]: Nothing to be done for `all'. 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 tempsensor.c: In function 'adc_init': tempsensor.c:39: error: 'ADCRSA' undeclared (first use in this function) tempsensor.c:39: error: (Each undeclared identifier is reported only once tempsensor.c:39: error: for each function it appears in.) tempsensor.c: In function 'adc_read': tempsensor.c:48: error: 'ADCRSA' undeclared (first use in this function) tempsensor.c:76:35: error: invalid suffix "o" on floating constant make: *** [tempsensor.hex] Error 1 unknown-10-9a-dd-9f-14-1d:tempsensor_edu simonwragg$ "

Not sure where to start to resolve this

Simon

September 26, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Simon,

Did you make sure to properly run the avr-gcc-select command after installing AVR-Cross pack? It looks like some libraries aren't getting loaded quite right.

Humberto

September 28, 2011
by swragg
swragg's Avatar

Thanks Humberto

I realised I had made another mistake in makefile that is I had not changed line to :-

AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev/cu.usbserial (That worked with initial load problem)

After correcting,uninstalling MacPack, reinstalling MacPack, rebooting mac ,selecting gcc4 I entered make in terminal

response

" unknown-10-9a-dd-9f-14-1d:SIMtempsensor_edu simonwragg$ ls Makefile tempsensor.c unknown-10-9a-dd-9f-14-1d:SIMtempsensor_edu simonwragg$ make make -C ../libnerdkits make: ../libnerdkits: No such file or directory. Stop. make: [tempsensor.hex] Error 2 "

As you suggested it looks as though not finding /libnerdkits

How can I find this library assuming I can how do i change makefile to make it available to compiler

Or am I missing something obvious

September 28, 2011
by swragg
swragg's Avatar

The libnerdkits Folder is in the Code Folder which is in the Downloads Folder.

Do I need to relocate any of these folders

and do I need to change makefile of temp sensor to locate libnerdkits

Thanks Simon

September 29, 2011
by swragg
swragg's Avatar

Some Progress - actually I am not sure

I reinstalled Code

I changed makefile as before i.e. put in usbsreial

and added delay (as with initial load solution)

I replaced tempsensor.c in Tempsensor_edu with tempsensor.c in Tempsensor

I then selected gcc4

I then entered make in Tempsensor_edu directory

result

"

unknown-10-9a-dd-9f-14-1d:tempsensor_edu simonwragg$ make make -C ../libnerdkits avr-gcc -g -Os -Wall -mmcu=atmega168 -o delay.o -c delay.c avr-gcc -g -Os -Wall -mmcu=atmega168 -o lcd.o -c lcd.c avr-gcc -g -Os -Wall -mmcu=atmega168 -o uart.o -c uart.c 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/cu.usbserial -e

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: erasing chip

avrdude done. Thank you.

sleep 0.1 avrdude -c avr109 -p m168 -b 115200 -P /dev/cu.usbserial -D -U flash:w:tempsensor.hex:a

Connecting to programmer: . avrdude: butterfly_recv(): programmer is not responding make: *** [tempsensor-upload] Error 1

"

What to do?

Simon

September 29, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi swragg,

That is progress. Two things to try, up the delay just a little bit more, .5 should be in the very safe range.

The other stong possibility is that your battery might be starting to give out with all this debugging going on (your LCD has probably been on this whole time), and a weak battery will almost certainly give you this error.

Humberto

September 30, 2011
by swragg
swragg's Avatar

Thanks Humberto

i put voltmeter across battery - 8.94 (I am not sure what this means with open circuit 9v battery)

However changed battery Increased delay as you suggested to .5

SUCCESS!

September 30, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Measuring the voltage across an unloaded battery doesn't really tell you much, but that was probably the issue. Glad you got it working!

Humberto

Post a Reply

Please log in to post a reply.

Did you know that a flyback diode is important when driving a motor or any inductive load? Learn more...