Pages: 1 ... 21 22 [23]   Go Down
Author Topic: New optiboot; beta testers welcome...  (Read 96330 times)
0 Members and 1 Guest are viewing this topic.
SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 124
Posts: 6649
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want conditionally bypass the optiboot. At the start of the optiboot I do a check, and if negative I want to exit optiboot properly and I want enter the actual application.
You should be able to add your check to the "no wait mod" section of main():
Code:
  // Adaboot no-wait mod
  ch = MCUSR;
  MCUSR = 0;
  if (!my_run_bootloader_check() || !(ch & _BV(EXTRF))) appStart(ch);
You should be careful that your check does not do much chip configuration beyond the reset state.

Quote
I want add few hundreds bytes of code, placed before the actual optiboot show starts (no impact on the optiboot). The stuff compiles about 670bytes today, it will grow.
Q: provided my code works fine, is the only thing to consider the change of the fuses (to 512 words) and its starting address in boards.txt, or shall I be aware of something other as well?
You'll also need to change the --section-start setting(s) in the optiboot Makefile, and the max sketch size in boards.txt  If your code is 670 bytes, and optiboot is 500 bytes, then a 1k bootloader space won't be enough.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2066
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If your code is 670 bytes, and optiboot is 500 bytes, then a 1k bootloader space won't be enough.
It is 670 optiboot inclusive. Thanks!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need to get soft UART working with optiboot (to eventually re-assign TX and RX pins). For now, though, I'm using all default settings with the exception of this change to the make file:

Code:
atmega328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DSOFT_UART'

The addition of the -DSOFT_UART should enable the soft UART, but after burning the bootloader, I can no longer upload sketches. When I compile without the soft uart option, the bootloader works fine. Also, it seems strange to me that the size of the two bootloaders differs by less than 10 bytes. I would think that the addition of the soft uart would increase the size of the bootloader significantly. Thanks.

@NATO or westfw

Have you finally got soft UART working ?

I need to re-assign hardware UART TX and RX pins on an atmega328p to read a very slow signal (1200 bauds).

With Optiboot 5.0a, I've :
1. Changed pin_defs.h :
Code:
#define UART_TX_BIT            7
#define UART_RX_BIT            6

2. Built it :
Code:
make atmega328 SOFT_UART=1 BAUD_RATE=19200

I use Arduino IDE 1.0.5 to flash Optiboot with USBtinyISP.
Content of boards.txt :
Code:
uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200

uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F

uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

I use avrdude version 5.11.1.
Code:
avrdude -C/home/jm/arduino-1.0.5/hardware/tools/avrdude.conf -v -v -v -v -F -b19200 -patmega328p -cstk500v1 -P/dev/ttyUSB0 -Uflash:w:sketch.cpp.hex:i

The flashing process starts :
Code:
...
Writing | #                                                  | 1% 0.08savrdude: Send: U [55] @ [40] . [00]   [20]
Writing | #                                                  | 2% 0.17savrdude: Send: U [55] . [80] . [00]   [20]
...
and stops very quickly :
Code:
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

I've also tried to use other baud rates (38400 and 57600) w/o success.

Thanks in advance for your help.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 186
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have posted this in another thread but I thought I'd also post this here.

I have got he Optiboot boards to appear in the Arduino IDE.

What I did was create a Hardware folder in my sketches folder. Then added an optiboot folder which contains two folders bootloaders and cores and also boards.txt.
I then just copied everything into both bootloaders and cores - I guess these ought to be split out some how. I have NOT had chance to test this yet...

So I have

[ArduinoSketches]
    |
    + optiboot
          |
          + /hardware
               |
               + boards.txt
               |
               + /cores
               |   |
               |   + [files]
               |
               + /bootloaders
               |   |
               |   + [files]
               |

[editied becaue I missed out the optiboot folder]
« Last Edit: July 19, 2013, 01:29:50 am by sirch » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 186
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

instead of copying the "cores" directory, you can reference the original Arduino cores directory using the following line in boards.txt:
Code:
arduino_optiboot.build.core=arduino:arduino

"arduino_optiboot" has to be replaced by your own prefix
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to be a betatester for a optiboot that works for the Arduino Mega 2560 and maybe solves my problem with wireless programming.

I got problems with wireless programming Arduino Mega 2560. It is working with Arduino UNO.

I was suggested to use Arduino IDE 1.0.5.
The Arduino IDE 1.0.5 did not change a thing..

I tried to add all loging that is availabe and created this loggs:

