HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Sep 09, 2012, 01:10 AM
Registered User
Joined Aug 2012
12 Posts
Miru-
I started thinking (dangerous) about the Arduino Bootloader delay. I normally use Optiboot which doesn't delay the execution of the Atmega328P code by more than a second or so. The bootloader for the Nano and Pro Mini is old and big - and it delays the startup of any code for several seconds (a lot longer than Optiboot). Since your at2so seems to depend on the time it takes for the Drone to send CTL-B, does the Arduino bootloader delay have any effect on when and if your code sends a "ready" command?
Or, can we generate a hex file from the Arduino IDE and burn it directly to the 328P bypassing the Arduino bootloader (which is just a convenience anyway) to speed things up? Or should I stop thinking...

Rob
robk2544 is offline Find More Posts by robk2544
Reply With Quote
Sign up now
to remove ads between posts
Old Sep 09, 2012, 09:26 AM
Registered User
Vista, CA
Joined Feb 2008
1,325 Posts
Quote:
Originally Posted by robk2544 View Post
Miru-
I started thinking (dangerous) about the Arduino Bootloader delay. I normally use Optiboot which doesn't delay the execution of the Atmega328P code by more than a second or so. The bootloader for the Nano and Pro Mini is old and big - and it delays the startup of any code for several seconds (a lot longer than Optiboot). Since your at2so seems to depend on the time it takes for the Drone to send CTL-B, does the Arduino bootloader delay have any effect on when and if your code sends a "ready" command?
Or, can we generate a hex file from the Arduino IDE and burn it directly to the 328P bypassing the Arduino bootloader (which is just a convenience anyway) to speed things up? Or should I stop thinking...

Rob
Thinking is always good!
The only thing the bootloader can mess up is tinkering with the USART port on power up, the drone detecting that and launching some special update mode in reponse because it thinks...
Once the mod is in control (aka main is called by the boot loader) things are not that critical. The mod will check the following conditions and wait forever if not all of them are met:
1) does the receiver get good signals (1 blink if not)
2) is the flight mode signaled from TX LAND (2 blinks if not)
3) have NSBOOTseconds gone by since boot (3 blinks if not)
4) has the drone stopped talking on the serial port for NSQUIET seconds (4 blinks if not)
Once the conditions are met, it launches a shell on the drone by sending a '\n' twice to the drone (one is 'formally' enough, but sometimes it gets lost and the second does not hurt, it just reissues the prompt if the first one launched the shell). After that it transfers the zipped 'at2so' binary to the drone (Arduino LED dimm). In case there is a checksum error reading the data from the flash, it stops right there with a 1 blink, 3 blinks sequence, which I have never seen. After that it turns the LED on (bright) unzips the upload and makes it executable.Then it changes the baudrate on the link to 38400 (this is somewhat tricky but I never had any problems there). After that it launches 'at2so' and waits for a start character on the interface (Arduino LED still bright). There is no timeout waiting for the start character. There is only one valid start character (CTRL-B) which can make the mod proceed. The other character the mod will respond to is a CTRL-D during this period, it will send the 'sketch' into an endless blink SOS loop, indicating 'at2so' detected another controller on the drone and bowed out, anything else is ignored.
miru is offline Find More Posts by miru
Reply With Quote
Old Sep 09, 2012, 09:38 AM
Registered User
Vista, CA
Joined Feb 2008
1,325 Posts
Quote:
Originally Posted by robk2544 View Post
Thanks for helping out. No sticks or switches interact. Aile and Elev are approx -950 ...+1025. Aux1 (3 pos sw) is -1602...0...1487, but works - shows Land, FM_1, FM_2. Thro is odd -890...0...1354, showing CFG1.
Should at2so load and run if Aux is -1602 and Thro is 0?
On another note, I timed the Drone boot to green LEDs at 18 seconds. Would increasing NS_BOOT to 20 or higher help connect better? I didn't have this connection problem with 1.10.10 firmware, but 1.7.11 seems to perform better.
Thanks much-
Rob
Your AUX switch channel produces really high values, I am surprised the sampling evaluation accepts this and does not flag the RX down for a pulse length error. To get a value of -1600, everything else working right, the pulse length would have to be 0.7 ms, which is below the 0.95 ms reject threshold. Check the dcnt=XXXX line in SETUP. Does XXXX read 2663 indicating a 16Mhz processor? What is the setting of the fuses on your board?
miru is offline Find More Posts by miru
Reply With Quote
Old Sep 09, 2012, 10:15 AM
Registered User
Joined Aug 2012
12 Posts
There's something wrong with my Arduino. Now it won't "connect" and upload at2so. I'll reburn the sketch.
For some reason, right now the Aux switch is reading -1000, 0, 1000 when last night is was over 1600. The F is 21.7, P is 2021, Value is -1000 Land.
Fuse is DA-FF-FD-FF (I have to look at my notes but I believe I programmed them low FF, high DA, ext 05) and the dcnt is 2663.

