~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to README

  • Committer: Selene ToyKeeper
  • Date: 2023-11-04 15:09:10 UTC
  • mfrom: (483.1.175 anduril2)
  • Revision ID: bzr@toykeeper.net-20231104150910-ddd3afw4nhfvof2l
merged anduril2 branch -> fsm, with *years* of changes
(this also means this code is now Anduril 2 instead of Anduril 1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
  ../../bin/flash-tiny25.sh crescendo.hex
116
116
 
117
117
Other useful tools are in bin/ too, so they might be worth a look.
 
118
 
 
119
 
 
120
ATtiny Series 1 (tiny1616) Support
 
121
==================================
 
122
 
 
123
In Feb 2022, avr-libc merged in new devices from Atmel's DFP (Device Family
 
124
Pack).  Depending on how recent your avr-libc package is, support may already
 
125
be included.  If not, the info below applies:
 
126
 
 
127
As of early 2021, the Debian packages for gcc-avr and avrdude do not include
 
128
support for the Tiny1 series chips.  Extra steps are required to get these
 
129
working.
 
130
 
 
131
  - Download the Atmel ATtiny Series Device Support pack:
 
132
    http://packs.download.atmel.com/
 
133
 
 
134
  - Unzip the pack somewhere on your build computer
 
135
 
 
136
  - Set ATTINY_DFP=/path/to/where/you/unzipped/the/pack
 
137
    (either in your shell, or in this repo's bin/build.sh script)
 
138
 
 
139
    export ATTINY_DFP=$HOME/src/torches/atmel/attiny-dfp
 
140
 
 
141
  - Make sure you're using gcc-avr 1:5.4.0+Atmel3.6.2 or newer.
 
142
    3.6.1 will not work.  It gives errors like:
 
143
    /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x80381e of anduril.elf section `.data' is not within region `data'
 
144
    This requires debian/bullseye or newer; buster has 3.6.1.
 
145
 
 
146
This should at least allow the code to compile.
 
147
 
 
148
Flashing:
 
149
 
 
150
PyMCUProg
 
151
 
 
152
The recommended solution is to use pymcuprog instead of avrdude.  Details are
 
153
still being worked out for how to actually set this up though.
 
154
 
 
155
AvrDude
 
156
 
 
157
Some extra steps are also needed to make flashing (avrdude) work:
 
158
 
 
159
  - Get an AVR jtag2 device.
 
160
    The one I'm using is: "HWAYEH AVR JTAG ICE Version 2.0"
 
161
    Connect the cables:
 
162
      - GND   = -
 
163
      - Vtref = +
 
164
      - nSRST = R (reset/UPDI)
 
165
 
 
166
  - Flash the jtag2 device with the relevant firmware:
 
167
    https://github.com/ElTangas/jtag2updi/tree/master/tools/avrjtagicev2
 
168
 
 
169
  - Get an avrdude.conf which supports jtag2updi:
 
170
 
 
171
    - Download avrdude.conf from https://github.com/ElTangas/jtag2updi
 
172
      and put it in /etc
 
173
 
 
174
    - Or grab the source and set an environment variable:
 
175
 
 
176
      cd ~/src/torches/avrdude
 
177
      git clone https://github.com/ElTangas/jtag2updi
 
178
      export AVRDUDE_CONF="-C$HOME/src/torches/avrdude/jtag2updi/avrdude.conf"
 
179
 
 
180
  - Maybe configure which USB serial port to use too:
 
181
    export AVRDUDE_TTYUSB="/dev/ttyUSB2"
 
182
 
 
183
Afterward, flashing should work.  You may need to unplug and replug the jtag2
 
184
USB device between uses though, since it may stop responding after each use.