Skip to content

Embedded programming

This week we had to study a microcontroller datasheet.. Surprinsingly I read a bit a the documentation about the ATTiny 412, I used the chip pinout to remind the wiring of everything.

On my last board I forgot to wire the button to the microcontroller.... I had to mill an new board fixing that.

I had a lot of trouble programming my new board even if the first board was pretty easy to programm… Indeed I soldered a wrong board… Attiny85 instead of 412 (Thay mixed in my zip bag !)

After changing to the right board, I soldered everything and it blinked ! Here is the workflow I used :

Using Arduino and PyUPDI

I first used megaTinycore from SpaceConde on Github. I used his board package to programm my board using Arduino IDE. To install megaTinycore you have to add a new entry in the Arduino settings.

At that time I didn’t figure out why my board wasn’t working properly so I tried to program an ATtiny85 as a Attiny 412… Anyway, As PyUpdi wasn’t working, I wired an arduino nano to test the JTAG programming methods

It didn’t worked … As expeced. I then tryed to figure out what was going on using a multimeter to check the continuity of my board

I figure out the microcontroler was wrong just here at 2am ! :D I then came back to PyUPDI with a working board

To programm the board, you have to install megaTiny Core, then you’ll have access to the Attiny412 board in the board list. I didn’t change the settings but I explore everthing setting while searching how to program my wrong chip…

#define PIN_BUTTON 0
#define PIN_LED 1

#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2); // RX, TX

void setup() {

 pinMode(PIN_LED, OUTPUT);


  mySerial.println("Ready to go...");

void loop() {

    mySerial.println("Button pressed !");
    digitalWrite(PIN_LED, HIGH);
    mySerial.println("Nothing happennig...");
    digitalWrite(PIN_LED, LOW);



Unfortunately that code didn’t Code… But this one does ! I need to figure out why =)

#include <SoftwareSerial.h>

#define LED_PIN 1
#define BUTTON_PIN 0

#define RX_PIN 3
#define TX_PIN 2

SoftwareSerial softSerial(RX_PIN, TX_PIN);

void setup() {

  pinMode(LED_PIN, OUTPUT);

void loop() {
  softSerial.println("Hello !");


And It worked !

Last update: September 23, 2021