- Posts: 230
Support for walkera telemetry.
- Indigo
- Offline
If it looses binding for more than half a second it takes forever to rebind, and when it does rebind it easily looses binding again. Could this be a sync problem?
Up until the first long Hold occurs it works great, but then
Please Log in or Create an account to join the conversation.
- Thomas.Heiss
- Offline
- Posts: 698
Also applies to (DSMx) telemetry (lock) as my live flight tests (10) showed me with one-multiple holds
Is that the same case for Walkera telemetry then?
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
In this new version db5dcb3, all I've changed is the code for that (no other changes).
bitbucket.org/Indigo1/deviation/downloads
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.
- Indigo
- Offline
- Posts: 230
int i = 0;
while (! (CYRF_ReadRegister(0x04) & 0x02)) {
if(++i > NUM_WAIT_LOOPS)
break;
}
From version 72057cf was replaced with: CYRF_WaitForTxIRQ();
which was this :
void CYRF_WaitForTxIRQ()
{
int i = 0;
while (! (CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS) & 0x02)) {
if(++i > NUM_WAIT_LOOPS)
break;
}
}
And it is now this :
void CYRF_WaitForTxIRQ()
{
unsigned i = 0;
unsigned tx_state = 0;
while (! tx_state && ++i < NUM_WAIT_LOOPS)
tx_state |= (CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS) & 0x02);
}
}
A diff between branches dsm-telemetry and telemetry-test will show that as the only change.
BTW. My nanoQX has been sitting on bench for last 2 hours and it's still bound to Tx.
Update:
NanoQX battery went flat. When I last checked it, it was still bound after 2 hours and 20 mins.
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
WARNING:
Devo now uses same callback function for Telemetry OFF and ON. I did that to see if the problem would then appear with Telemetry OFF.
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.
- Indigo
- Offline
- Posts: 230
if (txState == 1) {
int i = 0;
while (! (CYRF_ReadRegister(0x04) & 0x02)) {
if(++i > NUM_WAIT_LOOPS) {
delay = 1500;
txState = 15;
break;
}
}
if (state == DEVO_BOUND) {
/* exit binding state */
state = DEVO_BOUND_3;
cyrf_set_bound_sop_code();
}
if(pkt_num == 0 || bind_counter > 0) {
delay = 1500;
txState = 15;
} else {
CYRF_SetTxRxMode(RX_EN); //Receive mode
- CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); //Prepare to receive
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x80); //Prepare to receive (do not enable any IRQ)
}
} else {
Note: delay and txState will not change if register 04 changes its value to 2. When this happens txState might never change from 1, so Tx lock is created.
And with Telemetry OFF shown below, txState always changes back to zero.
if (txState == 0) {
txState = 1;
DEVO_BuildPacket();
CYRF_WriteDataPacket(packet);
return 1200;
}
txState = 0;
int i = 0;
while (! (CYRF_ReadRegister(0x04) & 0x02)) {
if(++i > NUM_WAIT_LOOPS)
return 1200;
}
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
txState++;
So if register 04 changes its value to 2, will be txState=2.
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
The 2 wait loops are different, so how they get optimised and converted to machine code will be different.
A problem started on DSM and Devo after replacing these wait loops which a common function CYRF_WaitForTxIRQ(). The function was not reliable. I'll speculate that it was caused by ISR interrupting the conversion of u8 to u32.
OR'ing the u8 returned by ReadRegister with a u32 variable (I think) has fixed the problem introduced to DSM with the use of this new function CYRF_WaitForTxIRQ().
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.
- PhracturedBlue
- Offline
- Posts: 4402
Can you confirm the following:
The 1st post 'errors-2.txt' shows an Rx connection loss: www.deviationtx.com/forum/protocol-devel...etry?start=160#30384
The 'errors-bound.txt' file was captured with the Rx still able to connect in: www.deviationtx.com/forum/protocol-devel...etry?start=180#30392
The 'errors-loss-RXon.txt' was captured with the Rx unable to connect
the errors-2.txt and errors-loss-RXon.txt are basically the same (only difference is at the point of capture). errors-bound.txt has the registers in a very different state. Before I dig through them all, I want to make sure I understand what I'm looking at.
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
Bit 5 - Force End State. Setting this bit forces a transition to the state set in END STATE. By setting the desired END STATE at the same time as setting this bit the device may be forced to immediately transition from its current state to any other state. This bit is automatically cleared upon completion. Firmware MUST never try to force END STATE while TX GO is set, nor when RX GO is set and a SOP has already been received (packet reception already in progress).
Before switching to RX mode TX_GO bit always = 0 (wait loop), but before switching to TX mode we don't wait RX_GO bit = 0, so in case of any reception error (probably very rarely) RX_GO bit can remains = 1.
I think will be better before switching TX mode to check RX_GO bit, and if RX_GO = 1, forcibly exit from RX mode.
The recommended method to exit receive mode when an error has occurred is to force END STATE and then dummy read all RX_COUNT_ADR (0x09) bytes from RX_BUFFER_ADR (0x21) or poll RSSI_ADR.SOP (0x13) (bit 7) until set. See XACT_CFG_ADR (0x0F) and RX_ABORT_ADR (0x29) for description.
Please Log in or Create an account to join the conversation.
- linux-user
- Offline
- Posts: 271
Yes. In other words:PhracturedBlue wrote: @linux-user:
Can you confirm the following:
The 1st post 'errors-2.txt' shows an Rx connection loss: www.deviationtx.com/forum/protocol-devel...etry?start=160#30384
RX was unable to (re)connect, but I am unsure whether RX was powered on or off at the time of capture.
Note:
RX was never continuously running during my tests. So it is always a reconnection attempt.
It was captured while RX was still bound. (RX powered on and transmitting telemetry values)PhracturedBlue wrote: The 'errors-bound.txt' file was captured with the Rx still able to connect in: www.deviationtx.com/forum/protocol-devel...etry?start=180#30392
Yes. RX was powered on, but unable to connect.PhracturedBlue wrote: The 'errors-loss-RXon.txt' was captured with the Rx unable to connect
Yes.PhracturedBlue wrote: the errors-2.txt and errors-loss-RXon.txt are basically the same (only difference is at the point of capture).
Yes, that is to be expected.PhracturedBlue wrote: errors-bound.txt has the registers in a very different state.
To make the confusion complete here 2 more likely good ones:
I call it likely as I can't verify if RX would actually reconnect after capture has been taken
errors-good-delay-RXoff.txt - waited until telemetry-values got inverted after RX powered off
errors-good-instant-RXoff.txt - captured instantly after RX powered off.
Please Log in or Create an account to join the conversation.
- linux-user
- Offline
- Posts: 271
Checked again after 20h and connection was lost
Indigo,Indigo wrote: WARNING:
Devo now uses same callback function for Telemetry OFF and ON. I did that to see if the problem would then appear with Telemetry OFF.
can you explain this:
Should we now test with telemetry OFF and check if the error does occur there as well?
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
if(CYRF_ReadRegister(0x05) & 0x80) {
CYRF_WriteRegister(0x29, 0x20);
CYRF_WriteRegister(0x0F, 0x28); what will switch RX mode? 0x2C or 0x28 ???
CYRF_WriteRegister(0x29, 0x00);
}
CYRF_SetTxRxMode(TX_EN); //Write mode
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
Combining the 2 callbacks has reduced size of firmware and we need to verify that both modes are still functioning as normal.
I don't see how Telemetry OFF could now suffer from connection loss, but the protocol code is so critical I feel we need to test it anyway to be sure.
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
vlad_vy wrote: Abort the receive before switch TX mode, if RX_GO is active.
if(CYRF_ReadRegister(0x05) & 0x80) {
CYRF_WriteRegister(0x29, 0x20);
CYRF_WriteRegister(0x0F, 0x2C); what will switch RX mode? 0x2C or 0x28 ???
CYRF_WriteRegister(0x29, 0x00);
}
CYRF_SetTxRxMode(TX_EN); //Write mode
Answer is in Devo.txt in doc directory of source:
0x2C to change from Rx to Tx
0x28 to change from Tx to Rx
Why is it that DSM code sends 0x87 but Devo sends 0x80 to register 05 to put CYRF6936 into Rx mode, even thou document Devo.txt says to send 0x87.
Devo:
CYRF_SetTxRxMode(RX_EN); //Receive mode
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x80); //Prepare to receive (do not enable any IRQ)
DSM:
CYRF_SetTxRxMode(RX_EN); //Receive mode
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //Prepare to receive
Could this be why Devo Telemetry has this lockout bug and DSM doesn't?
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
Probably all will work with 0x80 to register 05.
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.
- Home
- Forum
- Development
- Protocol Development
- Support for walkera telemetry.