SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Jan 14, 2013, 09:37 PM
Registered User
Joined Dec 2006
1,437 Posts
ok

will add the note in the readme.

i'll probably not add endpoint calibration soon though. since
1. it would require stick config commands,
2. you should be using the full range of your channel


Quote:
Originally Posted by SlimTom View Post
Would be good to add this to manual/properties? Good to know IMHO.

So - endpoint compensation would require some calibration routine
noobee is offline Find More Posts by noobee
Reply With Quote
Sign up now
to remove ads between posts
Old Jan 15, 2013, 02:03 PM
Registered User
Hasi's Avatar
Austria, Stmk., Graz
Joined Sep 2011
415 Posts
Quote:
Originally Posted by noobee View Post
which s/w are you using? avrdude or extremeburner or something else? if extremeburner , can you try reading just the fuses again? click on the "fuse bits/settings" tab and then "read all". see if the read back is always consistent.

i don't think any programmer would rewrite the fuses unless you explicitly ask it to do so (eg. erase chip or write to fuse). writing to flash or eeprom will not change the fuses.

next is to try to disconnect the vcc line and power the device externally. better still, buy a usbasp capable of 3.3v and 5v
So, I modified my usbasp, so that it puts out 3.3V, but I get the same results. low fuse: 0xF6

Shall I try to change the fuse to 0xF7 and write the new firmware on it?
Hasi is offline Find More Posts by Hasi
Reply With Quote
Old Jan 15, 2013, 03:03 PM
Registered User
Joined Dec 2006
1,437 Posts
Quote:
Originally Posted by Hasi View Post
So, I modified my usbasp, so that it puts out 3.3V, but I get the same results. low fuse: 0xF6

Shall I try to change the fuse to 0xF7 and write the new firmware on it?
actually, i would leave the fuse unchanged. only the lock fuse (LB1/LB2) need to be reset on the erase step. everything else should be left alone and untouched.

can you also take a detailed pic of your board, particularly the crystal oscillator or resonator, the silver component near the cpu? i'm curious if they actually changed the part.

thanks
noobee is offline Find More Posts by noobee
Reply With Quote
Old Jan 16, 2013, 02:20 AM
Registered User
Hasi's Avatar
Austria, Stmk., Graz
Joined Sep 2011
415 Posts
Quote:
Originally Posted by noobee View Post
actually, i would leave the fuse unchanged. only the lock fuse (LB1/LB2) need to be reset on the erase step. everything else should be left alone and untouched.

can you also take a detailed pic of your board, particularly the crystal oscillator or resonator, the silver component near the cpu? i'm curious if they actually changed the part.
I took a big breath and flashed it. I didn't change that fuse. It works! Everything is fine. It is quite cold outside, but I'll have to try it. First i'll try it on my F-22 and if everything is ok, the drone gets it.

Here are the pictures:
Hasi is offline Find More Posts by Hasi
Reply With Quote
Old Jan 16, 2013, 08:05 AM
Registered User
Joined Dec 2006
1,437 Posts
Quote:
Originally Posted by Hasi View Post
I took a big breath and flashed it. I didn't change that fuse. It works! Everything is fine. It is quite cold outside, but I'll have to try it. First i'll try it on my F-22 and if everything is ok, the drone gets it.

Here are the pictures:
thanks for the update! i suspect, and it's just a guess, that your fuse was programmed incorrectly. if you want, try setting that value to 0xf7 and see if it still works. if it doesn't, you should be able to set it back to 0xf6 (without changing anything else about the system).

i would still recommend to keep to only ground testing at the moment. i've been working on quite few improvements over the couple of days that reduced jitter and the latency between rx in and servo out. but i'm sure there are bugs as well. so we need to be very certain that the system works robustly before taking it to the air. for example, we need to fix two things:

1. i've moved to using a higher precision timer1, but it has rollover issues. so if your flight is too long - like in a drone - (around 30 min) the stabilizer might stop. it's fixed in the dev branch (timer0_servo_part1 in github) and i've been running overnight tests looking for rollover issues.

