New Hubsan Upgraded Version on the way
- stevecox
- Topic Author
- Offline
- Keep swinging
www.hobbywow.com/en-preorder-new-version...f-2-4ghz-p234150.htm
Adelaide
Please Log in or Create an account to join the conversation.
- jason4207
- Offline
- Posts: 59
Please Log in or Create an account to join the conversation.
- farad
- Offline
- Posts: 11
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
I'm not buying any more RC equipment at the moment though.
Does anyone know if the new tx will bind with the old hubsan? I assume so if the current Hubsan protocol will bind.
If so, someone could donate one of the new Tx to me (I only would need to the Tx) and I could work on it.
Please Log in or Create an account to join the conversation.
- jason4207
- Offline
- Posts: 59
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I'll try to hack through it, but I may require some help :
Where should I place my probes ?
I guess it's near the screen, any notes from the v1 ?
Can the protocol be analyzed with Saleae logic, is it SPI or something similar ?
edit: OK, i see the trace from the mcu to the a7105, won't be easy to hook, have to do it at the SOIC level... will sck & sdio do for the analyze or do I require additional connection(s) ?
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I'm craving to do the analyze but I can't do it now because a storm is approaching, not the best time to play with the soldering iron...
I'll probably do it tomorrow, then I'll send my results.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Got the analyzer hooked up:
Seems promising:
*MOSI = SDIO, CLOCK = SCK
Is it normal that I have so much state transitions between what seems to be bytes ?
I'm using a SPI decoder with default settings, maybe I'm wrong ?
Note that it is the first time I use a logic analyzer, a new toy I got 2 days ago
Now I don't plan to reverse the entire protocol...
Can someone point me to the Hubsan X4 V1 protocol analyze so I can try to understand what happen when we send enable/disable leds or enable/disable flips command with the V2 ?
Thanks.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I found a V1 protocol analysis on rcgroups and I think I have something interesting now:
See this 20 00 00 00 80 00 sequence ? This is the beginning of the data transmission
Now I've to write a small code to extract those packets, add probes to the throttle and throttle trim- switches to trigger the capture when required then understand the new commands ...
Once again, this is the first time I do this and this is FUN
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
quote from rcgroups (data transmission packet format):
As you can see there's no definition for jj ... Looks like it is a 5th ChannelEx1: 20 00 00 00 80 00 7d 00 84 02 64 db 04 26 79 7b
Ex2: 20 00 00 00 80 00 7d 00 84 02 64 db 04 26 79 7b
aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp
cc : throttle observed range: 0x00 - 0xff (smaller is down)
ee : rudder observed range: 0x34 - 0xcc (smaller is right)
gg : elevator observed range: 0x3e - 0xbc (smaller is up)
ii : aileron observed range: 0x45 - 0xc3 (smaller is right)
llmmnnoo: Transmiter ID(?)
pp : checksum
Checksums:
The checksum is calculated as 256 - ((sum of the 1st 15 bytes) modulo 256)
On the V1 protocol it seems to always be 02
On the V2 here's what I have:
leds enabled / flips enabled :
20 00 00 00 80 00 78 00 83 0e 19 00 00 00 00 3e --> jj = 0x0e
leds disabled / flips enabled:
20 00 00 00 80 00 78 00 83 0a 19 00 00 00 00 42 --> jj = 0x0a
leds enabled / flips disabled :
20 00 00 00 80 00 78 00 83 06 19 00 00 00 00 46 --> jj = 0x06
leds disabled / flips disabled :
20 00 00 00 80 00 78 00 83 02 19 00 00 00 00 4a --> jj = 0x02
That's weird, because the current deviation code sends 0x02 (packet[9] = 0x02;), which should disable leds and flips but it doesn't.
Maybe that's because kk is always 0x64 in v1 (well, that's what I assume from deviation's source code, I don't have a v1 myself), it is always 0x19 with the v2.
... Or maybe that's because what seemed to be the TxID in v1 is full of 00s in v2 ?
... Or maybe the TxID is in fact kkllmmnnoo so v2's ID is 19 00 00 00 00 ?
I hope this is enough information.
I'm new there (got a Devo TX yesterday only ), who can I get in touch with to get it implemented ?
Attached is a dump of a complete v2 session, from switching the radio on then changing leds/flips state.
Thanks.
edit: sent a PM to PhracturedBlue
edit2: I'll try to setup a smt32 dev environment to make a patch myself, I can't guaranty anything as I'm an AVRetard basically
Please Log in or Create an account to join the conversation.
- sbstnp
- Offline
- Posts: 649
Looks like that's hard coded in the protocol implementation as a constant so basically it should be trivial to add support for lights/flips.
Check it out here:
bitbucket.org/PhracturedBlue/deviation/s...n_a7105.c?at=default
Line 191, function static void hubsan_build_packet()
If you are able to compile Deviation your can simply test this by modifying it directly (one value at a time) and bind with the aircraft. If it works then open the Champagne!
Devo 10 + 4in1
FrSky Taranis + TBS Crossfire
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Nice to see I'm not speaking in the void
I'll try to setup a smt32 dev environment and make the change...
The only issue is that I still have to actually learn how to use deviation, I only copied a few profiles to test a few copters and quads I have, but I'm still far from being able to make a profile by myself.
I Got the Devo 10 yesterday, had a DX6i before, deviation is a bitch to program by comparison
Well, Now that I know I'm not alone here I'll ask for help if required.
Thanks.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I bet something else happen in the bind phase, I need some sleep now, I'll continue my quest tomorrow.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Actually there's only one thing to do: modify jj value (packet[9] in hubsan_build_packet()), but there's a trick:
The hubsan X4 v2 (H107-L) will always starts with leds on / flips on, whatever the value of jj is. (that's why although current Deviation code sends 0x02, x4 v2's LEDs are on)
So if we want to start with leds off & flips on for example we shouldn't send a packet[9]=0x0a on the first frames, but 0x0e (default) for the first 100 frames then 0x0a for subsequent frames... That's what it does in the video and it works
My hardcoded test:
static void hubsan_build_packet()
{
memset(packet, 0, 16);
//20 00 00 00 80 00 7d 00 84 02 64 db 04 26 79 7b
packet[0] = 0x20;
packet[2] = get_channel(2, 0x80, 0x80, 0x80);
packet[4] = 0xff - get_channel(3, 0x80, 0x80, 0x80); //Rudder is reversed
packet[6] = 0xff - get_channel(1, 0x80, 0x80, 0x80); //Elevator is reversed
packet[8] = get_channel(0, 0x80, 0x80, 0x80);
static s32 cnt=0;
if( cnt < 100 )
{
packet[9] = 0x0e; // LEDs on, flip on for the 100 first frames
cnt++;
}
else
packet[9] = 0x02; // LEDs off, flips off
packet[10] = 0x64;
packet[11] = (txid >> 24) & 0xff;
packet[12] = (txid >> 16) & 0xff;
packet[13] = (txid >> 8) & 0xff;
packet[14] = (txid >> 0) & 0xff;
update_crc();
}
Now I've to make it work with switches...
I've to setup a bitbucket account, learn HG Mercurial basics :-/, clone the source repository, make a patch (based on modification made by PB for Flysky) and submit a patch...
Oh and of course make a deviation profile (that may be the hardest part actually )
Please Log in or Create an account to join the conversation.
- sbstnp
- Offline
- Posts: 649
Devo 10 + 4in1
FrSky Taranis + TBS Crossfire
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I got one yesterday, I only flew it twice because I spent all my time hacking the hubsan protocol and modifying Deviation
The PUMQ is a nice hacking platform, but I think it's far less robust than the X4, it looks like its arms may break just by staring at them (they're slimmer on the 1.1)
Would be cool to be able to reflash the x4's firmware to add a angle rate flight mode... Walkera devices are firmware upgradeable, I wonder if any progress has been made on flashing a custom fw to a lady bird for example.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
bitbucket.org/PhracturedBlue/deviation/p...l-for-hubsan-x4/diff
Now I'm having a hard time modifying the model.ini (I use the .ini from the x4 model thread as a base)
A bit of help with that would be welcome.
it's OK for the leds (Gear switch):
[channel 5]
template=simple
[mixer]
src=GEAR1
dest=Ch5
scalar=-100
curvetype=min/max
Now I'd like to have:
FMODE 0: 70% throws
FMODE 1: 100% throws, no flips
FMODE 2: 100% throws, flips enabled
But I've no idea of how to achieve that.
Needs to have Channel 6 < 0 to disable flips, >=0 to enable (defaults).
PM me if you want the compiled firmware for your TX.
(I'd like someone with a X4 v1 to test it too, to make sure I didn't break anything)
Help please, with all this hacking I still haven't had time to RTFM
edit 2013/08/22: updated profile with proper throttle curve and rud/ail/ele expos
Please Log in or Create an account to join the conversation.
- FDR
- Offline
goebish wrote: Now I'd like to have:
FMODE 0: 70% throws
FMODE 1: 100% throws, no flips
FMODE 2: 100% throws, flips enabled
But I've no idea of how to achieve that.
Needs to have Channel 6 < 0 to disable flips, >=0 to enable (defaults).
You simply have to do the same with the Ch6 as you did with Ch5, only you should use FMODE2 as the switch instead of the GEAR.
Use the DR&Expo template on AIL end ELE channels. You only need one switchable state with !FMODE0 (i.e. inverted FMODE0, which you can change by clicking on it) and use the scale to slow down the 1-to-1 (or EXPO) function...
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I now have a working profile (attached)
GEAR 0 -> lights on
GEAR 1 -> lights off
Throttle curve: 0/40/65/80/100%
FMODE 0: 75% throws / 60% RUD, -10% expo AIL/ELE, +30% expo RUD
FMODE 1: 90% throws / 70% RUD, -10% expo AIL/ELE, +30% expo RUD flips disabled
FMODE 2: 90% throws / 70% RUD, -10% expo AIL/ELE, +30% expo RUD flips enabled
RUDD D/R 1 -> throttle cut
edit 2013-08-22: proper throttle curve and ail/ele/rud expos
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- New Hubsan Upgraded Version on the way