Arduino USB Linker can flash ESC's from MultiWii

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
User avatar
phenolic
Posts: 81
Joined: Fri Sep 21, 2012 10:31 pm

Arduino USB Linker can flash ESC's from MultiWii

Post by phenolic »

I meant to post about this ages ago. The Arduino USB Linker can be used to flash devices compatible with the USB Linker protocol. This is mainly used to flash ESC firmware over the servo wire with simonk and similar firmware.

When integrated with MultiWii it can be used to flash all the ESC's attached to the machine any time needed with very little effort and without disassembling anything.

https://github.com/c---/ArduinoUSBLinker

I would like to see about possibly getting an official MSP code for activating the interface added to the MultiWIi code base. Currently I'm using 239 but obviously that could conflict with future changes to MultiWii. Not completely necessary but would be nice not to have a potentially conflicting entry.

mikob2d
Posts: 11
Joined: Sat Mar 24, 2012 10:07 am

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by mikob2d »

Great idea !

I use myself WiiEsc ( i think i activated the bootloader option)

I will try your patch but i never try to reflash my esc via bootloader method.

At worst, if anything goes wring with multiwii method, i can reflash them via isp right ?

User avatar
phenolic
Posts: 81
Joined: Fri Sep 21, 2012 10:31 pm

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by phenolic »

Generally the bootloader can not set fuses which is generally the only way to make it unflashable via ISP. So yes, if something goes wrong reflashing via ISP should still work. :)

It's reasonably safe to try reading the flash first a few times. If that works without issue then writing should work as well. Myself and others have been using it for almost 6 months so it's relatively stable. The only recurring issue is with certain ESC's without external oscillators the communication sometimes fails due to timing drift on the ESC. A read test will usually tell you if it will work though.

I forgot to mention that the LazyZero KKmulticopter flash tool has direct support for the Arduino USB Linker. Although I don't think it can dump/read the flash (at least not yet), only write.

My MultiWii command line tool can be used to enable the USB Linker mode with the "usblinker()" command. Or simply send the byte sequence from the ArduinoUSBLinker README.

User avatar
phenolic
Posts: 81
Joined: Fri Sep 21, 2012 10:31 pm

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by phenolic »

Also, I thought I should mention again. Follow the README and do not have props on your motors or use a very restricted current power supply when switching to USB Linker mode and flashing. There is always a chance of random motor spool-up when doing this stuff.

skyfreak
Posts: 5
Joined: Thu Jan 03, 2013 12:55 am

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by skyfreak »

i tried to use a nanowii ESC with an 32u4, a gyro has gone wild but the atmega 32u4 is working properly and the PD2/INT0 is nicely routed to a pad on the edge of the PDB.
so I thought why not try and miss use it as an ArduinoUSBLinker.

so I tried to upload the sketch from git
https://github.com/c---/ArduinoUSBLinker

but just trying to test it with arduino 1.05 I get the following errors :(

Code: Select all

ArduinoUSBLinker.cpp: In function 'void AUL_loop(uint8_t)':
ArduinoUSBLinker:644: error: invalid conversion from 'const char*' to 'uint8_t'
ArduinoUSBLinker:644: error: initializing argument 1 of 'virtual size_t Serial_::write(uint8_t)'
ArduinoUSBLinker:667: error: invalid conversion from 'const char*' to 'uint8_t'
ArduinoUSBLinker:667: error: initializing argument 1 of 'virtual size_t Serial_::write(uint8_t)'
ArduinoUSBLinker:735: error: no matching function for call to 'Serial_::write(uint8_t*, int)'
/Users/guido/Dropbox/1_Kopter/02_MultiWii/arduino-1.0.1/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/USBAPI.h:41: note: candidates are: virtual size_t Serial_::write(uint8_t)
ArduinoUSBLinker.cpp: At global scope:
ArduinoUSBLinker.cpp:91: warning: 'void AUL_SerialInit(uint8_t)' declared 'static' but never defined
ArduinoUSBLinker.cpp:92: warning: 'void AUL_SerialWriteBuf(const uint8_t*, int16_t)' declared 'static' but never defined
ArduinoUSBLinker.cpp:93: warning: 'void AUL_SerialWriteStr(const char*)' declared 'static' but never defined


any help is highly appreciated

thx skyfreak

User avatar
phenolic
Posts: 81
Joined: Fri Sep 21, 2012 10:31 pm

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by phenolic »

I'm not sure I understand. Are you trying to integrate the Arduino USB Linker with MultiWii or are you trying to use the Arduino Linker as standalone?

What steps did you take before compiling? One thing I do not understand is why the file is named "ArduinoUSBLinker.cpp".

skyfreak
Posts: 5
Joined: Thu Jan 03, 2013 12:55 am

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by skyfreak »

hi phenolic, thx for that quick reply!

ok I use a nanowii with 32u4 where one gyro is gone wild
http://flyduino.net/Multikopter-FC-Multiwii
and the arduino IDE v 1.05

I downloaded and opened the ArduinoUSBLinker.ino and just pressed the very top left button in arduino IDE to test.
the output is as quoted above.

rgds
skyfreak



sorry did not awnser all your questions.
I wann use it as a standalone usblinker and not integrate in the mwii code.
so in the IDE there is just the .ino file from git that matters right?

User avatar
phenolic
Posts: 81
Joined: Fri Sep 21, 2012 10:31 pm

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by phenolic »

Something is very strange with those errors. What "Board" do you have set in the Arduino IDE?

In any case, I don't think it will work with the ATmega32u4 processor at this time because the timers are different. I should be able to make some changes to make it work, I'll look at it.

skyfreak
Posts: 5
Joined: Thu Jan 03, 2013 12:55 am

Re: Arduino USB Linker can flash ESC's from MultiWii

Post by skyfreak »

cheers, appreciate your support very much.

when I stick in the USB to the nanowii FC it shows up in windows 7 as
Arduino Leonardo COM11
and that is what I set board and port in IDE.

would be very great, I ordered a afro USB linker from HK today, but from china to germany it might be even after xMas :(
so it would be great I if I could miss use the nanowii FC to flash my ESCs via boot loader and servo cable.

and if it was just simonK, I could simply repin them and flash them with an USBUART as usual.
but atm I am playing around with the ESC-Light code. and repin the tiny little ESC every time to test a new light pattern is annoying. the servo cable would do the job perfectly and I could test light on the plane.

thx and rgds,
skyfreak

Post Reply