Raspberry Pi Tips

Write program to AVR 1-Serires microcotroller using pyupdi

Raspberry Pi 3 Model B V1.2

  $ cat /etc/debian_version
  9.11

This is a procedure to write program to ATtiny3216 microcotroller using pyupdi

1. Check and change pyenv version

  $ pwd
  /home/pi/Arduino/build/

  $ pyenv versions
  system
  * 3.7.0 (set by /home/pi/Arduino/build/.python-version)

About pyenv, see Tips for setup pyenv

if your current directory is not on python 3.x.x environment,

  $ pyenv local 3.7.0

About pyupdi, see Tips for setup pyupdi

2: Connect USB cables (USB to FTDI serial) and (USB to FTDI UPDI) to RaspPi and check devices

  $ lsusb
  Bus 001 Device 006: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
  Bus 001 Device 005: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
  Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
  Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  $ ls /dev | grep -i usb
  ttyUSB0
  ttyUSB1

Confirm which USB port is assigned to UPDI. In this case, /dev/ttyUSB0 is assigned to UPDI.

3: Write program by pyupdi

$ pyupdi.py -d tiny3216 -c /dev/ttyUSB0 -b 115200 -f testInOutBoard_v2.ino.hex
Device info: {'family': 'tinyAVR', 'nvm': 'P:0', 'ocd': 'D:0', 'osc': '3', 'device_id': '1E9521', 'device_rev': '0.2'}
Programming successful