Self Bootloading Mod-Chip

I would like to add an attiny chip to the flex-circuit mod chip, the theory is to add a small second MCU that can be triggered by an application to reset and then burn the bootloader onto the Arduboy.

The advantage of this is you don’t need an additional programmer and go through those steps. You would just have to solder the chip on and then run a specific hex file.

Looking at this right now as a starting point:

This is using it as a usb programmer. I think it could be done with the 85 which has 8k of program memory, so 3k to store the bootloader and a remaining 5k to actually write the bootloading script.

@Mr.Blinky Any thoughts on this?

1 Like

If you’re going to keep cramming stuff in you might aswell just build a new Arduboy with everything onboard.


If you’re going to do that, why not just make it a proper co-processor for the Arduboy?

Then you could have the ATtiny be resonsible for flashing games from the FX chip onto the 32u4, and either have the ATtiny run an ‘operating system’ that could be responsible for other things (like how the Nintendo 3DS works*) or simply offload some computations to it, e.g. handling 3D calculations, being responsible for streaming sound.

One of the issues with sound is that when the sound chip needs new data it triggers an interrupt which means the 32u4 then has to stop whatever it was doing and spend some time feeding the sound chip some more data.
With an ATtiny coprocessor being responsible for that instead,
the main processor wouldn’t have to be interrupted to feed the sound chip more data, so having sound in games wouldn’t eat as many CPU cycles.

Of course, managing a coprocessor isn’t easy.
There’s concurrency issues, synchronising issues, the question of who is controlling who, which chip controls what peripherals, data transfer speeds and possibly other stuff I’m not aware of or have forgotten.

* From Wikipedia:

One processor core is dedicated to games and applications, while the other core is exclusive to the operating system, enabling multitasking and background tasks.

Interesting idea It would make it easy to upgrade.

Already imagining a ‘press and hold reset button for 3 seconds to update/recover Arduboy and bootloader’ feature :slight_smile:

I totally dig that. but for good co-processing would require a new board design. Where the idea here is to make an easy flexboard upgrade for existing Arduboys.

But adding a Programmable sound generator to the flexboard design should be doable I think.

I’ll put the chip on there with the purpose of flashing the bootloader, and of course the user is welcome to change the operation of the attiny after to be a sound co-processor.

Even doing this is gonna be a challange for space constraints within the back case, I think it is possible.

Let me have a think and try to make sure that the attiny can also be re-programmed by the Arduboy without an external programmer. ( I think I just have to tie the reset pin of the attiny to an “open” gpio, of which I think there is only 2 choices now)

Maybe need to upgrade the attiny85 to attiny84 (or any atmega) with more GPIO pins then.

Finally back on this a bit, looking at datasheets.

I’m looking at the attiny 84 in the qfn package to carry the bootloader flashing instructions.

So now the next step is to order one up, and write the code to flash the bootloader.

@Mr.Blinky it has been some time do you want to join forces on this?

This will be like a dev kit 2.0 I guess?

1 Like

Was wondering when you’d ask :smiley:

lately i’ve been looking at AVR-AY and wondered if that could be built into the mod chip as well :slight_smile:

I guess for the reason that It has more GPIO pins then the 85. Did you choose it for a specific other reason? There’s also the 1634 which comes in the same/similar package and looks to be cheaper and has a bit more flash (more flash means more possibilities)

Send me one now! :stuck_out_tongue:


Well, actually, origonally yes, but I just realized the QFN package of the 85 is the same size.

But now I just found this:

Those all could be options.

AND they are cheaper! Looking at the ATtiny816 now!

…if cost is the deciding factor, then get one of these ($0.20 - $0.40 USD each, and it would be like having a dual-core Arduboy):

Haha that would be funny.

I don’t see a QFN package though, which is necessary for the thickness. :frowning:

Now I just gotta figure out the schematic on how everything can talk to each other on the SPI bus.

New generation of attinies and comes in tiny 3x3mm. for the 4cents extra I’d go for the 1616. so theres 8K extra for possible ‘info sketch’

Too bad they don’t come in smaller packages

This is what I had sofar:

* GPIO supporting pin change interrupt

But the newer attinies use the new UPDI programming interface that uses a single pin for programming. so it would probably be something more like:

GPIO*      <->    ATMEGA32U4_RESET
* GPIO supporting pin change interrupt

The idea here is that the GPIO pin will wake up the mod chip from sleep when arduboy reset is pressed then measure the duration of reset being pressed if it’s longer then the threshold it will do it’s ISP thing and otherwise goes back to sleep.

Tx pin of Arduboy is connected to UPDI to be able to update the mod chip. The Arduino IDE doesn’t configure the Tx pin normally so it should be fine.

Oh snap, might it be better to stick with the attiny84/5 to keep the SPI programming?

Well there are some UPDI projects out there for reference so that shouldn’t be an issue. but when sticking with SPI the programmer code could both be used for the mod chip as for arduboy (Arduboy updating the MOD chip).

I looked a bit more into the new attinies. the idea of adding AVR-AY wont work as they do not seem to have the same PWM capabilities as atmega. so that idea goes down the drain.

I think the price should decide to keep the flexboard low.

Digikey lists atmega85 at 71cents and attiny45 @ 55 cents

Attiny45 it is!

Here’s your wiring help then :slight_smile:

And I’ve got a challenge to write the flasher in 1K :grin:

Hows that look?

(I’m using the wrong part number for the flash chip, but it’s the same package and pinout)

And I don’t know if I need that series resistor for the reset line I realized?

Tomorrow I will buy some parts from china and buit / test it. I can give a help (at least) testing it.

@Mr.Blinky Curious, with this configuration how do you plan on triggering the bootloader code?

Will the Attiny be looking for a certain condition when it boots up?

And then the 32u4 will reset the attiny and? I guess wait for a certain string on the spi bus? I see we havent actually set a chip select for the attiny itself but i guess we can set it to be opposite whatever the signal is for the flash chip?

Here is what I’m thinking for the shape of the flex board (extremely rough draft)


It’s designed so you can just place it down on top of the battery and speaker and sorta “stretch” it to fit a little bit if you have to.

The flash chip will sit right above where the USB connector is and the attiny will be over to the right.

The hope is you can place it right on top of the speaker wires and everything will still fit.

The dimensions will take some fine tuning to get quite right.

I also think we probably have to switch to SCL and SDA so that it’s easier to reach without having to move the battery.



When Power is switched on or the reset button is pressed. The attiny will measure how long Arduboy reset is active. When it is active longer then the threshold value (2 seconds) it will start the bootloader update mode.

When reset is not active long enough the attiny will go into sleep mode. The attiny will be able to wakeup from sleep using pin change interrupt on the gpio pin that monitors the arduboy reset pin.

there is no need for chip select pins. Arduboy reset, sck,miso,mosi are used for ISP programming Arduboy. Tx,sck,miso,mosi are used for ISP programming the attiny. (makes it possible to ship the flexboard with blank chips)

I recommend to use round corners on the flexboard so the risk of tearing is reduced. the attiny part is sitting right at the edge of battery area you might wont to lower that part a bit more.

Don’t know if it’s possible but if you rotate the flash 90 degrees you could maybe put the attiny next to it in which case you have less tracks running to the pads. Also recommend to make the tracks as wide as possible and make them narrow where they have to be

Shouldn’t be a problem as long as you pick SDA for flash chipselect

1 Like