Programming with Arduino IDE 1.0.5 and the USB cable connected as COM71 and uploading Blink.ino:
Code:
Binary sketch size: 1 632 bytes (of a 258 048 byte maximum)
C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P\\.\COM71 -b115200 -D -Uflash:w:C:\Users\JOHNNY~1\AppData\Local\Temp\build3777620201733586904.tmp\Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM71
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [0b]
avrdude: Recv: . [0e]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [08]
avrdude: Recv: A [41]
avrdude: Recv: V [56]
avrdude: Recv: R [52]
avrdude: Recv: I [49]
avrdude: Recv: S [53]
avrdude: Recv: P [50]
avrdude: Recv: _ [5f]
avrdude: Recv: 2 [32]
avrdude: Recv: t [74]
avrdude: stk500v2_getsync(): found AVRISP programmer
         AVR Part                      : ATMEGA2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
(some data deleted)

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86]
avrdude: Recv: . [1b]
avrdude: Recv: . [02]
(deleted alot ocf programmer data)
avrdude: Recv: . [0e]
avrdude: Recv: . [13]
avrdude: Recv: . [00]
avrdude: Recv: . [12]
### | 100% 0.26s

avrdude: 1632 bytes of flash written
avrdude: verifying flash memory against C:\Users\JOHNNY~1\AppData\Local\Temp\build3777620201733586904.tmp\Blink.cpp.hex:
avrdude: load data flash data from input file C:\Users\JOHNNY~1\AppData\Local\Temp\build3777620201733586904.tmp\Blink.cpp.hex:
avrdude: input file C:\Users\JOHNNY~1\AppData\Local\Temp\build3777620201733586904.tmp\Blink.cpp.hex contains 1632 bytes
avrdude: reading on-chip flash data:

Reading | avrdude: Send: . [1b] . [17] . [00] . [05] . [0e] . [06] . [80] . [00] . [00] . [00] . [81]
avrdude: Recv: . [1b]
avrdude: Recv: . [17]
avrdude: Recv: . [00]
(deleted olot of verifying data)
avrdude: Recv: . [ff]
avrdude: Recv: . [cf]
avrdude: Recv: . [0d]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: 3 [33]
### | 100% 0.19s

avrdude: verifying ...
avrdude: 1632 bytes of flash verified
avrdude: Send: . [1b] . [1f] . [00] . [03] . [0e] . [11] . [01] . [01] . [18]
avrdude: Recv: . [1b]
avrdude: Recv: . [1f]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [0e]
avrdude: Recv: . [11]
avrdude: Recv: . [00]
avrdude: Recv: . [19]

avrdude done.  Thank you.

Programming with Arduino IDE 1.0.5 and the SRF/XRF connected as COM70 and uploading Blink.ino:
Code:
Binary sketch size: 1 632 bytes (of a 258 048 byte maximum)
C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2560 -cwiring -P\\.\COM70 -b115200 -D -Uflash:w:C:\Users\JOHNNY~1\AppData\Local\Temp\build3777620201733586904.tmp\Blink.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM70
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: wiring_open(): releasing DTR/RTS
avrdude: wiring_open(): asserting DTR/RTS
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14]
avrdude: Recv:
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

By looking at this the avrdude si sending 1b,01,00,01,0e,01,14 and waits for a
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [0b]
avrdude: Recv: . [0e]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
...
If it dont receive this it tries again 5 times and report this message
Quote
avrdude: stk500v2_ReceiveMessage(): timeout

This errormessage can be found all over internet with the Arduoino Mega 2560.

This page is Arduino troubleshooting:
http://arduino.cc/en/Guide/Troubleshooting#toc1

On this page
Quote
The Arduino Uno and Mega 2560 use standard drivers (USB CDC) provided by the operating system to communicate with the ATmega8U2 on the board. Other Arduino boards use FTDI drivers to communicate with the FTDI chip on the board (or in the USB-serial convertor).

I have used the Arduino UNO and it is working but Not the Arduino Mega 2560!

The differance is that the Arduino UNO uses protocol Arduino (uno.upload.protocol=arduino in Board.txt)
 while Arduino MEGA 2560 uses protocol wiring (mega2560.upload.protocol=wiring in Board.txt).

Another thing that ias different is that Arduino UNO uses a optiboot bootloader
(uno.bootloader.path=optiboot and uno.bootloader.file=optiboot_atmega328.hex in Board.txt)
while the Arduino MEGA 2560 uses stk500v2
(mega2560.bootloader.path=stk500v2 and mega2560.bootloader.file=stk500boot_v2_mega2560.hex in Board.txt)





Logged

SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 124
Posts: 6649
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Optiboot would need a significant re-write in order to work on the 2560, because the upload "protocol" that optiboot implements (stk500v1) only works for flash memory sizes less than 64k words (and the 2560 has 128k words.)

It would probably be easier to "fix" the stk500v2 bootloader.  It currently looks like it is not receiving ANYTHING on your wireless connection, which ought to be somewhat easy to figure out...

Unfortunately, I don't seem to have a lot of interest in "big" Arduinos.  My poor MEGA (1280 version) sits around neglected while I fiddle with 8k chips like the atmega8...
Logged

Pages: 1 ... 21 22 [23]   Go Up
Jump to: