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.

Microcontroller Programming » Mac Terminal programming

April 08, 2011
by fyrfightin
fyrfightin's Avatar

I am trying to find the location of the USB cable for my NerdKit in terminal but when I type in Is/dev/cu* it tells me there is no such directory or file am I not in the right place or something? did I miss a step?

April 08, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi fyrfightin,

Did you make sure to put a space in between the ls and the /dev/cu*. You could also try just listing everything in the /dev directory by doing:

ls /dev/

Humberto

April 09, 2011
by fyrfightin
fyrfightin's Avatar

Ok thanks got that to work and replaced the line in the makefile like it says but I am lost where it says to open the command line and navigate to the file?

April 09, 2011
by Ralphxyz
Ralphxyz's Avatar

Well it appears you have the "open command line" part down if you are now able to "ls /dev/" you "got that to work".

Now you need to ... What do you think you need to do now? Maybe goto the folder that holds your file.

Doesn't the User Guide say something about "cd" as in change directory?

You use the cd command to "C"hange your "D"irectory to get to the directory that holds your file.

ls and cd are two of a bunch of command line commands to get around and do things on a computer.

This is considered by some the "natural" way to do things on a computer.

You have to be on a Windows computer or maybe a Mac. If you are on Windows Google DOS commands and if on a Mac Google Unix commands. You will get a lot of information about commands you will never use but when you use a command line, again the "natural" way of using a computer, you really need to know the basics.

So at least take a look at command line commands and you will start to answer your own questions.

When you open the command line you need to cd to the folder that holds your file. So where did you put them, when you unzipped the download from the Nerdkits? That is where you need to cd to:

In windows I use C:\Nerdkits\Code

From the command line I would do a:

--> cd C:\Nerdkits\Code

Ralph

April 10, 2011
by Ralphxyz
Ralphxyz's Avatar

Duh, of course you are on a Mac. The distracted mind is a very dangerous thing.

When you open Terminal you get something like this:

 miniMac:~ Me$

I unzipped the Nerdkits project files to developer/Nerdkits/Code

So in Terminal I enter:

miniMac:~ Me$ cd /developer/nerdkits/code

To load the tempsensor project: (from the code folder)

miniMac:code Me$ cd tempsensor

This gives you:

miniMac:tempsensor Me$

From which you type make to load the tempsensor project onto your Nerdkit.

miniMac:tempsensor Me$ make
avrdude -c avr109 -p m168 -F -b 115200 -P /dev/cu.PL2303-0000101D -U flash:w:tempsensor.hex:a
...

For more you can search the Nerdkits forums for ls and cd (with cd you'll get lots of other conversations about the cd-rom of course).

Ralph

April 10, 2011
by fyrfightin
fyrfightin's Avatar

Ok so I did everything and attempted to program but I got this message:

Found programmer: Id = "Huh? Go"; type = ' Software Version = t. ; Hardware Version = '.S avrdude: error: buffered memory access not supported. Maybe it isn't a butterfly/AVR109 but a AVR910 device? make: *** [initialload-upload] Error 1

Any suggestions?

April 11, 2011
by Ralphxyz
Ralphxyz's Avatar

Search the Nerdkits forum for hundreds of discussions about "Maybe it isn't a butterfly".

That has to be the most common error.

Ralph

April 11, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi fyrfightin,

The fact that you are getting the "Huh? Go" string in your id tells me your chip is not in programming mode. Make sure you have the programming switch installed correctly, it is flipped up in programming mode, and reset power to the chip to boot into programming mode.

Humberto

February 28, 2012
by corvair
corvair's Avatar

Hello,

How do I know? When I go too "about this mac" and search usb, it shows the 2303 usb serial device and all info such as make, model, address and manufacture. When it is plugged in my macbook it comes up with an alert that "A new network interface has been detected". It recognizes it as a USB-Serial Controller and asks to set up in network preferences. I am running OS 10.6.8 . I have looked at all the info around and have yet to find the correct path to get to the step between page 42 and 43. When modifying the text in the "Makefile" it comes back as a text file and does not do what was described. I have followed the instructions verbatim as well as many variations. Your advice would be appreciated.

February 28, 2012
by Ralphxyz
Ralphxyz's Avatar

corvair, DON"T GO to "ABOUT THIS MAC" (pay no attention) DO NOT LOOK IN NETWORK PREFERENCES!!

Just use Terminal and ls /dev

Scroll up and you will see something like this:

bpf3            ptytd           ttyr3
console         ptyte           ttyr4
cu.Bluetooth-Modem  ptytf           ttyr5
cu.Bluetooth-PDA-Sync   ptyu0           ttyr6
cu.PL2303-0020245D  ptyu1           ttyr7
cu.PL2303-0030245D  ptyu2           ttyr8
disk0           ptyu3           ttyr9
disk0s1         ptyu4           ttyra
disk0s2         ptyu5           ttyrb
disk1           ptyu6           ttyrc

Your Initialload MakeFile will look like this:

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
AVRDUDEFLAGS=-c avr109 -p m168 -F -b 115200 -P /dev/cu.PL2303-0000101D
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

ProgramName = initialload
all:    $(ProgramName)-upload

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

$(ProgramName).ass: $(ProgramName).hex
    avr-objdump -S -d $(ProgramName).o > $(ProgramName).ass

$(ProgramName)-upload:  $(ProgramName).hex
    avrdude ${AVRDUDEFLAGS} -U flash:w:$(ProgramName).hex:a

Welcome to the Command Line, the natural way of doing things ;-)

Oh, you have to have the Nerdkit USB cable and breadboard installed to find the USB port (that threw me for a while)!

Ralph

March 02, 2012
by jeffspc88mx
jeffspc88mx's Avatar

Yeah - the mac sees the USB cable as a potential modem, so it's asking you if you'd like to set up network prefs to do so. Ignore these requests (click Cancel a lot and just don't bother setting it up). It'll still be on your USB bus and accessible as a tty and/or cu device.

The Atmel chip is in programming mode IF the little black switch on the breadboard (ostensibly between the Atmel chip and the 3-pin voltage regulator) is set accordingly. This isn't a software switch, but a physical one - like a little black light switch. Usually "programming mode" is when the switch is pushed toward the 1-pin of the Atmel (away from the 3-pin voltage regulator). If it's in the other position, the make/makefile can't write to the chip, and you get "Huh?" errors.

Post a Reply

Please log in to post a reply.

Did you know that you can make a spooky Halloween Jack-O-Lantern with a microcontroller? Learn more...