NerdKits - electronics education for a digital generation  
Did you know that a NerdKit can be used to build an iPhone-controlled R/C car? Learn more...

You are not logged in. [log in]

Everything Else » Make Arduino Duemilanova run NerdKit C code.

February 11, 2010
by feilipu

Just got a NerdKit, and this is my first post...

Although it was fun to put the it all together and make it work, I like stable power and comms, so I also just bought a Duemilanova to play with too.

But, also not liking IDE programming, much less dirty code that has "wiring" in it, I thought it might be nice to run NerdKit C code on the 328p in the Duemilanova.

Following the simple instructions from the pdf in the ATmega328P Upgrade Nano-Guide gets you most of the way.

In the .c code file you're writing change the CPU speed definition from

#define F_CPU 14745600 // for NerdKit

to

#define F_CPU 16000000 // for Duemilanova

To make avrdude work these parameters are needed for the make file:

AVRDUDEFLAGS=-c stk500v1 -p m328p -b 57600 -P /dev/ttyUSB0

Press the "S1" button on the board simultaneously with your make or avrdude command

It works. That's all!

February 11, 2010
by Phrank916

There are some really nice arduino based boards and dev-board kits out there. I really like the RBBB kit from Modern Device. It's super-small and pretty cheap. I was thinking of buying it to use as another development platform, but I am pretty sure that when I do, I'll simply wipe the Arduino bootloader and install the NerdKits foodloader or just use my ISP to program it directly. This is very good info though for anyone wanting to use one of these kits and they don't happen to have an ISP.

Ted

February 11, 2010
by dav1dr4y

Cool. Good information. I also have a Nerdkit and a Arduino Duemilanove. (Also have a Basic Stamp and am thinking of getting a PICAXE. uc junkie.) I was interested in your idea. But I also like using the IDE for Arduino. I like options. I thought I read that any .hex file ought to work in the Arduino (and the reverse I presume). To test this I took the LED_Blink.c that comes with Nerdkit and modified it to use pin PB5 instead of PC4, which corresponds to digital pin 13 (with the built in LED) on the Arduino. I started it running on my nerdkit. I then uploaded the LED_Blink.hex file to my Arduino using essentially the AVRDUDE parameters you give above. I used a GUI to start AVRDUDE called ArduinoUploader (found at ngcoders.com). Anyway, the program ran as expected there. So, the lesson for me is I can keep the Arduino bootloader and use the Arduino IDE when I want and also upload non-IDE, non-Wiring code when I want also.

I should be able to do the reverse also. Upload Arduino IDE generated .hex files to my Nerdkit bootloader ATMega... but I can't (yet) find what Arduino does with the .hex files.

Anyway, thanks for gettin' me going on this train of thought.

/David

(I am unclear on what is 'bad' about Wiring. The Arduino code seems like c code to me. I guess that shows my limited understanding of the programming so far.)

February 11, 2010
by dav1dr4y

Ok, I figured out how to find the hex file that Arduino generates. (Hold down the shift key during a compile or compile/upload and the verbose output shows the path to the temp directory where it is stored.) After changing the board to Diecimila 168 and recompile I was able AVRDUDE the hex up to the Nerdkit chip and it ran fine.

Now that I have done this and re-read this thread I think I misunderstood feilipu. But Phrank916 was talking about replacing the bootloader on the Arduino'd chip. Anyway, I'm happy to have both kits and be able to run programs made with or without the Arduino IDE on either.

/David

April 08, 2010
by esoderberg

I'm trying to load an ATmega168 Duemilinova with code used on the Nerdkit.

I've tried using the update to the makefile given by feilipu

AVRDUDEFLAGS=-c stk500v1 -p m328p -b 57600 -P /dev/ttyUSB0

with m168 replacing the m328p as well as replacing /dev/ttyUSB0 with COM2

I get

stk500_getsync(): not in sync: resp 0x00

stk500_disable(): protocol error, expect 0x14, resp 0x51

with no success.
Any guidance would be appreciated.

May 26, 2010
by DrNoExpert

I got into microcontrollers with the nerdkit, yet now I want to expand on programming languages. Right now I'm working on PICAXE, yet the only problem is that they have low amounts of memory, and the PIC have higher memory for the price. is it possible I can program a PIC microcontroller with a PICAXE programmer?

May 27, 2010
by dav1dr4y

This is probably not the best place to get the best PICAXE info. You know the PICAXE is a PIC with a BASIC interpreter pre-programmed into it? Clearly that has a memory cost. I imagine you may also know the 20, 28 and 40 pin X1 and X2 versions of the PICAXE have quite a bit more memory than the smaller ones.
Programming a PIC with a PICAXE? I kinda doubt it. Better to ask this of the relevant experts though. Probably at PICAXE Forums. I recommend reading at and buying at PHAnderson's PICAXE Stuff

/David

Post a Reply

Please log in to post a reply.