So this weekend I tackled a small project that seemed easy enough to pull off but for some random reason I had a hell of a lot of issues with… anyway we’re diving into the microcontroller programming, specifically focusing on the ATTinyX412 series as I aquired a bunch of them for smaller projects, I have used the Attiny85s for years and love them but they are a bit too expensive for what I do with them so I wanted to try the new thing UPDI.

ATTiny412 UPDI Programmer

So first thing, we need a programmer of some kind and a dedicated one at that!! Those small Attiny412s are easy on the outside but can be a real hassle when stuff is not working. So for me the solution is to solidify a programmer so I dont have to deal with the weird wiring issues and resistor value selection. The internet had a range from 4.7k to 47k and well lets just say I failed 4 attempts getting a blinking light on that chip as I got all the errors the Attiny Could throw at me one example being RSP_ILLEGAL_MCU_STATE.

Inital Steps

Before we jump into making the programmer, it’s a good idea to upgrade the bootloader on your Arduino Nano. This ensures compatibility and efficiency with newer arduino IDE, especially if you’re working with older Nanos.

Whats needed for that?

  • 2 Arduino Nanos
  • 6 Jumper wires
  1. Prepare the ISP Programmer Nano: First, you’ll need to upload the ArduinoISP sketch to one of your Nanos. This Nano will act as the In-System Programmer (ISP) for upgrading the other Nano’s bootloader.

  2. Connections: Using jumper wires, connect the ISP Programmer Nano to the Nano whose bootloader you’re upgrading. Here’s a simple pinout diagram for the connection:

Arduino Nano Bootloader Upgrade Pinout Diagram

ISP Programmer Nano to Target Nano: You can wire it up in two ways, either using the ICSP pins on the top of the nano or the actual same pins as the protocol as they are interconnected.

Nano1Nano2Nano2/ICSP
D10RST5 (RST)
D11D11 (MOSI)4 (MOSI)
D12D12 (MISO)1 (MISO)
D13D13 (SCK)3 (SCK)
GNDGND6 (GND)
+5V+5V2 (VCC)
  1. Burn the Bootloader: Open the Arduino IDE, select the correct board and port for the Nano you’re upgrading, and choose “Burn Bootloader” from the Tools menu. Voilà! The bootloader is now upgraded.

Making the Programmer for ATTinyX12

Whats needed for that?

  • 1 Arduino Nanos
  • Jumper wires
  • A 4.7kΩ resistor
  • ATTinyX12 series microcontroller (we’ll use ATTiny412 for this guide)

Attiny412 Pintout

Now, onto the exciting part—making the programmer!

Flashing jtag2updi onto the Arduino Nano

  1. Get the jtag2updi Firmware: First, download the jtag2updi firmware from GitHub.

  2. Upload the Firmware: Using the Arduino IDE, open the jtag2updi sketch and upload it to your Arduino Nano. This Nano will now act as a jtag2updi programmer.

Wiring Up for Programming the ATTiny412

To program the ATTiny412, you’ll use the Nano with jtag2updi and connect it to the ATTiny412’s UPDI pin. Here’s how:

  1. Connect D6 to UPDI: Use a jumper wire to connect D6 on the Nano to the UPDI pin on the ATTiny412. Insert a 4.7kΩ resistor in series with this connection to ensure proper communication.

  2. Power and Ground: Connect the 5V and GND pins from the Nano to the VCC and GND pins on the ATTiny412, respectively.

Here’s a simplified pinout diagram for programming the ATTiny412 using the jtag2updi programmer:

Arduino Nano to ATTiny412:

  • D6 (through a 4.7kΩ resistor) to UPDI
  • 5V to VCC
  • GND to GND

Attiny412 Pintout

Programming Your ATTinyX12

With everything wired up, you’re now ready to program your ATTinyX12 microcontroller.

  1. Select the ATTiny412 Board: Make sure you have the appropriate board packages installed in the Arduino IDE, and select the ATTiny412 (or your specific model).

  2. Choose the Programmer: In the Tools menu, select “jtag2updi” as the programmer.

  3. Upload Your Sketch: Write or open your sketch in the Arduino IDE and hit the Upload button. The IDE will compile and upload your sketch to the ATTiny412 via the jtag2updi programmer.

Programming ATTiny412 with Arduino Nano using jtag2updi

And there you have it! You’ve successfully upgraded your Arduino Nano’s bootloader and turned another Nano into a jtag2updi programmer for the ATTinyX12 series microcontrollers.



Buy Me a Coffee