Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a diagnostic sketch #35

Open
chrisroos opened this issue Aug 1, 2012 · 4 comments
Open

Create a diagnostic sketch #35

chrisroos opened this issue Aug 1, 2012 · 4 comments

Comments

@chrisroos
Copy link
Contributor

Some of the problems we've seen have been to do with the printer sketch size. @lazyatom mentioned that some of these are to do with older arduino bootloaders. I'm wondering whether it'd be possible to create a simple sketch to determine the bootloader version, and potentially other useful stats about a user's arduino, that would better help us diagnose problems.

@lazyatom
Copy link
Contributor

lazyatom commented Aug 7, 2012

I've spent a bit of time looking into this, and have some middling results to report.

It doesn't look like there's a simple way of querying firmware, but I did find a sketch which will attempt to report this, along with some other hardware information. The software is at https://github.com/WestfW/fusebytes

Here's the output as running on an Arduino Uno (+ Ethernet Shield):

Compiled for ATmega328P
No Serial Number

Fuse bits (L/H/E): FF D6 FD
Lock bits:         CF
Signature:         1E 95 F (ATmega328P)
Oscal:             99

Fuse Low = 11111111 (FF)
           ||||++++______Low Power Crystal 8 - 16MHz
           ||++__________Start Up Time=11
           |+____________Clock Output Disabled
           +_____________(no divide)

Fuse High = 11010110 (D6)
            |||||||+______Reset to Bootstrap
            |||||++_______256 words (512 bytes)
            ||||+_________EEPROM Preserved on chip erase
            |||+__________Watchdog programmable
            ||+___________ISP programming enabled
            |+____________DebugWire off
            +_____________RST enabled

Fuse Extended = 11111101 (FD)
                |||||+++______Brownout at 2.7V

Lock Bits = 11001111 (CF)
            ||||||++______Read/Write to everywhere
            ||||++________R/W Application
            ||++__________No Write to Boot, no read from App

Bootloader at 0x7E00 is not readable

Unfortunately it doesn't seem to be able to report the bootloader version, and I get similar results when running the sketch on one of the Ardunio Ethernet boards we have.

However, I believe that AVRdude (the tool that the Arduino IDE uses to upload to the board) does report the firmware (bootloader) version. With a very simple sketch, and verbose upload output set on, we get this output from the Arduino Ethernet (trimmed for clarity):

Binary sketch size: 466 bytes (of a 32,256 byte maximum)
/Users/james/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Users/james/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/tty.usbserial-AH019MF0 -b115200 -D -Uflash:w:/var/folders/wf/207djqy16vg8pl218sym2xlc0000gn/T/build2546568795444960891.tmp/sketch_aug07b.cpp.hex:i 

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

         System wide configuration file is "/Users/james/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/james/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbserial-AH019MF0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200

<...snip...>

         Programmer Type : Arduino
         Description     : Arduino

<...snip...>

         Hardware Version: 3
         Firmware Version: 4.4
avrdude: Send: A [41] . [84]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 

The key part is the Firmware Version; 4.4 is, I believe, the latest Optiboot. Here's the output from the Arduino Uno:

         Hardware Version: 3
         Firmware Version: 3.3

According to this page:

This will show "3.3" for the old production version of optiboot (with the 28k bug), and "4.4" for the new production version of optiboot (with "most" bugs fixed.) It's slightly possible for an Arduino to be running a bootloader with the 28k fix and still be telling avrdude that it's running 3.3, if someone installed optiboot from the optiboot project source code, or from my Arduino fork, before that second commit was added (the 28k bug was actually fixed by the original optiboot author, JUST after the arduino team pulled the version they ended up using...)

I believe this does actually reflect the state of my Arduino Uno, as I upgraded the bootloader to work around the upload bug when I hit it.

So, perhaps rather than a sketch, we can devise a script that can use the avrdude tool in the Ardunio IDE to get this value?

@lazyatom
Copy link
Contributor

lazyatom commented Aug 7, 2012

The 3.3 vs 4.4 firmware version is also mentioned on this forum page.

@lazyatom
Copy link
Contributor

lazyatom commented Aug 7, 2012

@lazyatom
Copy link
Contributor

lazyatom commented Aug 7, 2012

If the ultimate resolution for people with problems is to upgrade their bootloader, and they can scrounge up a second Arduino, then this sketch might provide an easy way to perform the upgrade: https://github.com/WestfW/OptiLoader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants