Deviating a JoySway

More
03 Jun 2015 04:21 #33379 by PhracturedBlue
Replied by PhracturedBlue on topic Update on FHSS
I decided to take a break from Java coding, and look at this a bit.
Here is what I found:
1) The final byte is a simple sum of the previous 15 bytes
2) Each data is sent twice. one on channel 30h and again on the real channel (between 30h and 44h)
3) data packets are sent every 6msec
4) There is no feedback from the Rx
5) byte assignmnets:
0 ff or dd.  dd is sent  every 1.538 seconds (instead of a standard ff packet)
1 id1
2 id2
3 id3
4 id4
5 00
6 aileron (value 1e -  aa)
7 elevator (value 2e - aa)
8 64h
9 64h
10 throttle (value 00 - c6)
11 rudder (value 1e - aa)
12 64h
13 64h
14 aa
15 checksum

That should be enough to put together some protocol code for the joysway. I'll take a crack at it

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

More
03 Jun 2015 05:08 #33381 by PhracturedBlue
Replied by PhracturedBlue on topic Update on FHSS
Ok. I finished.
Try out the 'joysway' branch in the deviation team repo.
It is quick and dirty, and I locked the txid to the same one in your logs, but it should make it easy to verify if it works or not. If not, you probably need to capture the startup sequence from the devo radio so we can see what is different.

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

More
03 Jun 2015 12:07 #33389 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Doesn't build - undefined reference to `JOYSWAY_Cmds'.

hg doesn't report any new files between the default branch and the joysway branch. Did you forget to add the joysway protocol source before committing?

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
03 Jun 2015 12:34 #33391 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
oops. try it now

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

More
03 Jun 2015 12:42 #33393 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
B) It's an easy mistake to make. Thanks!

That builds. Unfortunately, I've got multiple Dr's appointments to get me or my mother to over the next three days, most of them over an hours drive away. I'm not sure when I'll be able to actually test it.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
03 Jun 2015 21:23 #33404 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Does not bind. If I bind to the Tx I tested with first, it connects. I have two Rx's, and both work that way.

One Rx works fine on channels 1-3, but channel 4 does nothing,. The other Rx is a two-channel and both channels (1 & 3) work fine.

Is there some other capture that would help with this? Binding or connecting with the other Tx, maybe?

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 01:45 #33409 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
hmm. how hard would it be for you to capture the spi traces from your Devo TX?
I assume by ch4 you mean the rudder?
How many channels do you have defined in the model setup?

I checked in a fix with minor changes that may or may not help.
There is now a #define called 'EVEN_ODD' you should try binding/controlling with values of both 0x00 and 0x01 and see if there is any difference.

What was going on during the 'bind' and 'connect' captures?

There is a state change missing from the captures, and I don't know if it is important.

in the init, connect, and bind files, The pattern (when seding the 'connect' packet) is:
ch:x ch:30 ch:0a ch:30 ch:30 ch:30 ch:x+2 ch:30

In the ail, rud, thr, ele files, the same pattern becomes:
ch:x ch:0a ch:x+1 ch:30 ch:x+2 ch:30
The EVEN_ODD define allows you to simulate one or the other of these patterns. There doesn't seem to be any way for the Tx to know that binding happened based on your logs, so it may well be this is irrelevant, but since your captures don't include the transition, I can't know. Unless you can capture 10-20 seconds worth of data (possible on the Saleae, but not all logic analyzers) we probably won't be able to capture this state change. Rerunning the captures might tell us if it is random or if we are actually missing something.

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

More
04 Jun 2015 04:24 #33411 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Capturing stuff from the Devo is liable to be hard. I would rather avoid it if at all possible.

Channel 4 is indeed the rudder output from the devo. I have four channels defined in the model setup. I just took an empty model & changed the protocol to Joysway.

The rudder channel now works in both the EVEN_ODD 00 and EVEN_ODD 01 builds. However, neither binds when I press the Rx bind button. Hitting re-init while the Rx is flashing doesn't seem to make any difference. Neither does whether or not an ID is set (though I didn't expect that to work based on what you said).

The connect capture is turning on the Rx. The bind capture is hitting the bind button on the Rx, which causes it to disconnect and then bind. If I turn on an Rx that is not bound to the Tx, it doesn't connect.

Could the difference in the pattern be whether or not the Tx thinks it's connected? In the init (tx-poweron?) capture, there is no Rx turned on, so it's never connected. In the connect capture, it starts out disconnected and then connects, and in the bind capture it starts connected, disconnects when the Rx starts a bind, then reconnects. For the other four, it's connected the entire time.

You want a 10-20 second capture. What should be happening then? And which captures would you like to rerun if that fails? And finally, do I need to do anything to make a bind happen? On the Joysway tx, that's not required - it sees the Rx binding, and just does so.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 12:54 - 04 Jun 2015 12:56 #33415 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
I'd want to see a capture during which you start with the Tx on, the Rx off, turn on the Rx, push the bind button, and successfully bind it. I'd want to see that whole sequence in a single capture, however long it takes. I don't need to see any stick movements. If you have trims, you may want to capture those in the same way you did ail, ele, rud, thr.

Also, no you shouldn't need to do anything on the Tx to bind the Rx. As I said, there doesn't seem to be any communication between the Tx and Rx that I can see so far.
Last edit: 04 Jun 2015 12:56 by PhracturedBlue.

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

