Messing with drivers and peripherals of the attiny85
-
Required Software
-
Required Hardware
- ATtiny85 Development Board
- Arduino Uno
- USB-A to USB-B cable
- MCU jumper wires
- Create own linker script for this MCU
- Create own initialization function for this MCU
- Create own BSP for this MCU based on datasheet (no Arduino / AVR helper functions!)
To get the toolchain to work on this repo, you need to install the Arduino IDE and add the following to your path:
- C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
- C:\Program Files (x86)\Arduino\hardware\tools\avr\etc OS equivalent also applies
> cmake -DCMAKE_BUILD_TYPE:STRING=Debug -Bbuild -G Ninja
> cd build
> ninja
Download the AVR 8 bit toolchain for windows (or your OS). Extract the zip somewhere and add the following to your PATH variable (path here may differ depending on where you download it.)
- C:\dev\avr8-gnu-toolchain-win32_x86_64\bin
This gives you access to the avr-gdb
executable , which is no longer packaged with the Arduino IDE install.
Next, in your clone of dw-link
, you will want to upload the file dwlink/dwlink.ino
to your Arduino Uno using the IDE.
Next, make the following connections from the Arduino Uno to your ATTiny85 dev board using the jumper wires:
Signal | Arduino Pin | ATtiny85 Pin |
---|---|---|
Ground | GND | GND |
SDK | D13 | P2 |
MISO | D12 | P1 |
MOSI | D11 | P0 |
VCC | D9 | VIN |
Reset | D8 | P5 |
Now, when plugging in your Arduino, it should show up as a COM port on your device manager, and you should connect to it like so from the command line:
> avr-gdb -b 115200 build/main.elf
(gdb) target remote COM[X]
(gdb) load
(gdb) break main
(gdb) c
NOTE: Make sure that the "X" above is a COM number below 10, avr-gdb
has had issues finding the COM number when it is above 10.
- Drivers for dev board
- https://github.com/digistump/DigistumpArduino/releases
- Digistump.drivers
- Dpinst64.exe
- Shows up as “microchip tools” -> digispark bootloader!
- In Arduino, download digispark boards
https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/all https://learn.sparkfun.com/tutorials/pocket-avr-programmer-hookup-guide#using-avrdude-via-command-line https://shallowsky.com/blog/hardware/attiny85-c.html
Connect to the tiny board with the command
> avrdude -c usbtiny -p attiny85
Loading and flashing with ATtiny ISP programmer: https://electronut.in/getting-started-with-attiny85-avr-programming/