Monday, November 12, 2012

Arduino Nano v3.0 bootloader

Last week I finally received a package from DX.com containing the Arduino Nano compatible board I've ordered nearly 2 month ago. For the price I've paid, just over $13, I wasn't expecting much and had already considered the money lost somewhere between China and Portugal.
Inside the package was the board, a long and thick USB cable and a small breadboard I've ordered with the Arduino. A long thread runs on the DX forum on the legitimacy of the name Arduino on these boards. That's another story.

I jumped to my netbook and downloaded the latest software package from arduino.cc. While downloading, I tried to mount the tiny board on the breadboard, just to find that either the board pins are too thick or the breadboard holes are too tight. Afraid of bending the pins or worse, breaking the board, I left it half way inserted.


In a hurry I connected the board to the netbook, which is running Windows7, by the way, and the USB to Serial drivers were installed straight away from Windows Update. So far, so good.
On connection, a bright tiny green LED came on. As the board comes with zero documentation, I didn't know exactly what this meant. Green is good, so move on.

Nano schematics: http://arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf

After unzipping the package, a massive 90 MB file, I launched the Arduino IDE. This is very basic, and there's not much to configure, other than the COM port, the board type and the programmer which at that moment I hadn't realized if it would be necessary.
From then on, my patience was put to a test. Communicating with the board was a no go. No matter what setting I fiddled with, AVRDude, the program that talks to the micro, refused to establish a connection.

After hours of hell on earth checking every reference to this fact on Google, I decided that a new boot loader was the way to go. The boot loader basically is a piece of code that sits in the micro memory, taking about 2KB of space, and negotiates the upload of programs to memory, with the help of AVRDude or similar. The boot loader executes after the micro resets. It then waits for a few seconds for the serial lines to be active and to receive a predefined sequence of bytes indicating that a program is about to be upload.

The bad news were that my Nano board had come with a defective boot loader. There are two LEDs on the board, marked TX and RX, that blinked three or four times when the Upload button was clicked on the IDE. A few seconds later a message was displayed reporting there was a synchronization problem.
After installing AGG Software excellent tool Advanced Serial Port Monitor, I quickly found out that all attempts made by AVRDude to contact the Nano were being ignored.
No problem. The solution was on arduino.cc forums. A parallel port programmer is all you need to burn a new boot loader.

Parallel programmer on arduino.cc: http://arduino.cc/en/Hacking/ParallelProgrammer

A few resistors and some pieces of wire later, a programmer was ready to run.


Now, things can't be that easy. Although the programmer was built to the specs, failure hunted me back when trying to burn the boot loader, no matter what I did.
In total despair, I turned to the parallel port itself. In a rare moment of lucidity, I decided to look at the BIOS of the laptop. The port was set as bidirectional, and that sounded right. To fight the odds, I have decided to change the port setting to EPP (Enhanced Parallel Port). Reboot applied and voilá!
The Arduino IDE uploaded the boot loader in a few seconds, with the RX/TX LEDs happily blinking.
A minute later I was uploading my "blink" sketch to the Nano board.
Ufff!

6 comments:

  1. were u using the giveio bootloader burner thing or the actual arduino IDE to burn the bootloader onto the board?

    ReplyDelete
  2. Hi! I've used the Arduino IDE. The cable was scavenged from an old PC serial port extension.

    ReplyDelete
  3. So did u not even bother with the giveio program cause im having no luck with it, i will try doing it with the arduino IDE on monday. Thanks for all the help, it is really appreciated (bought 4 of the dam things :-p )

    ReplyDelete
  4. I have tried every BIOS setting and combination of settings there is and every time i get
    avrdude: AVR device not responding
    avrdude: initialization failed, rc=-1
    avrdude: Yikes! Invalid device signature.
    avrdude: Expected signature for ATMEGA328P is 1E 95 0F

    I have the board set to Arduino Nano w/ ATmega328
    and programmer set to Parallel Programmer.
    Is there anything else that you did differently cause im having not luck so far

    Thanks
    Steven

    ReplyDelete
    Replies
    1. Have you checked your cable with a multimeter?
      I can post another picture of the cable and the 25 pin D connector.

      Delete
  5. The Wizard of Odds, Slot machines with payouts - JTHub
    The 안성 출장마사지 Wizard of 당진 출장안마 Odds is a slot machine by Bally. It 속초 출장마사지 has 6 남원 출장안마 reels and 96.5% RTP. With a maximum payout of $1000,000, 제주 출장안마 it is considered a medium variance slot and

    ReplyDelete