New Hubsan Upgraded Version on the way

  • stevecox
  • stevecox's Avatar Topic Author
  • Offline
  • Keep swinging
More
02 Jun 2013 18:07 #10504 by stevecox
New Hubsan Upgraded Version on the way was created by stevecox
This just seems sooo great,the current one is just awesome I cant wait. PB I am guessing there is a chance its gonna need a little tweak to get the leds going but lets see when they arrive.
www.hobbywow.com/en-preorder-new-version...f-2-4ghz-p234150.htm

Adelaide

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 03:49 #12159 by jason4207
Replied by jason4207 on topic New Hubsan Upgraded Version on the way
Just got mine today. Looking to figure out the LED and Flip switches on my Devo 7E.

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 08:08 #12163 by farad
Replied by farad on topic New Hubsan Upgraded Version on the way
Got mine too, I'd like to know how to turn lights off and enable anti-flip. I'm hoping that we can get something similar to the V959 update that allowed control of camera/lights.

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 14:10 #12164 by PhracturedBlue
Replied by PhracturedBlue on topic New Hubsan Upgraded Version on the way
That will require someone with one of the tx who also has a logic analyzer to snoop the protocol.

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.

More
12 Jul 2013 00:27 #12200 by jason4207
Replied by jason4207 on topic New Hubsan Upgraded Version on the way
Sent you a PM. :)

Please Log in or Create an account to join the conversation.

More
26 Jul 2013 20:29 - 28 Jul 2013 18:19 #12536 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I would be glad to help, I've got a X4 v2 transmitter and a 24MHz logic analyzer.

I'll try to hack through it, but I may require some help :blush::

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) ?

Last edit: 28 Jul 2013 18:19 by goebish.

Please Log in or Create an account to join the conversation.

More
26 Jul 2013 21:36 - 28 Jul 2013 16:29 #12537 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I found a better way to hook to the bus, it's located near the LCD screen, but not on the same side than on v1:

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.
Last edit: 28 Jul 2013 16:29 by goebish. Reason: add image full complete pinout

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 00:23 - 27 Jul 2013 01:43 #12540 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Ok, one flood later ...
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.
Last edit: 27 Jul 2013 01:43 by goebish.

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 12:40 - 27 Jul 2013 13:04 #12550 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Reporting my progress:

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 :)
Last edit: 27 Jul 2013 13:04 by goebish.

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 14:51 - 28 Jul 2013 16:35 #12552 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I think I got it :silly:

quote from rcgroups (data transmission packet format):

Ex1: 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)

As you can see there's no definition for jj ... Looks like it is a 5th Channel :)
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 :p), 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 ;)
Attachments:
Last edit: 28 Jul 2013 16:35 by goebish.

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 18:34 #12554 by sbstnp
Replied by sbstnp on topic New Hubsan Upgraded Version on the way
Nice job.

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
Spektrum Dx9
FrSky Taranis + TBS Crossfire

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 20:03 - 28 Jul 2013 13:08 #12559 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Hi sbstnp,

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.
Last edit: 28 Jul 2013 13:08 by goebish.

Please Log in or Create an account to join the conversation.

More
27 Jul 2013 23:49 - 27 Jul 2013 23:57 #12561 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I installed a smt32 environment and built my own .dfu firmware with modified hubsan_a7105.c to send frames with altered jj and kkllmmnnoo but this doesn't work, LEDs are still on :(

I bet something else happen in the bind phase, I need some sleep now, I'll continue my quest tomorrow.
Last edit: 27 Jul 2013 23:57 by goebish.

Please Log in or Create an account to join the conversation.

More
28 Jul 2013 12:40 - 28 Jul 2013 14:54 #12564 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Got it to work :evil:


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 :p)
Last edit: 28 Jul 2013 14:54 by goebish.

Please Log in or Create an account to join the conversation.

More
28 Jul 2013 15:31 #12571 by sbstnp
Replied by sbstnp on topic New Hubsan Upgraded Version on the way
Nice job. Would love to help but I sold my Hubsan V2, had it for 3 days only, it's too beginner oriented so I didn't like to fly it, self leveling ws too aggressive. So I had to let it go.

Devo 10 + 4in1
Spektrum Dx9
FrSky Taranis + TBS Crossfire

Please Log in or Create an account to join the conversation.

More
28 Jul 2013 15:49 - 28 Jul 2013 18:39 #12573 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I see you ordered a PUMQ 1.1 to replace it.

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.
Last edit: 28 Jul 2013 18:39 by goebish.

Please Log in or Create an account to join the conversation.

More
28 Jul 2013 20:43 - 22 Aug 2013 02:09 #12575 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I made a patch for deviation and submitted a pull request:
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
Attachments:
Last edit: 22 Aug 2013 02:09 by goebish.

Please Log in or Create an account to join the conversation.

More
29 Jul 2013 05:09 #12580 by FDR
Replied by FDR on topic New Hubsan Upgraded Version on the way

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.

More
29 Jul 2013 12:12 - 22 Aug 2013 02:35 #12589 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Thanks FDR,

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
Attachments:
Last edit: 22 Aug 2013 02:35 by goebish.

Please Log in or Create an account to join the conversation.

More
29 Jul 2013 13:14 #12591 by vlad_vy
Replied by vlad_vy on topic New Hubsan Upgraded Version on the way
Can you check if there is any packet code change in case Normal-Expert mode change. For my taste Hubsan is too lazy, seems it has some internal expo. I need to use quite large expo compensation in Tx. I wonder if internal expo can be swithed off.

Please Log in or Create an account to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum