Wifi Sketch upload avrdude error rc=-1 (SOLVED)

Moved from another thread:

New to the Yun, I've not gotten a single sketch to upload via wifi. I can however upload via USB. So the AVR bootloader is there and functioning.

I only have the arduino Yun a few days, followed the openWRT update instructions on the sticky. thinking that would resolve the issue, the update was needed and painless but still can upload a sketch

uploads fine via USB, and the serial window works over usb

but via wifi the sketch upload returns

Sketch uses 14,774 bytes (51%) of program storage space. Maximum is 28,672 bytes.
Global variables use 820 bytes (32%) of dynamic memory, leaving 1,740 bytes for local variables. Maximum is 2,560 bytes.
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

and the serial window returns

Unable to connect: retrying (1)... Unable to connect: retrying (2)... Unable to connect: retrying (3)... Unable to connect: retrying (4)... Unable to connect: is the sketch using the bridge?

To me this indicates a lack of comms on the bridge connection.

Anyone else observing the same issues,/ know of a software fix or is it a case of return to vendor.

the wlan led is not lighting even when i've ssh'd into the CLI.

This makes me think the logic level converter could be at fault max3375, u16 on the board. I was going to probe the test points tp34 (5v) atmega32u tx and tp32 (3v3) Atheros RX but there is no silk screen on the board so I cant.

Best guess is the device is on the underside of the board in an 8pin tssop but its pointless without a layout diagram to verify what the test pads are what.

Hints appreciated.

It sounds like both halves are working but not talking. Load the yunserial terminal sketch over the USB and open the serial monitor and press the yun reset button. You should see linino boot up. Does this work?

Once linino is back up, run reset-mcu in a ssh session, the yellow led should blink after 1-2 seconds. Does it?

There are a few 3<->5 v translators in between the two processors IIRC both of these things are on separate chips from the programming function.

Also check out your selected port http://playground.arduino.cc/Hardware/Yun#console_cant_connect

@noblepepper, I'll try this when I get home from work, thanks. I was trying to find info on software debugging the interface.

@Federico Fissore, I've selected the IP of the YUN as the Port

Thanks for the hints, I'll get back to it later today.

ok, I can see the openwrt linino boot dialogue.

running reset-mcu also causes the yellow led to blink.

so this rules out the max 3375

I still getting the same error message when I try to load a sketch via wi-fi.

No joy but I really appreciate the help. Thanks.

That error message ends with a question: what's your answer?

The answer was yes, I was running a temboo sketch to poll my google account,

I've tried the example>bridge>consoleRead example and it seems to run ok, so the linino/openWRT serial link to the atmega32u seems to be functioning fine.

The open issue would now appear to be the avrdude error rc=-1

I see an arduino folder on the linino , can I use the CLI to get this to upload the blink example from the linino to the atmega32u?

Again thank you for your help.

Sorry, just came to mind. If you want Console to work over wifi, you have to initialize it, just as you do with Serial Check if your sketch has a Console.begin() and related Console.println spread over the code

On the avrdude rc=-1 - I see very little that can cause this when uploading a sketch if you are working in the IDE. The only time I have seen it is when I am playing with this connection directly in linino and forget to enable the level translator with gpio21.

To see if the level translator is working you can check the voltage on the ISCP/SPI connector, this is the 3x2 connector near the leds. Pin 1 (closest to the little white dot) is MISO and pin 6 (diagonally opposite pin 1) is ground. I use leads with female connectors on one end to attach to this, pin 2 is 5v so if you try meter leads directly be VERY careful not to short pins together.

Normally MISO should be at 0V, you can play with it in a ssh session like this:

root@Arduino:~# echo 8 > /sys/class/gpio/export # make gpio8 available to you as I/O 
root@Arduino:~# echo out > /sys/class/gpio/gpio8/direction # set gpio8 as output
root@Arduino:~# cat /sys/class/gpio/gpio8/value # check value of gpio8
0
root@Arduino:~# cat /sys/class/gpio/gpio21/value # check value of gpio21 it is enabled as output by default
0
root@Arduino:~# echo 1 >/sys/class/gpio/gpio21/value # enable voltage translator
root@Arduino:~# cat /sys/class/gpio/gpio21/value # check value of gpio21
1
root@Arduino:~# echo 1 >/sys/class/gpio/gpio8/value # turn on MISO
root@Arduino:~# cat /sys/class/gpio/gpio8/value # check value of gpio8
1

Now pin 1 of the ISCP/SPI connector should be at 5V (actually 4.7v on my Yun):

This will put things back where thy were when you started:

root@Arduino:~# echo 0 >/sys/class/gpio/gpio8/value # turn off MISO
root@Arduino:~# echo 0 >/sys/class/gpio/gpio21/value # disable voltage translator
root@Arduino:~# echo 8 >/sys/class/gpio/unexport #make gpio8 available for avrdude to use
root@Arduino:~#

If this doesn't work you probably have a hardware problem (return vendor time)

Brilliant, I'll try all of the above when I get home later.

Have to say the support on here is excellent, thanks everyone.

gpio21 cant go high for some reason,

root@Arduino:/sys/devices/virtual/gpio/gpio21# echo 1 > value
root@Arduino:/sys/devices/virtual/gpio/gpio21# cat value 
0

this pin hasn't got a " direction" attribute so... I 'm guessing it's tied low by a fault.

verifying this with a scope, toggling gpio8 does nothing.

Looking like RScomponents is my next port of call.

Again, I want to thank everyone who has helped with this issue, It was only me that slowed progress, the respondents had to wait for me to go and follow their clear and helpful instructions. Thank you all.

I have no idea why gpio21 would be stuck low but if it can't be set to 1 then the AR9331 won't be able to program the 32u4. The only thing I can think of to try would be to run the update one more time but that's a shot in the dark.

And yes, there is no direction attribute for gpio21 and you don't need to export it for it to be available, it is set that way by the system.

re-ran the update, no change.

I'm going to kick off the return / replace process tomorrow.

I'll be linking them to this thread to put any "have you tried turning it on & off again ? / PICNIC!" worries to bed.

Replacement Yun arrived on Wednesday, I just uploads the blink example via WiFi,

All seems to be working.

Again thanks for the help diagnosing the problem.

This has been a good customer support experience, the forum diagnosed the problem faster than I could check and RS components verified and replaced the board at no cost to me in less than a week.

Happy out.

Thanks.

hi I am not sure it's a good place to write my problem!! I want to upload program with wi-fi to YUN but in Tools/Port I can not find any IP address

I am pretty sure it isn't since your problem is quite different.

Try this http://forum.arduino.cc/index.php?topic=189081.msg1416764#msg1416764 first, then if you still have problems it would probably be best to start a new thread since that one is very old and a long thread