Strange- it was flying yesterday (at 1 foot aboue the ground) but now it won't load. No 12hZ flicker. I think I may have left off a .1uf bypass cap somewhere on the board, runs a bit flaky.
robk2544 is offline Find More Posts by robk2544
Reply With Quote
Old Sep 09, 2012, 04:34 PM
Registered User
RHTizzy's Avatar
The Netherlands, NH, Bussum
Joined Feb 2012
207 Posts
Quote:
Originally Posted by miru View Post
Thinking is always good!
The only thing the bootloader can mess up is tinkering with the USART port on power up, the drone detecting that and launching some special update mode in reponse because it thinks...
Once the mod is in control (aka main is called by the boot loader) things are not that critical. The mod will check the following conditions and wait forever if not all of them are met:
1) does the receiver get good signals (1 blink if not)
2) is the flight mode signaled from TX LAND (2 blinks if not)
3) have NSBOOTseconds gone by since boot (3 blinks if not)
4) has the drone stopped talking on the serial port for NSQUIET seconds (4 blinks if not)
Once the conditions are met, it launches a shell on the drone by sending a '\n' twice to the drone (one is 'formally' enough, but sometimes it gets lost and the second does not hurt, it just reissues the prompt if the first one launched the shell). After that it transfers the zipped 'at2so' binary to the drone (Arduino LED dimm). In case there is a checksum error reading the data from the flash, it stops right there with a 1 blink, 3 blinks sequence, which I have never seen. After that it turns the LED on (bright) unzips the upload and makes it executable.Then it changes the baudrate on the link to 38400 (this is somewhat tricky but I never had any problems there). After that it launches 'at2so' and waits for a start character on the interface (Arduino LED still bright). There is no timeout waiting for the start character. There is only one valid start character (CTRL-B) which can make the mod proceed. The other character the mod will respond to is a CTRL-D during this period, it will send the 'sketch' into an endless blink SOS loop, indicating 'at2so' detected another controller on the drone and bowed out, anything else is ignored.
Oooh, nice to see that written out completely!

I'm having trouble with my Drone1 Pro Mini mod (no UBEC connected) too all of a sudden. Using FTDI everything works fine but connecting to the drone just gets a solid (green\yellow?) LED on the duino from the moment the batt's connected, no blinking or flickering or anything. I checked all the connections and they seemed solid but I replaced the 4k7 with a new one anyway. No change.

Any suggestions?
RHTizzy is offline Find More Posts by RHTizzy
Reply With Quote
Old Sep 09, 2012, 04:55 PM
Registered User
Italy, Emilia-Romagna, Predappio
Joined Aug 2012
85 Posts
Quote:
Originally Posted by robk2544 View Post
Thanks for the advice. The props spin freely, as you can see in the photo the kit consisted of (4) 2.5mm and (4 )2.0mm - I put the thicker sealed bearings on the bottom and the thinner bearings open side down on the top.
Rob
I installed mine in the same way and never had a problem.
G.
Viaggiatore is offline Find More Posts by Viaggiatore
Reply With Quote
Old Sep 10, 2012, 01:22 AM
Registered User
Vista, CA
Joined Feb 2008
1,325 Posts
Quote:
Originally Posted by robk2544 View Post
Miru-
I started thinking (dangerous) about the Arduino Bootloader delay. I normally use Optiboot which doesn't delay the execution of the Atmega328P code by more than a second or so. The bootloader for the Nano and Pro Mini is old and big - and it delays the startup of any code for several seconds (a lot longer than Optiboot). Since your at2so seems to depend on the time it takes for the Drone to send CTL-B, does the Arduino bootloader delay have any effect on when and if your code sends a "ready" command?
Or, can we generate a hex file from the Arduino IDE and burn it directly to the 328P bypassing the Arduino bootloader (which is just a convenience anyway) to speed things up? Or should I stop thinking...

