Page 1 of 1

sketch upload fails with "programmer not responding"

Posted: Thu Jun 21, 2012 10:35 am
by blymn
I have recently bought an etherten for a datalogging project and was just trying to upload the "blink" sketch to it to check all is ok but the upload never happens and I receive the error:

avrdude: stk500_recv(): programmer is not responding

I am trying to do this on a NetBSD machine.

Things I can tell you are:

1) the board powers up, the leds come on and look normal
2) the serial port attaches and can be opened
3) I was able to upload a sketch to a leostick using NetBSD so I think my development environment is sound
4) under windows I was able to upload a sketch (this is the big one...)

A bit of googling around shows that there was a problem with the virtual com port under linux on the arduino UNO and to fix it you needed to update the firmware for the atmega8u2. Should I be thinking of doing this on my etherten? Is there a freetronics specific version or is the arduino version ok to use? I had a look at the circuit diagram and see that the reset for the atmega8u2 comes out on the ICSP header, I guess I will need a multimeter to work out which pin it is though... it would be nice if the silkscreen gave a hint to which was pin 1 (even a square pad would have been handy...)

Re: sketch upload fails with "programmer not responding"

Posted: Thu Jun 21, 2012 11:53 pm
by jebz
The OptiLoader looks good for updating the boot loader. It supports the Mega8 but I don't know about the Leo.
https://github.com/WestfW/OptiLoader

Re: sketch upload fails with "programmer not responding"

Posted: Fri Jun 22, 2012 10:04 am
by blymn
I don't care about the leo - that actually works. I don't think it is the bootloader that I am having problems with it is the firmware for the usb->serial interface on the etherten which is handled by the atmega8u2 which is a different beast _NOT_ the main CPU.

Re: sketch upload fails with "programmer not responding"

Posted: Sat Jun 30, 2012 1:04 pm
by blymn
OK, I managed to update the firmware on the atmega8u2. There were two tricky bits, one was finding a clear process for doing this and second was forcing the atmega8u2 into 'DFU' mode.

The first one was answered by: https://andrewmemory.wordpress.com/2011 ... sing-flip/ - in step 3 instead of cutting and pasting I just clicked on the "raw" button and did a save page as (text).

The second was getting the atmega8u2 into DFU (this is step 4 in the link above, do this instead) - if you hold the etherten with the ethernet socket at the top then the mega8 reset pin is the top most right hand pin on the 6 pin header right near the ethernet socket, the pin to the left of it is ground. I used a LED that was wired to a 2 pin dip header socket and plugged that over the aforementioned pins - if you do this right (i.e. cathode connected to ground) the led should glow weakly. I plugged my etherten into the usb on a windows machine, plugged the LED onto the atmega8u2 reset pins and then held the main reset button down. With the main reset still held down, I removed the LED from the atmega8u2 reset pin. It took me a couple of tries but then windows told me it had found new hardware, continue on with step 5 which is installing the DFU driver.

After a couple of attempts with the flip programmer I managed to get the firmware uploaded and verified (I had it fail verify a couple of times, I think in the end reloading the firmware file in flip did the trick). Once the board was reset it comes back as an arduino uno.

After doing this the board is much much better behaved under NetBSD. I still can't upload a sketch there (again, windows works fine) but avrdude now disconnects from the serial port properly instead of hanging and sometimes requiring me to disconnect the usb and reconnect to recover.

I guess the next step is to flash the bootloader, so the link jebz posted may come in handy after all. I should be able to use the leostick as my programmer.

Re: sketch upload fails with "programmer not responding"

Posted: Wed Jul 18, 2012 11:40 am
by blymn
I managed to get optiloader working eventually. The big gotcha using a leostick as host for optiloader is that the MISO/MOSI/SCLK pins are not connected to the "usual" arduino pins. In fact, the only place the appear is on the ICSP header AND the pin numbers are different (of course). The following diff made optiloader work with a leostick:

Code: Select all

--- optiloader.ino      2012-07-18 20:53:16.000000000 +0930
+++ ../optiLoader.pde   2012-07-18 20:51:49.000000000 +0930
@@ -50,15 +50,6 @@
 //     9 to power more complex Arduino boards that draw more than 40mA, such
 //     as the Arduino Uno Ethernet !
 //
-// For a leostick the pins are:
-//  0: slave reset (arbitrary allocation)
-// 14: MISO
-// 15: SCK
-// 16: MOSI
-//
-// The pins are only available on the ICSP header, this header
-// also supplies the power to the other board too.
-//
 // If the aim is to reprogram the bootloader in one Arduino using another
 // Arudino as the programmer, you can just use jumpers between the connectors
 // on the Arduino board.  In this case, connect:
@@ -98,11 +89,11 @@
 /*
  * Pins to target
  */
-#define SCK 15
-#define MISO 14
-#define MOSI 16
-#define RESET 0
-#define POWER 1
+#define SCK 13
+#define MISO 12
+#define MOSI 11
+#define RESET 10
+#define POWER 9
 
 // STK Definitions; we can still use these as return codes
 #define STK_OK 0x10
I chose pin 0 on the leostick to drive the reset on the etherten because it was close to the ICSP header. I soldered up a cable, hooked the leostick and etherten together with it, set up a serial connection to the leostick, hit G and optiloader said it programmed the boot code without a problem. Unfortunately for me, I still cannot upload a sketch, it has the same error... grrr

I have bought a usbasp board, I am just waiting for a 10 -> 6 pin adaptor - both together cost less than $8 including postage, I will just use the usbasp to program the flash I guess rather than trying to debug the boot loader.