- Posts: 4402
Deviating a JoySway
- PhracturedBlue
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
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
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
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.
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
However, you can test it a bit.
If you look in the initialize() function you can see the fixed_id parsing.
uncomment:
id = 0xf82dcaa0;
id = lfsr;
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.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
uncomment this:
id = 0xf82dcaa0;
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;
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.
- mwm
- Topic Author
- Offline
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.
- PhracturedBlue
- Offline
- Posts: 4402
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.
- mwm
- Topic Author
- Offline
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.
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- Deviating a JoySway