Rob
Sorry about the second reply to the same message but I have not addressed the 'direct' burning of rx2atp to the Arduino. I used to do that from my Linux system, only to find out that most people do not have that kind of a setup and did not feel this is the right place to waste time talking about setting up a Linux, Windows or MacOS system to do cross-compiles for the Atmega328p and flashing it from scratch with a programmer most people don't have. The Arduino IDE is well understood by people doing the mod and has a lot of support in other groups. If you go through this thread you will not find a single complaint or comment that the mod does not compile, which, at least to me, is a good thing because I don't have to deal with problems that don't have anything to do with the mod.
miru is offline Find More Posts by miru
Reply With Quote
Old Sep 10, 2012, 06:47 AM
Registered User
RHTizzy's Avatar
The Netherlands, NH, Bussum
Joined Feb 2012
207 Posts
Quote:
Originally Posted by RHTizzy View Post
Oooh, nice to see that written out completely!

I'm having trouble with my Drone1 Pro Mini mod (no UBEC connected) too all of a sudden. Using FTDI everything works fine but connecting to the drone just gets a solid (green\yellow?) LED on the duino from the moment the batt's connected, no blinking or flickering or anything. I checked all the connections and they seemed solid but I replaced the 4k7 with a new one anyway. No change.

Any suggestions?
I reloaded the sketch to no effect. The drone still works with my nano mod. Resistor and wiring (and plug) checked. Could the bootloader be fried and if so is it possible to fix or is there something else I should check?
RHTizzy is offline Find More Posts by RHTizzy
Reply With Quote
Old Sep 10, 2012, 08:57 AM
Registered User
Joined Aug 2012
12 Posts
Quote:
Originally Posted by miru View Post
Sorry about the second reply to the same message but I have not addressed the 'direct' burning of rx2atp to the Arduino. I used to do that from my Linux system, only to find out that most people do not have that kind of a setup and did not feel this is the right place to waste time talking about setting up a Linux, Windows or MacOS system to do cross-compiles for the Atmega328p and flashing it from scratch with a programmer most people don't have. The Arduino IDE is well understood by people doing the mod and has a lot of support in other groups. If you go through this thread you will not find a single complaint or comment that the mod does not compile, which, at least to me, is a good thing because I don't have to deal with problems that don't have anything to do with the mod.
You're right, using the Arduino IDE with bootloader is easier for some, but you can plug in a $7 USBASP and instead of "upload", pick "Upload with Programmer" and it overwrites the bootloader. The only drawback is you need access to the 6-pin header for ISP which I believe the Nano has. All it does is compile and write the resulting hex file to the 328p. I'm sure you knew that but it may be of interest to others.
Thanks!
Rob
robk2544 is offline Find More Posts by robk2544
Reply With Quote
Old Sep 10, 2012, 10:16 AM
serial scratchbuilder
Granted's Avatar
Canada, BC, Mission
Joined Sep 2012
1,390 Posts
Quote:
Originally Posted by robk2544 View Post
Someone should lay out 1 board with 328P, level matching FETs, diagnostic LEDs, USB or Serial TTL connector. I stink at surface mount...
Working on it:
Granted is offline Find More Posts by Granted
Reply With Quote
Old Sep 11, 2012, 03:50 AM
Registered User
Italy, Emilia-Romagna, Predappio
Joined Aug 2012
85 Posts
Quote:
Originally Posted by dante1 View Post
Have a look at this one, MT3339 based but costs the half:

