Sketch uploads but does'nt run

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
smartalec
Posts: 3
Joined: Tue Sep 04, 2012 7:48 am

Sketch uploads but does'nt run

Post by smartalec » Sun Mar 24, 2013 4:15 pm

Hi All,
I was playing around with my mega an my leostick..
i uploaded mega data to the leostick... :o

now no matter what sketch i load into it, they wont run, not even 'blink'
they upload fine an the leostick itself red led fades when its uploading the sketch.

but it wont run any of the new sketch's.. (the sketch locked in it arnt quite right otherwise i would'nt worry about it)

can anyone please help me..

did i just brick the leostick?? i'm willing to try aything..

thanks in advance

cef
Freetronics Staff
Freetronics Staff
Posts: 106
Joined: Wed Nov 09, 2011 12:53 am

Re: Sketch uploads but does'nt run

Post by cef » Sun Mar 24, 2013 10:06 pm

One difference between the Mega and the Leostick is that the bootloader is (at least partly) uploaded each time you upload a program to it. This is due to the fact that the 32u4 chip on the board doesn't just run your program, but also talks to the USB. This is what allows you to reprogram it to do things like make it act as a USB keyboard or mouse. The same is true of the Arduino Leonardo.

Something that will definitely work is to use an AVR ISP programmer that talks to the Leostick on the ISCP header (the 6 pin header in the middle of the Leo, the one that isn't usually soldered on by default) and to reload the Caterina bootloader onto the Leostick that way.

You can use any AVR programmer supported by the Arduino IDE to reload the firmware (eg: Adafruit USBTinyISP, AVRISP mk II, etc). There are other options as well, such as using the Arduino as an ISP sketch on another Arduino (eg: the Mega) to turn your second Arduino into an ISP programmer for a while, or you can make a Parallel port programmer (if you have an old style parallel port - a USB one won't work). You can see a list of the default ones supported in the Arduino IDE under Tools -> Programmer. Note that while the Arduino as an ISP sketch should work for a Mega, it apparently doesn't work well for the Uno-based devices, and also most likely won't work on the Leo based devices either.

If you've got a Hackerspace nearby, it might be worth asking if they or anyone at the Hackerspace has an AVR ISP programmer that they're happy to let you use to resurrect your Leostick. If you're in Melbourne, the Connected Community HackerSpace (http://www.hackmelbourne.org/) has an Adafruit USBTinyISP (and as a member, I also have one) that can be used for this purpose. Most of the Hackerspaces around Australia have one on hand, as do most of the international HackerSpaces.

Once you select the board and the programmer in the IDE, you should just be able to run the Tools -> Burn Bootloader option in the IDE to get it back to normal. You can also upload your code to the device using the ISP programmer instead of directly to the Leo. With the Leo boards, the code you upload should actually contain the bootloader code you've overwritten with the Mega sketch, so you should get a working board again. A few people who have issues with the Leo boards being recognised on their computers use an ISP programmer to reprogram them all the time, as it's pretty much "guaranteed" to always work.

For a good reference of the Arduino as an ISP code & how to hook it up, check out http://playground.arduino.cc/Code/MegaISP. Don't follow the other guides, as they reference older Arduino platforms that won't work.

Note: I have not used the Arduino as an ISP setup at all. I personally have an Adafruit USBTinyISP.

smartalec
Posts: 3
Joined: Tue Sep 04, 2012 7:48 am

Re: Sketch uploads but does'nt run

Post by smartalec » Mon Mar 25, 2013 7:13 pm

thanks for you great info,
i have a EtherMega2560 so im going to try turning that into the iscp programmer,
ive soldered iscp sockets on the Leostick board


i must be doing something wrong still in the process, cause im not having muck luck
i'll get there i hope.. thanks..

Post Reply