2. we have a calibration phase on power up, which means if there is a power problem in the air, then we cannot get control until calibration completes, which is not possible when we are frantically yanking the stick trying to regain control so big trouble there. we need a good way to recover on power events, and yet be able to calibrate. currently, the plan is to use the eeprom to save last known good values and allow the controls to work during calibration.

a good test would be to simulate the entire flight on the ground (eg with long flights, all kinds of stick movements and gain adjustments, simulate power failures, etc). and if the system performs as expected, at least that will provide a data point in the test effort. but, we are probably not there yet.

by end of today, i'll probably merge the timer0_servo_part1 dev branch back into master, that will have the rollover fix and several other improvements to reduce latency and interrupt intereference (the notes are all available at github - https://github.com/noobee/FlightStab...r0_servo_part1). in particular, i've also disabled timer0, which is a core arduino library service. but this also _significantly_ reduced jitter. the next important one is handling power cycles in the air.

thanks!
noobee is offline Find More Posts by noobee
Last edited by noobee; Jan 16, 2013 at 08:37 AM.
Reply With Quote
Old Jan 17, 2013, 05:00 AM
Registered User
Joined Dec 2006
1,437 Posts
an update:

another round of improvements and fixes. the build files are at:

https://github.com/noobee/FlightStab/tree/master/Builds

the notable changes are:
- disabled timer0 and avoid micros(). this _significantly_ reduced the jitter on the servo output side.
- synchronized the servo output frame generation with rx input frame reception. right now, it is still at the frame level. the end goal is at the channel level.
- fixed rollover issue with timer1 (hopefully ).
- used lock-free implementation of internal routines to read timer1 and to copy rx vars. Avoid the need to disable interrupts in these cases.

next set of planned changes:
- handle power glitch/cycle in the air case, by not insisting on completing calibration
- servo sync at the channel level instead of the frame level to reduce further latency between tx stick and servo out.

i would still continue to recommend this image for ground testing only, particularly because any power glitch/cycle in the air will completely disrupt the system.

thanks!
noobee is offline Find More Posts by noobee
Last edited by noobee; Jan 17, 2013 at 05:12 AM.
Reply With Quote
Old Jan 17, 2013, 05:34 PM
Registered User
matrixFLYER's Avatar
Italy
Joined Nov 2011
382 Posts
I've never done this kind of thing like flashing something except mobile phone
Can someone provide a noob guide? I would like to put it on my v1 to enable remote on off.
A friend can lend me an hobby king avr programmer. Is soldering required??
Thanks!
matrixFLYER is offline Find More Posts by matrixFLYER
Reply With Quote
Old Jan 17, 2013, 06:24 PM
Registered User
florida
Joined Nov 2002
179 Posts
It's not really finished yet.You can use the Hobbyking programmer but you will need to remove the jumper and power it thru the servo connections or you can damage the gyros.You would be better to wait til the final program is ready .
flightdeck is offline Find More Posts by flightdeck
Reply With Quote
Old Jan 18, 2013, 03:45 AM
Registered User
Hasi's Avatar
Austria, Stmk., Graz
Joined Sep 2011
415 Posts
I have another programming suggestion: If you read less than 1100us on the aux (gain) channel or on the individual pots, you could directly pass on the rx signal to the servos, without even scanning them.

digitalWrite(servo out pin, digitalRead(rx pin));