http://www.drotek.fr/shop/en/90-pa6c-gps-llc.html
Viaggiatore is offline Find More Posts by Viaggiatore
Reply With Quote
Old Sep 11, 2012, 03:36 PM
Registered User
Vista, CA
Joined Feb 2008
1,325 Posts
mirumod rev 0.19

Due to time constraints (going on vacation and not having enough time to spend on this project) I am releasing rev 0.19, which has quite some improvements and additions but does NOT have a working RTH function.
  • Fixed bug in start up blink sequence (thanks Pawelsky for pointing this out).
  • RX sampling routine ignores unused signals.
  • Pilot program name changed from 'pilot.arm' to 'pilotXXX.arm'. XXX stands for the revision of the mod. The name is hardcoded into the matching version of the companion program 'at2so' so there can't be any accidental mixups by design. There is also a key exchange between the companion program and the pilot to make sure both come from the same revision of the mod.
  • Accommodating GPS units that can not store a setup for baudrate, frequency and content of reports as well as users that don't want to deal with it. 'rx2atp' attempts to setup the GPS 'automagically' with the parameters it wants. It will auto-detect the baudrate (not a choice any more), send 'PMTK' instructions to change the baudrate to 38400, the update rate to 5Hz and ask for a GGA sentence on every report and for a RMC sentence every 5th report (needed for the date). All other sentences are turned off. The sentences used for setup are:
    "PMTK251,38400" to set the baudrate,
    "PMTK314,0,5,0,1,0,0,0,0" to select data and
    "PMTK220,200" for the update rate.
  • Moved interpretation of GPS data from companion program to pilot program. At this point there is no more GPS data insertion into the Navdata stream, nobody really made use of it and it costs precious code space to do it in the companion program.
  • Pilot program writes a log file to permanent storage on an external drive or the drone's /data/video directory (drone 1 or no USB stick on drone 2). The log file format is in ASCII, aka human readable.
    Pawelsky helped me a lot and wrote a wonderful piece of software that can pick up one of these log files and convert it to something Google Earth understands! This way one can display a recap of a flight on GE with all the things that happen. I hope he finds a way how to give everybody access to this very useful tool.
  • Changed EEROM magic number, added boot counter 'bid' to EEROM data structure. 'bid' gets incremented before launch of the companion program and saved in EEROM if the companion program sends the start character. FYI, the EEROM does not get erased when you load a new sketch. The 'bid' is passed to the companion program as an argument (-l #). The companion program passes it to the pilot program. The pilot program uses the number to generate the file name for the log file. It is P%d.txt. The %d is replaced by the 'bid' modulo 20 on an external drive and 'bid' modulo 5 for storage on the drone in '/data/video'. The size of a single log file is limited to 4 Mb.
  • Redesigned data exchange between companion and pilot program to reduce the amount of data transferred to a bare minimum. There are two packets, TAG 82 from companion to pilot and TAG 81 from pilot to companion. TAG 82 is sent to the pilot every time new Navdata arrives from the firmware, TAG 81 is sent back to the companion as a response to it, it carries the GPS status and the steering instructions from the pilot program if it is engaged.
  • New feature: in LAND, if you move the throttle stick all the way down, the Arduino LED will show the GPS status:
    0 blinks - no GPS data or pilot program is not running
    1 blink - no GPS fix
    2 blinks - GPS has 2D fix
    3 blinks - GPS has 3D fix
  • New feature: the pilot program has a socket one can tap into to relay 'live' log messages as long as the drone is within WiFi range. The port is datagram port 12000 on <drone IP>, you have to send it a 'lbeg' message to start receiving log entries and 'lend' once you are done. Check a stored log for the interpretation of the messages.
  • Decided pilot is not ready for prime time -> disabled for now

Note: I am still not happy with the pilot program's navigational skills, especially on a Drone 1 which has a problem reporting changes in it's heading when certain events occur. On a Drone 2 the challenge is that the heading data is referenced to magnetic North and the GPS data is referenced to 'true' North. The solution to this will have to wait until I can spend a lot more time on it, which is hard to come by at the moment. There seem to be some new GPS units out which don't use the SirF protocol, they have a way to report the magnetic heading, which would take out a lot of extra software.
miru is offline Find More Posts by miru
Last edited by miru; Sep 12, 2012 at 03:48 PM. Reason: typo
Reply With Quote
Old Sep 11, 2012, 04:31 PM
Makers gonna make...
pawelsky's Avatar
Polska
Joined Jan 2012
1,742 Posts
Quote:
Originally Posted by miru View Post
Due to time constraints (going on vacation and not having enough time to spend on thos project) I am releasing rev 0.19, which has quite some improvements and additions
This is an impressive list - great work miru!

Quote:
Originally Posted by miru View Post
[*] Pilot program writes a log file to permanent storage on an external drive or the drone's /data/video directory (drone 1 or no USB stick on drone 2). The log file format is in ASCII, aka human readable. Pawelsky helped me a lot and wrote a wonderful piece of software that can pick up one of these log files and convert it to something Google Earth understands! This way one can display a recap of a flight on GE with all the things that happen. I hope he finds a way how to give everybody access to this very useful tool.
The converter can be found here: http://mirumod.tk/tools/log_converter.php
pawelsky is offline Find More Posts by pawelsky
Last edited by pawelsky; Dec 28, 2012 at 08:21 PM. Reason: New website address
Reply With Quote
Old Sep 12, 2012, 07:28 AM
Registered User
RHTizzy's Avatar
The Netherlands, NH, Bussum
Joined Feb 2012
207 Posts
Excellent stuff once again, well done guys!

I uploaded the new sketch to my pro mini and nano builds and am just wondering about the new failsafe. At least it appears that instead of the Error message above the pulse readings on Tx disconnect, we now get a quick countdown and er15 next to throttle. I'm hoping I didn't make a ballsup with my sketch mods but it's not flying weather at the moment so cant check (not enough space inside for responsible testing I learned the hard way ). Can someone plz confirm that's the way it's supposed to work now?
RHTizzy is offline Find More Posts by RHTizzy
Last edited by RHTizzy; Sep 12, 2012 at 07:40 AM.
Reply With Quote
Old Sep 12, 2012, 10:04 AM
Registered User
Vista, CA
Joined Feb 2008
1,325 Posts
Quote:
Originally Posted by RHTizzy View Post
Excellent stuff once again, well done guys!

I uploaded the new sketch to my pro mini and nano builds and am just wondering about the new failsafe. At least it appears that instead of the Error message above the pulse readings on Tx disconnect, we now get a quick countdown and er15 next to throttle. I'm hoping I didn't make a ballsup with my sketch mods but it's not flying weather at the moment so cant check (not enough space inside for responsible testing I learned the hard way ). Can someone plz confirm that's the way it's supposed to work now?
Sorry, forgot to mention that the SETUP GUI has changed face a little bit. The 'erx=15' used to be a '15 RX error' above the column headings. It is the consecutive sampling error count. It only shows up if it is non 0. Also the lines on the top changed order. If you have a GPS connected the 'gps' line should read 'gps 38400 baud, 0042' indicating the baud rate and the received message types.
miru is offline Find More Posts by miru
Last edited by miru; Sep 12, 2012 at 10:10 AM.
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Mini-HowTo RC Controlled AR.Drone w/o WiFi! nosaari Multirotor Talk 117 Dec 07, 2014 05:04 AM
For Sale Parrot AR Drone w/TX/RX mod *Flies Nice* Z06 Tony Aircraft - Electric - Helis (FS/W) 4 Apr 16, 2011 10:42 PM
Discussion Wifi Boosted AR.Drone Fallengod Multirotor Talk 7 Feb 12, 2011 11:52 AM
Discussion And yet another AR drone Arial Video project taudronis Multirotor Talk 17 Dec 07, 2010 12:04 PM
Sold Parrot AR.Drone Four rotor platform control with your iPodTouch/iPhone/iPad Hoverup Aircraft - Electric - Helis (FS/W) 0 Oct 12, 2010 04:54 PM