Let's Make Robots!

Creating a new Arduino PCB in the Arduino IDE - Trials and Tribble-ations

If someone can help me out then I will write a tip/walkthough on this subject.

Quite often DAGU products use the ATmega168 MCU rather than the ATmega328 because they are a bit cheaper and 16K of program memory is often enough.

The problem is that ATmel no longer produce the ATmega168 20-AU which we had been using. They now produce the ATmega168PA which is almost identical but has a different device signature ID.

We have used these chips with Arduino compatible products and normally we do not have a problem except when burning the bootloader with the Arduino as an ISP. AVR dude will complain about the invalid signature ID.

So now with our Micro Magician controllers about to go on sale I am learning to create a new board type. After a bit of googling I found out that there is an avrdude.conf file. I added a new chip configuration identical to the 168 except for the different signature ID and called it 168p.

I added 2 boards to the boards.txt file. One for previous DAGU products using the 168p (5V, 16Mhz) and one for the Micro Magician which uses the 168p at 3.3V, 8MHz.

Using the Arduino IDE 0018 & 0022 (with updated avrdude file) and the new Arduino 1.0, I can now write the bootloaders to the boards using an Arduino Nano running the Arduino as ISP example code. I used the same bootloader normally used for the Arduino Nano w/ 168 for the Wild Thumper controller and the Arduino Pro Mini (3.3V, 8MHz) for the Magician.


Now I have a new problem.

While the new board options work fine for burning the bootloader, they don't work for uploading the code. Using a Wild Thumper controller with the 168PA chip as an example, I must still select "Arduino Nano w/168" as my board type for uploading the code.

Since I used the "Arduino Nano w/168" bootloader I assume I must now edit it to send the correct signature ID.

I have also found with the newest Arduino IDE that while it burns my bootloader quite happily it will not compile programs now that I have changed the board.txt and avrdude.conf files. It looks for a missing "pins_arduino.h" file.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
birdmun's picture

because I have arduino 1.0 installed on my system, I thought I would look around. It would seem there is a pins_arduino.h file in each of the variants folders. I wonder if the files are now calling to a directory that does not exist?

For example the micro variant:

C:\3d printer stuff\firmware\arduino-1.0\hardware\arduino\variants\micro

OddBot's picture

I think there have been some big changes in the Arduino IDE since the change to V1.0

For now I am concentrating on Arduino IDE versions 0018 - 0022 as all the original DAGU sample code was written using these versions. I am now trying to understand the bootloader make file. I think if I can make a suitable bootloader then this will solve my problem.

Unfortunately my programming skills are limited so, as with creating libraries, this is an uphill battle for me.

You probably are looking at this, but just in case, there's some documentation about writing a bootloader at http://arduino.cc/en/Hacking/Bootloader?from=Main.Bootloader

I don't use the Arduino IDE though, so take that for what it's worth. I could help with the makefile though. What is it you're having trouble with?


OddBot's picture

Thanks for your help but that tutorial is very much out of date as it referes to Arduino 009. I do know the basics. Currently I am trying to understand the "Make" files and how to use them for compiling the bootloader source code.

I've had a play with the new "opti-boot" bootloaders and would like to use them as they upload the program faster and give you an extra 1.5K program memory.