Programming in other environments.

I have been trying to use my Arduino board from VMLAB, however, I cant get it to connect using the STK500 interface. I thought the Arduino was STK500 compatible?

Anyhow, I would prefer to use ASM for a specific project I have in mind. Is it possible to use the Arduino without the specific C like development environment?

Regards, Hoastey.

The Arduino bootloader is stk500 compatible, although it doesn't support every stk500 command. Any idea what's going wrong?

You can certainly program the board in assembly. Just treat it as you would any other ATmega168. If you also want to use the Arduino core, that should be possible too - just compile a sketch, grab the .a file it generates and link your assembly source against that.

I can get the Arduino IDE to compile programs and send them to the board with no problems. So I think it's fair to say there's nothing wrong with the actual communications link between my PC and the interface board.

The VMLAB simulator has an STK500 interface option, however, when I try to connect to Ardruino with this option, the interface board cannot be found. I hardcoded my Ardruino config to my free COM7 port, because VMLAB only seems configurable on COM1 through COM9. Again, with the Arduino IDE, comms works fine in this mode, but the interface does not seem to work in VMLAB... it's as if the board is not present.

Here is the AUTO mode error log from within VMLAB: I think this particular command it trying to get the board signature, but the response is the same irrespective of other basic command variants from within VMLAB. Results are also the same if I hardcode VMLAB to use a specific COM port.


[AVRStudio]\STK500.EXE -z -dATmega16 -mp -s STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Scanning ports: COM1 ... Port busy or STK500 not connected COM2 ... Port busy or STK500 not connected COM3 ... Port busy or STK500 not connected COM4 ... Port busy or STK500 not connected COM5 ... Port busy or STK500 not connected COM6 ... Port busy or STK500 not connected COM7 ... Port busy or STK500 not connected COM8 ... Port busy or STK500 not connected COM9 ... Port busy or STK500 not connected Could not connect to STK500 V2 on COM9

Exit status = 1


Any ideas anyone?

The second-to-last line makes me suspicious. The bootloader on the Arduino boards is stk500 version 1, and it sounds like vmlab might be using stk500 v2, which is basically a completely different protocol. Do you see anything in the documentation or elsewhere that might give a conclusive answer?

That's very interesting Mellis. I wasn't aware there was more that one STK500 protocol. Since your last post, I found a website somewhere which stated that V2 of the STK500.exe protocol was released in AVRStudio 4.11 (?)

I have found some other versions of the STK500.exe... V1.42, and V1.40. Unfortunately, these do not work either. As with V2 of STK500.exe, when I select to read the board signature, the RX activity LED on the Arduino flashes, but the board is not recognised.


STK500.EXE -z -dATmega16 -mp -cCOM5 -O0

STK500 v 1.40 (C) 2000-2002 Atmel Corp.

Detecting.. FAILED!

Exit status = 1


(Note that the change to COM5 is intentional and consistent with the system configuration)

I don't know if it is of any relevance, but the board I'm using is a new arduino deicimila.

As at this moment in time, I haven't actually found any documentation on the web from individuals who are programming the Arduino outside of the C like development environment. Has anyone actually ever done this for real? Does Arduino really work with VMLAB or AVRStudio? I would be very interested to hear from you if you have managed to get this configuration to work.

Thanks and regards.

If you just need to upload compiled .hex files to the board, you can use avrdude, which is what's used internally by the Arduino software. To see what command line options to use, set upload.verbose to true in your preferences file (whose location is given in the Preferences dialog) and then upload a sketch. You need to edit the preferences file when the Arduino software is not running.

Actually, now that you mention it, this will probably only work (on Windows at least) with the avrdude that comes with Arduino. The Diecimila gets reset by that version of avrdude (by setting/lowering DTR) before the upload occurs, meaning the time has to very precise. On other OSes, this line is set automatically whenever the port is opened, making it easier to upload from another program.

Thanks Mellis. I don't want to be restricted to uploading hex files really. It would have been fantastic to be able to run the Arduino with VMLAB or AVRStudio. Further to your suggestion, I have tried AVRdude, but unfortunately, I've not managed to get a peep out of the Arduino- not even RX/TX activity with the on-board indicators.

Although this has been a learning experience for me which I have enjoyed so far, I am rather frustrated with the Arduino's apparent lack of "STK500 compatibility" - certainly as fas as I have experienced anyway. For me, the C environment is great for quick, proof of concept experiments, but I prefer to use an assembler for optimum program efficiency and speed. I'm now considering buying a dedicated STK500 board for my developments, and keeping the Arduino specifically for initial experimentation.

If someone out there can try their Arduino with VMLAB, or AVRStudio, I'd be really grateful to hear of your findings.

Thanks for your help and assistance. Hoastey.

Hmm, it's strange that you didn't have any luck with avrdude, since it does all the uploading from the Arduino IDE. What command line did you try? You could just buying a ICSP and programming the chip on the Arduino directly, bypassing the bootloader. Then you don't have to worry about the stk500 compatibility.