More
04 Jun 2015 13:57 #33418 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
I think I found the binding problem. Try the latest code now, and let me know if it works.

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

More
04 Jun 2015 14:03 #33419 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Ok, done.

drive.google.com/file/d/0B72nhihrc01MLXB...RVk/view?usp=sharing

This starts with the Tx on and the Rx off. I turn on the Rx, hit the bind button on it, wait until it binds, then hit it again and let it bind again. I suspect that the missing transition was going from not bound to bound, as I think the other "bind" version started with the Tx bound.

The trims capture is all the trims button. What should have been the second aileron button press didn't happen, so I went back and added it at the end.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 14:58 #33423 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Ok, the current build binds, and all four channels work.

If the bind ID could do something useful, it'd be nice if that worked. Other than that, I'd say this was ready.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 15:48 #33427 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
I haven't looked at the trim data yet, but I did just turn in fixed-id support. I have no idea if it will work or not, but you can give it a go.

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

More
04 Jun 2015 21:03 #33434 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
The fixed ID version no longer binds.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 21:49 #33437 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
It is likely we'd need a capture from a 2nd Tx or from an Rx to resolve, since it implies there is more to it than just the 4 bytes in the packet.

However, you can test it a bit.
If you look in the initialize() function you can see the fixed_id parsing.
uncomment:
id = 0xf82dcaa0;
and comment out:
id = lfsr;
That should get it working again.
You can play with changing this number a little at a time and see if you can still bind.
Specifically, start by trying these values:
 0xf82dcabf
 0xf82dcaa1
 0xf82dc9a0
 0xf82dcba0
 0xf82ccaa0
 0xf82ecaa0
 0xf72dcaa0
 0xf92dcaa0

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

More
04 Jun 2015 22:13 #33438 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Just changing initialize to use a fixed id doesn't fix the bind issue.

I actually have 3 Joysway Tx/Rx pairs (that's pretty much the way they sell them). The most interesting two interoperate, but the third does not.

So, which is more useful? Going back to the working version and trying that set of ids, or captures from a second Tx? If the latter, will just the disconnnected->bind->connected state do, or do you need the full power on/bind/bind again?

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
04 Jun 2015 23:34 #33440 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
Sorry, my instructions weren't correct.
uncomment this:
id = 0xf82dcaa0;
and comment out this whole section:
    if (Model.fixed_id) {
        id = Model.fixed_id;
    } else {
        id = (Crc(&Model, sizeof(Model)) + Crc(&Transmitter, sizeof(Transmitter)));
    }
    u32 lfsr = 0xb2c54a2ful;
    if (Model.fixed_id) {
       for (u8 i = 0, j = 0; i < sizeof(id); ++i, j += 8)
           rand32_r(&lfsr, (id >> j) & 0xff);
    }
    // Pump zero bytes for LFSR to diverge more
    for (u8 i = 0; i < sizeof(lfsr); ++i) rand32_r(&lfsr, 0);
    id = lfsr;
That should put everything back the way it was previously. Then try the alternate values I provided.

Capturing from a 2nd tx will likely be more useful, but we might get lucky just playing with the txids, so I'd start there 1st.

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

More
05 Jun 2015 00:06 #33444 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
Ok, here's what I got. I tested them in order:

0xf82dcabf -- binds
0xf82dcaa1 -- binds
0xf82dc9a0 -- binds
0xf82dcba0 -- connects without binding
0xf82ccaa0 -- binds
0xf82ecaa0 -- connects without binding
0xf72dcaa0 -- doesn't bind
0xf92dcaa0 -- doesn't bind

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

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

More
05 Jun 2015 01:13 #33450 by PhracturedBlue
Replied by PhracturedBlue on topic Deviating a JoySway Tx.
what does 'connect without binding' mean?
can you try random values for the least significant 24 bits?
i.e. use 'f8xxyyzz' and just try a few random values and see how it works. If we can reliably bind all of those, we probably can call it good

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

More
05 Jun 2015 02:49 - 05 Jun 2015 02:52 #33452 by mwm
Replied by mwm on topic Deviating a JoySway Tx.
I tested the two ends of the range: 0xf8000000 & 0xf8ffffff. Those both bound.

I then added BSD's random ( svnweb.freebsd.org/base/stable/10/lib/li...n=256281&view=markup ) to the source, and had initialize add the low order 24 bits (all the bits are random) a new random number to 0xf8000000. Loaded that, hit bind on the Rx. Hit re-init, the Tx disconnected. Hit bind on the Rx again. It rebound. Did the reinit/bind thing a hundred times, and every time it disconnected as expected, and then rebound. The rebind times varied between instantaneous and taking most of a second.

Also tested 0xf7ffffff and 0xf9000000. Neither bound.

"connect without binding" means that after changing the value, building and installing the DFU, power cycling the Tx and turning on the Rx resulted in a connection. Other times, it needed to bind beforehand. I did the two that are reported as connecting without a bind twice, to make sure I hadn't skipped a step that might have left the old version on my Tx. I actually just reran them again to check again.

I could recreate this - but on a hit or miss basis - by tweaking one bit in the value after binding. Tweaking two seemed to fail regularly, even if I connected with the intermediate value.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.
Last edit: 05 Jun 2015 02:52 by mwm. Reason: Bug in markup handling - link formatting still busted, though ok in preview!

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

Time to create page: 0.072 seconds
Powered by Kunena Forum