Μ: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
(→‎Boot Loader: µnucleus init)
Line 4: Line 4:


=== Boot Loader ===
=== Boot Loader ===
micronucleus is a 2Kb boot loader that provides a bit banged USB interface for directly updating user code without teh need for a programming device or dedicated USB to UART/Serial hardware.
https://github.com/micronucleus/micronucleus
https://github.com/micronucleus/micronucleus
A new ATtiny85 chip will need a time operation, i.e., be flashed with this bootloader. avrdude is a useful solution for this, and the following demonstrates such process with a Bus Pirate.
Check proper connectivity with chip
<pre>
<pre>
$ avrdude -c buspirate -P /dev/ttyUSB0 -p t85
Attempting to initiate BusPirate binary mode...
avrdude: Paged flash write enabled.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.09s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
avrdude done.  Thank you.
</pre>
Write file "t85_default.hex" to ATtiny85 via Bus Pirate connected at ttyUSB0
<pre>
$ avrdude -c buspirate -P /dev/ttyUSB0 -p t85 -U flash:w:t85_default.hex
Attempting to initiate BusPirate binary mode...
avrdude: Paged flash write enabled.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.09s
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "t85_default.hex"
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: writing flash (8124 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 8124 bytes of flash written
avrdude: verifying flash memory against t85_default.hex:
avrdude: load data flash data from input file t85_default.hex:
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: input file t85_default.hex contains 8124 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 51.02s
avrdude: verifying ...
avrdude: 8124 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
avrdude done.  Thank you.
</pre>


=== Datasheet ===
=== Datasheet ===

Revision as of 00:33, 3 October 2017

µ == Micro

ATtiny85

Boot Loader

micronucleus is a 2Kb boot loader that provides a bit banged USB interface for directly updating user code without teh need for a programming device or dedicated USB to UART/Serial hardware.

https://github.com/micronucleus/micronucleus

A new ATtiny85 chip will need a time operation, i.e., be flashed with this bootloader. avrdude is a useful solution for this, and the following demonstrates such process with a Bus Pirate.

Check proper connectivity with chip


<pre>
$ avrdude -c buspirate -P /dev/ttyUSB0 -p t85

Attempting to initiate BusPirate binary mode...
avrdude: Paged flash write enabled.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e930b (probably t85)

avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)

avrdude done.  Thank you.


Write file "t85_default.hex" to ATtiny85 via Bus Pirate connected at ttyUSB0

$ avrdude -c buspirate -P /dev/ttyUSB0 -p t85 -U flash:w:t85_default.hex 

Attempting to initiate BusPirate binary mode...
avrdude: Paged flash write enabled.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "t85_default.hex"
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: writing flash (8124 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 8124 bytes of flash written
avrdude: verifying flash memory against t85_default.hex:
avrdude: load data flash data from input file t85_default.hex:
avrdude: input file t85_default.hex auto detected as Intel Hex
avrdude: input file t85_default.hex contains 8124 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 51.02s

avrdude: verifying ...
avrdude: 8124 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)

avrdude done.  Thank you.

Datasheet

http://www.atmel.com/Images/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

Purchase

DUMPS

Probing a factory fresh unprogrammed chip with a Bus Pirate per http://dangerousprototypes.com/docs/Bus_Pirate_AVR_ProgrammingChange note change to "-p t85" vs example provided.

$ avrdude -c buspirate -P /dev/ttyUSB0 -p t85 -v

avrdude: Version 6.3, compiled on Aug  9 2017 at 12:31:56
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/neo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         AVR Part                      : ATtiny85
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash          65     6    32    0 yes      8192   64    128  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Attempting to initiate BusPirate binary mode...
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: Paged flash write enabled.
AVR Extended Commands not found.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF

avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
BusPirate is back in the text mode

avrdude done.  Thank you.



\/ Erronious dumps returning not exactly expected results \/


Probing with a Bus Pirate, and NO CHIP CONNECTED

$ avrdude -c buspirate -P /dev/ttyUSB0 -p attiny2313 -v

avrdude: Version 6.3, compiled on Aug  9 2017 at 12:31:56
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/neo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         AVR Part                      : ATtiny2313
         Chip Erase delay              : 9000 us
         PAGEL                         : PD4
         BS2                           : PD6
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        128    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      2048   32     64  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Attempting to initiate BusPirate binary mode...
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: Paged flash write enabled.
AVR Extended Commands not found.
avrdude: initialization failed, rc=-2
         Double check connections and try again, or use -F to override
         this check.

BusPirate is back in the text mode

avrdude done.  Thank you.


Probing with chip connected, and using wrong partno (-p attiny2313) per default example.

$ avrdude -c buspirate -P /dev/ttyUSB0 -p attiny2313 -v

avrdude: Version 6.3, compiled on Aug  9 2017 at 12:31:56
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/neo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         AVR Part                      : ATtiny2313
         Chip Erase delay              : 9000 us
         PAGEL                         : PD4
         BS2                           : PD6
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        128    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      2048   32     64  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Attempting to initiate BusPirate binary mode...
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: Paged flash write enabled.
AVR Extended Commands not found.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
         Double check chip, or use -F to override this check.
BusPirate is back in the text mode

avrdude done.  Thank you.