7
\$\begingroup\$

Part three of a three part series on transitioning from Arduino to a plain AVR microcontroller and minimum supporting components (part one, part two)

I already know how to use an Arduino as a programmer for an ATmega, and I know how to use an external programmer for the ATmega/Arduino using the Arduino IDE.

What do I need to know to start programming an ATmega1 with the command line tools? A brief overview of the different language features and steps to make/upload would be nice.

1. ATmega328, or a smaller/cheaper AVR microcontroller, even an ATTiny if possible, which will still run the applicaton: See this post for some details on shrinkifying to an ATTiny.

asked Apr 11, 2013 at 16:00
\$\endgroup\$

1 Answer 1

7
\$\begingroup\$

The tool I would use in this case is Cduino. Cduino is a tool designed to give greater control over the actions of the ATmega and doesn't require a bootloader.

The cduino project tries to make it simpler to migrate from the arduino to simpler hardware setups, in particular those that lack a USB serial interface and bootloader. This may be interesting to users for whom cost definitely is a factor.

You will need a USB programming cable, and a Duemilanove or an Uno as it uses the Mega328p chip. Of course, Uno's and Duemilanove's seem to be the most common, so this shouldn't be an issue. You will also want an ISP (examples given in the first part of the question) for in-system programming (i.e. to avoid the bootloader).

It's a lots like the excellent arduino project and uses the same open hardware, but avoids the new wiring language, the C++ intermediate layer, and the Java-based IDE.

Cduino itself is a command line tool which allows you to write directly to the Arduino. You will need a few packages installed, including make, avrdude and screen. To make it run without the bootloader, connect the Arduino as I explained in the previous question, and in the generic.mk file change UPLOAD_METHOD from arduino_bl to AVRISPmkII.

Uploading the file itself is a simple command line sequence:

make -R -C <program_name> writeflash

Then, to communicate with the board serially, use:

make -R -C term_io writeflash 
make -R -C term_io run_screen

There is a series of 'lessons' to write code for Cduino here. It is basically C, but with a few library functions specific to the ATMega328p chip - note that it is C, NOT C++.

answered Apr 11, 2013 at 16:43
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.