Sunday, 1 June 2014

Using an ATMega128 in place of an ATMega165

Since the code requirements for our board game project is really very simple, the actual type of mcu used doesn't really matter than much. We went with the ATMega165 simply because it had 64 pins, 53 i/o lines and, according to the intertubes, could be programmed via the Arduino IDE.

As it turns out, it can't, without a lot of buggeration.
And to add insult to injury, after designing a simple test programmer board, it doesn't use the MISO/MOSI lines for programming, but the PDI/PDO lines.

So we've got some chips we can't compile code for through Arduino (but did get some code up and running quite quickly using Atmel Studio 6) and even when we do, they're a pig to burn the code onto (a lot of programmers, including our USBTiny don't support the ATMega165 by default).

On a completely unrelated note (at the time) an email arrived this morning, from Vlad - the author of Oshonsoft PIC simulator.

It was a thank you note for supporting the project (we have licences for the entire range of Oshonsoft products) and a note to say that there were some updates in the pipeline. And then we got to thinking.....

Many years ago, we worked on a project called Shoeduino.
This was an Arduino-based shoe-shaking project, that used an AVR328; at the time we actually wrote the code for it using the Oshonsoft AVR simulator rather than the Arduino IDE. The code was dumped onto the chip using a USBTiny programmer and no bootloader - the whole project worked perfectly, without even having to invoke the Arduino IDE. Perhaps there's another way.....

It turns out that the AVR Simulator supports the ATMega128 chip (though there's no sign of the ATMega165 chips we went and bought the other day!) and a super-cheap programmer off eBay supports programming of the ATMega128.

So the new chips are on order from Farnell (they're quite pricey, at about £4 each, but can be sourced much more cheaply in bulk) and the programmer is awaiting delivery. The code has been cranked out in Oshonsoft AVR simulator, so all that we need to do now is design a breakout board for the ATMega128 to make sure we put the programming pins in the correct places this time!

As Steve said the other day, we'd hate to see the spreadsheet for the bill of materials for the development of this board game idea! Maybe it's time to start putting some of these over-ordered parts back on eBay!