Attiny1616 and UPDI followup

2025-04-10 ยท 515 words ยท 3 minute read

In my last post Attiny1616, PlatformIO and UPDI I descriped how I use UPDI to programm an Attiny1616 using platformio .

Since then a few things happened and I thought its a good chance to write up my improvements.

UPDI circuit ๐Ÿ”—

I realized that it would come in handy if I could program my boards with no 24VDC supply connected to the borad, just the 5V from USB. So I put in a diode in order to supply the 5V from USB to the uC.

Writing fuses ๐Ÿ”—

I use Adafruit’s NeoPixel library which works great. But it has a check that prevents it from running above 19Mhz. The Attiny1616 runs at 20Mhz by default.

So I had a hard time figuring out how to set the correct fuse that switches the internal oscillator to 16Mhz. The fuse responsible is fuse2/osccfg which needs to be set to 0x01 in order to run the CPU at 16Mhz.

I finally figured out that avrdude is the only way that worked for me to write the fuse.

My platformio.ini now looks like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[env]
platform = atmelmegaavr
board = ATtiny1616
framework = arduino
board_build.f_cpu = 16000000L
monitor_speed = 115200
lib_deps = hideakitai/Debouncer@^0.3.2
    adafruit/Adafruit NeoPixel@^1.12.4

[env:updi]
; t1616 = ATtiny1616
; fuse2 -> 0x01 = 16Mhz (0x02 = 20Mhz)
upload_command = avrdude -c serialupdi -p t1616 -P $UPLOAD_PORT -b $UPLOAD_SPEED -U fuse2:w:0x01:m -U flash:w:$SOURCE:i

A simple pio run -t upload sets the fuses and writes the firmware to the Attiny.

Power supply and outputs ๐Ÿ”—

In my last project I used some really nice ICs for the first time with wich I’m really happy.

Power supply ๐Ÿ”—

I almost always supply my boards with 24VDC, so I need a DC-DC converter that can handle this input voltage. Also I hate it when I need a ton of additional parts, such as inductors, capacitors and so on that need to be calculated in order to work properly. Ideally its a self contained module or IC. I know there are modules from Recom for example, but they are quite large and expensive.

So on my search for something better, I stumbled up on the TI TPSM84209RKHT

Its a 4.5-V to 28-V input, 1.2-V to 6-V output, 2.5-A power module in a 4.5-mm ร— 4-mm ร— 2-mm QFN Package that needs only a few cpacitors and resistors as additional components.

combined with a polyfuse and a FET for reverse polarity protection, this is going to be my go to solution for the future!

And finally, JLCPCB has this part in stock for 4USD!

Outputs ๐Ÿ”—

In the past I often used FETs for driving higher loads, but this has its own disadvantages.

I found the TI TPS274160ARLHR which 4-channel high-side switch.

To be more precise its a 36-V, 160-mโ„ฆ, 1.35-A, 4-ch, Industrial high-side switch with adjustable current limit.

It comes in a QFN28 package and needs no additional components appart from 10k resistors in front of the enable inputs and a reistor for the current limit.

Its available at JLCPCB for just 2.5USD