Dobrica Pavlinušić's random unstructured stuff
Arduino: Revision 12


Nano 3.0 Atmega328P-AU

http://dx.com/p/arduino-nano-v3-0-81877

but it doesn't work without bootloader

http://club.dx.com/forums/forums.dx/threadid.1185512
http://club.dx.com/forums/forums.dx/threadid.1218851

avrdude

dpavlin@blue:~$ avrdude -c buspirate -P /dev/ttyUSB0 -p m328p -v

avrdude: Version 5.11.1, compiled on Mar 24 2013 at 00:54:55
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

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

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Detecting BusPirate...
avrdude: buspirate_readline(): #
avrdude: buspirate_readline(): RE
avrdude: buspirate_readline(): Bus Pirate v3.b clone w/different PIC
avrdude: buspirate_readline(): Firmware v6.1 r1676  Bootloader v4.4
avrdude: buspirate_readline(): DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
avrdude: buspirate_readline(): http://dangerousprototypes.com
avrdude: buspirate_readline(): HiZ>
**
BusPirate: using BINARY mode
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as 7

avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as D9
avrdude: safemode: efuse reads as 7
avrdude: safemode: Fuses OK
BusPirate is back in the text mode

avrdude done.  Thank you.

bootloader update

http://dangerousprototypes.com/docs/Bus_Pirate_AVR_Programming

But which bootloader to use? (hint: not optiboot!)

dpavlin@blue:~$ ard-parse-boards nano328 bootloader.file
ATmegaBOOT_168_atmega328.hex

Ok, now flash it!

dpavlin@blue:~$ avrdude -c buspirate -P /dev/ttyUSB0 -p m328p -U flash:w:/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

Detecting BusPirate...
**
BusPirate: using BINARY mode
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
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 "/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex"
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% 56.84s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex auto detected as Intel Hex
avrdude: input file /usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 55.22s

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

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

After re-flash using bus pirate as ISP from Arduino GUI fuses changed:

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

add bus pirate to arduino GUI

http://taylanayken.wordpress.com/2011/05/04/using-bus-pirate-with-arduino-ide/

root@blue:~# grep buspirate /usr/share/arduino/hardware/arduino/programmers.txt
buspirate.name=The Bus Pirate
buspirate.communication=serial
buspirate.protocol=buspirate

Simulators/Emulators

emulino

console output, somewhat large network on github

https://github.com/ghewgill/emulino

simuino

ncurses interface, single stepping, doesn't have source control link, can't compile it

http://code.google.com/p/simuino/