Arduino Forum

Using Arduino => Microcontrollers => Topic started by: dakky on Apr 27, 2015, 09:54 pm

Title: burning optiboot and uplaoding sketches afterwards
Post by: dakky on Apr 27, 2015, 09:54 pm
Hello

I guess I need some help ;)

what do i want to do? I Want to use optiboot on my arduino uno R3 using usbtinyisp and upload sketches to ne newly flashed chip.

Env:
arduino sotware (1.6.1 via homebrew)
MacOSX

what have i done?
downlaoded optiboot from github and extracted files to hardwarefolder:
Code: [Select]
dakky@cyanide:~/Documents/Arduino/hardware$ tree
.
└── bootloaders
    └── optiboot
        ├── boards.txt
        ├── bootloaders
        │   └── optiboot
        │       ├── Makefile
        │       ├── Makefile.1284
        │       ├── Makefile.custom
        │       ├── Makefile.extras
        │       ├── Makefile.isp
        │       ├── README.TXT
        │       ├── baudcheck.c
        │       ├── boot.h
        │       ├── makeall
        │       ├── omake
        │       ├── omake.bat
        │       ├── optiboot.c
        │       ├── optiboot_atmega1280.hex
        │       ├── optiboot_atmega1280.lst
        │       ├── optiboot_atmega328.hex
        │       ├── optiboot_atmega328.lst
        │       ├── optiboot_atmega328_pro_8MHz.hex
        │       ├── optiboot_atmega328_pro_8MHz.lst
        │       ├── optiboot_atmega644p.hex
        │       ├── optiboot_atmega644p.lst
        │       ├── optiboot_diecimila.lst
        │       ├── optiboot_lilypad.hex
        │       ├── optiboot_lilypad.lst
        │       ├── optiboot_luminet.hex
        │       ├── optiboot_luminet.lst
        │       ├── optiboot_pro_16MHz.hex
        │       ├── optiboot_pro_16MHz.lst
        │       ├── optiboot_pro_20mhz.hex
        │       ├── optiboot_pro_20mhz.lst
        │       ├── optiboot_pro_8MHz.hex
        │       ├── optiboot_pro_8MHz.lst
        │       ├── pin_defs.h
        │       └── stk500.h
        └── examples
            ├── chaucer112k
            │   └── chaucer112k.pde
            ├── chaucer16k
            │   └── chaucer16k.pde
            ├── chaucer32k
            │   └── chaucer32k.pde
            └── chaucer64k
                └── chaucer64k.pde

9 directories, 38 files


This seems to be ok, although i still don't understand, how the ide looks for files like boards.txt, but whatever)

Now I can see some new boards in the board selection.
Problem 1: there i no board for the uno included in the boards.txt, so i added it myself with the help of google, comparing and guessing ;)

the result:
Code: [Select]
uno328po.name=[Optiboot] Arduino Uno
uno328po.upload.protocol=arduino
uno328po.upload.maximum_size=32256
uno328po.upload.speed=115200
uno328po.bootloader.low_fuses=0xff
uno328po.bootloader.high_fuses=0xde
uno328po.bootloader.extended_fuses=0x05
uno328po.bootloader.path=optiboot
uno328po.bootloader.file=optiboot_atmega328.hex
uno328po.bootloader.unlock_bits=0x3F
uno328po.bootloader.lock_bits=0x0F
uno328po.build.mcu=atmega328p
uno328po.build.f_cpu=16000000L
uno328po.build.core=arduino:arduino
uno328po.build.variant=arduino:standard


when trying to burn the bootloader i get the following error:
Code: [Select]
Error while burning bootloader.
java.lang.NullPointerException
 at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:288)
 at processing.app.Editor$48.run(Editor.java:2610)
 at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
 at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
 at java.awt.EventQueue.access$400(EventQueue.java:82)
 at java.awt.EventQueue$2.run(EventQueue.java:676)
 at java.awt.EventQueue$2.run(EventQueue.java:674)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Title: Re: burning optiboot and uplaoding sketches afterwards
Post by: dakky on Apr 27, 2015, 09:54 pm
srsly? a 9000 char limit? ...

Not quite helpful ....
after a while i gave up and tried avrdude, which seems to work:
Code: [Select]
avrdude -b19200 -c usbtiny -p m328p -v -e -U flash:w:bootloaders/optiboot/optiboot_atmega328.hex -U lock:w:0x0F:m

avrdude: Version 6.1, compiled on Mar 24 2015 at 20:48:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/usr/local/Cellar/avrdude/6.1/etc/avrdude.conf"
         User configuration file is "/Users/dakky/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
         Overriding Baud Rate          : 19200
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 020:013
         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 : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: erasing chip
avrdude: Using SCK period of 10 usec
avrdude: reading input file "bootloaders/optiboot/optiboot_atmega328.hex"
avrdude: input file bootloaders/optiboot/optiboot_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):

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

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against bootloaders/optiboot/optiboot_atmega328.hex:
avrdude: load data flash data from input file bootloaders/optiboot/optiboot_atmega328.hex:
avrdude: input file bootloaders/optiboot/optiboot_atmega328.hex auto detected as Intel Hex
avrdude: input file bootloaders/optiboot/optiboot_atmega328.hex contains 32768 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK (E:05, H:DE, L:FF)

avrdude done.  Thank you.


but i still would prefer the arduino IDE. Any idea what wrong there?

Ok but anyways: when i try to upload sketches with the help of my newly created board entry i get the following error:

Code: [Select]

Selected board depends on 'arduino' core (not installed).


Obviously an error in the boards txt?

so tldr;
how can i burn optiboot via usbtinyisp and use the board afterwards?
Title: Re: burning optiboot and uplaoding sketches afterwards
Post by: DrAzzy on Apr 28, 2015, 05:29 am
Optiboot is already used by default for the Uno. You can just use the normal board definition and burn bootloader.


I think both errors are related to 1.6.x vs 1.0.x differences.

Title: Re: burning optiboot and uplaoding sketches afterwards
Post by: nickgammon on Apr 28, 2015, 07:22 am
Quote
srsly? a 9000 char limit? ...
You can attach files to posts.
Title: Re: burning optiboot and uplaoding sketches afterwards
Post by: nickgammon on Apr 28, 2015, 07:23 am
Quote
what do i want to do? I Want to use optiboot on my arduino uno R3 using usbtinyisp and upload sketches to ne newly flashed chip.
Why? The Uno comes with Optiboot on it.
Title: Re: burning optiboot and uplaoding sketches afterwards
Post by: westfw on Apr 28, 2015, 09:20 am
Also, see the wiki: https://github.com/Optiboot/optiboot/wiki (https://github.com/Optiboot/optiboot/wiki)