This way one can almost completely turn off the stabilizer for example if the gyros get crazy or a bug in the code happens. One could also plug in the throttle channel to the rudder, so that he only has to use 2 servo cables instead of 4. This of course would not work with delta and v-tail mixing.
Hasi is offline Find More Posts by Hasi
Reply With Quote
Old Jan 18, 2013, 06:36 AM
Life begins at transition
Australia, VIC, Sale
Joined May 2007
3,593 Posts
Good idea.
Avoiding digitalRead/Write will save a lot of lag, something like (for elevator)
PORTD&(1<<5) ? PORTB|=(1<<1) : PORTB&=~(1<<1)
is much quicker, but does the same...
Odysis is offline Find More Posts by Odysis
Reply With Quote
Old Jan 18, 2013, 06:48 AM
Deviant
sbstnp's Avatar
Joined Jul 2012
1,167 Posts
Quote:
Originally Posted by Odysis View Post
Good idea.
Avoiding digitalRead/Write will save a lot of lag, something like (for elevator)
PORTD&(1<<5) ? PORTB|=(1<<1) : PORTB&=~(1<<1)
is much quicker, but does the same...
Both digitalRead and digitalWrite are much slower (but more convenient) than the C counterparts.

I just got my V2 from HK, and this weekend I'll begin testing after I rig the flashing device.

Found this after a short search, no idea if it is of any use since I haven't read a single line of code.
http://code.google.com/p/digitalwritefast
sbstnp is online now Find More Posts by sbstnp
Last edited by sbstnp; Jan 18, 2013 at 06:55 AM.
Reply With Quote
Old Jan 18, 2013, 09:08 AM
Registered User
Joined Dec 2006
1,437 Posts
great ideas.

shadowing or mirroring the rx input levels directly to the servo output will also present the lowest latency through the system. that would require a very tight loop that is dedicated only to this copying (which could be the case in a failsafe scenario). also, the other note is that the mixer is not in this loop, so this would work only for the non-delta non-vtail case.

added: the other interesting bit i find is that i keep replacing or disabling more and more arduino lib functionality and going direct to avr lib as we go along. first it was replacing i2c, then disabling timer0 and replacing it with a higher precision timer1, then writing atomic read code that avoid interrupt disable, then short circuiting the main loop. now, their pin number abstraction (and the accompanying digital read/write functions) looks more and more like a candidate to remove in the future.
noobee is offline Find More Posts by noobee
Last edited by noobee; Jan 18, 2013 at 10:40 AM.
Reply With Quote
Old Jan 18, 2013, 08:29 PM
Life begins at transition
Australia, VIC, Sale
Joined May 2007
3,593 Posts
it's how I write for avr's too. Start at Arduino, because it's easy. Once it works OK, drop down to C. If I need more speed, add bits of asm where needed. That way debugging is nice and easy!

Doing well, it'll be great to see this thing get airborne - then the fun can really begin
Odysis is offline Find More Posts by Odysis
Reply With Quote
Old Jan 18, 2013, 08:47 PM
Registered User
Yashiro's Avatar
chiba, Japan
Joined May 2004
61 Posts
V2 was tried flapperon
Open Flight Stabilizer "FlightStab" (1 min 23 sec)


noobee Thanks!
Yashiro is offline Find More Posts by Yashiro
Reply With Quote
Old Jan 19, 2013, 06:35 AM
Registered User
Joined Dec 2006
1,437 Posts
very nice! thanks for the video.

is this with the latest build? did you notice much jitter for your servo? quite abit of effort was spent to reduce it.

i'm almost done with the power-cycle-safe calibration changes.


Quote:
Originally Posted by Yashiro View Post
V2 was tried flapperon
http://youtu.be/0DUirT6YXZc

noobee Thanks!
noobee is offline Find More Posts by noobee
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Sold Flight Stabilization System with Programing Card Woody_99 Aircraft - Electric - Helis (FS/W) 1 Mar 23, 2012 12:50 PM
Sold Flymentor Flight Stabilization with Field Programmer Woody_99 Aircraft - General - Radio Equipment (FS/W) 0 Mar 17, 2012 07:43 AM
Sold Totally Tricked out 400 size with flight stabilization installed, BNF Woody_99 Aircraft - Electric - Helis (FS/W) 2 Mar 12, 2012 06:56 AM
Wanted FY-30A Flight Stabilization System Casey_S FPV Equipment (FS/W) 0 Mar 05, 2012 02:40 PM