V
20  
Tags
Attachments
Dobrica Pavlinušić's random unstructured stuff
Arduino


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

bus pirate

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

usbasp bootloader update

Sun Jan 12 11:27:34 2020] usb 8-2: new low-speed USB device number 4 using uhci_hcd
[Sun Jan 12 11:27:34 2020] usb 8-2: New USB device found, idVendor=16c0, idProduct=05dc, bcdDevice= 1.02
[Sun Jan 12 11:27:34 2020] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sun Jan 12 11:27:34 2020] usb 8-2: Product: USBasp
[Sun Jan 12 11:27:34 2020] usb 8-2: Manufacturer: www.fischl.de

dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp

avrdude: Version 6.3-20171130
         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/dpavlin/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbasp
         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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

flash ond nano bootloader

this is old nano bootloader, it doesn't work on 115200 but on 57600 with avrdude

dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp -U flash:w:/tmp/nuc/opt/arduino/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

flash optiboot

dpavlin@x200:~$ avrdude -v -patmega328p -cusbasp -U flash:w:/tmp/nuc/opt/arduino/hardware/arduino/avr/bootloaders/optiboot/optiboot_atmega328.hex

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/

emulare

Requres .net, need to test it with mono

http://emulare.sourceforge.net/

simavr

programming sketches

DebugWire protocol

http://www.ruemohr.org/docs/debugwire.html

Internal ADC reference

https://github.com/SensorsIot/ADC_Test/blob/master/ADC_Test.ino


 

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: