- Posts: 3333
Support for walkera telemetry.
- vlad_vy
- Offline
vlad_vy wrote: Examples:
read.pudn.com/downloads139/doc/597220/CY...orial_1/main.c__.htm
Full set of examples:
en.pudn.com/downloads139/doc/detail597220_en.html
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
Tested with v3.00 release, GPS telemetry work fine. So, it's software problem.
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
1. Added int CYRF_RxPacketIsGood(u8 len) from Indigo:
int CYRF_RxPacketIsGood(u8 len)
{
unsigned rx_state = CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
if (rx_state & 0x02) { // receive complete
if (!(rx_state & 0x01)) { // RXC=1, RXE=0 then 2nd check is required (debouncing)
rx_state |= CYRF_ReadRegister(CYRF_07_RX_IRQ_STATUS);
}
CYRF_WriteRegister(CYRF_07_RX_IRQ_STATUS, 0x80); // need to set RXOW before data read.
u8 length = CYRF_ReadRegister(CYRF_09_RX_COUNT);
if (((rx_state & 0x25) == 0x20) && length == len) {
// good data (complete with no errors)
return 1;
}
// else bad data, empty buffer
while (length) {
CYRF_ReadRegister(CYRF_21_RX_BUFFER);
length--;
}
}
return 0;
}
2. Disabled RXOW EN bit at cyrf_init() section. It doesn't work without article (1), telemetry started and then freezed. I don't understand why we need overwrite Rx buffer before read. For DSM protocol RXOW EN bit disabled by default.
CYRF_WriteRegister(CYRF_06_RX_CFG, 0x48);
"Bit 1 Overwrite Enable. When this bit is set, if an SOP is detected while the receive buffer is not empty, then the existing contents of receive buffer are lost, and the new packet is loaded into the receive buffer. When this bit is set, the RXOW IRQ is enabled. If this bit is cleared, then the receive buffer may not be over-written by a new packet, and whenever the receive buffer is not empty SOP conditions are ignored, and it is not possible to receive data until the previously received packet has been completely read from the receive buffer."
3. At CYRF_SetTxRxMode(enum TXRX_State mode) we can use:
CYRF_WriteRegister(0x0F, 0x28); //FRC END + "Synth Mode (TX)"
instead
CYRF_WriteRegister(0x0F, mode == TX_EN ? 0x28 : 0x2C);
It work fine. All related CYRF registers at all CYRF related protocols have the same setup. No matter what we will write to CYRF_0F_XACT_CFG = 0x0F register, "Synth Mode (TX)" or "Synth Mode (RX)", result will be the same. But it required, since some protocols init with Idle mode. It's not implemented, but tested and verified with Devo and DSM protocols.
With these changes Devo protocol telemetry work much better, I have not any temporary freezed values or sporadical wrong values. Very stable Devo telemetry. DSM telemetry also work fine.
Nice work Indigo!!! Thank you for your finding!!!.
Attached changed files:
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Here is a build with Vlad's changes incorporated into the nightly builds:
www.deviationtx.com/downloads-new/catego...o-fixes-for-devo-dsm
linux-user, can you test this and see if you still have issues?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
www.deviationtx.com/downloads-new/catego...dblue-devo-telem-log
It is the same as the build above with your changes, but it includes a new log screen (near the about menu) which will show log messages. I added a few debug messages related to the Devo GPS telemetry. Maybe you'll see any of:
LONG : We parsed a Longitude packet
BP: ## ## ## - ## ## ## Bad packet
CYRF:BadRead: Read Reg04 timed-out
I don't know if any of these will trigger, but I don't see any difference between 3.0.0 and 4.0.1 with respect to how the GPS data is parsed.
This logging setup is new, and I don't know how reliable it is yet. Fundamentally it has a race condition since the code isn't trheadsafe, and printf can execute from interrupt context, so there will be some log corruption. Hopefully minor though.
Please Log in or Create an account to join the conversation.
- linux-user
- Offline
- Posts: 271
got "loss of connection" with deviation-devo10-v4.0.1-b9992c1
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
By the way, your test build is dangerous. After use I cannot power on Devo8s (black screen) and power off (red light at top), I need to disconnect the battery. I can flash firmware, but it doesn't help. Cured by flashing original firmware, then Deviation from scratch.
P.S. Anybody know if there is a battery inside Walkera GPS sensor? Spektrum GPS sensor has small rechargeable battery inside.
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
Last resort: added CYRF_RX_Abort() before enabling TX mode, for Devo protocol only.
void CYRF_RX_Abort()
{
if (CYRF_ReadRegister(CYRF_05_RX_CTRL) & 0x80) // We're still in receive mode
{
// Disrupt any pending receive by enabling abort
// Force End State should not be used to abort a receive if a SOP has already happened.
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x20);
CYRF_RxPacketIsGood(0x10);
// Abort by writing the FRC_END_STATE bit in the XACT_CFG register.
CYRF_WriteRegister(CYRF_0F_XACT_CFG, CYRF_ReadRegister(CYRF_0F_XACT_CFG) | 0x20);
// Disable abort
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00);
}
}
Attached changed files:
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
However, I have improved the code to prevent a lock-up occurring.
For example, when forcing a mode change, wait for FRC_END state to clear.
if (mode == TXRX_OFF)
CYRF_WriteRegister(CYRF_0F_XACT_CFG, 0x20); // force sleep mode
else
CYRF_WriteRegister(CYRF_0F_XACT_CFG, 0x28); // force Synth(TX) mode
// Wait for the FRC_END_STATE bit in the XACT_CFG register to clear
while(CYRF_ReadRegister(CYRF_0F_XACT_CFG) & 0x20) {};
Latest code is available here .
To download a test build, click on Downloads (link on left),
then click on Test Builds and then [Indigo]Devo/DSMx Telemetry Updates
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
I've tested this build (47484e7), it's non-working. Can connect my Ladybird once only, telemetry doesn't work at all. Will be better to return 'cyrf6936.c' to previous state.
I've tried to use:
//Set the post tx/rx state
CYRF_WriteRegister(0x0F, mode == TX_EN ? 0x28 : 0x2C);
// Wait for the FRC_END_STATE bit in the XACT_CFG register to clear
while(CYRF_ReadRegister(CYRF_0F_XACT_CFG) & 0x20) {};
It seems that too frequent register reeding lead to problems.
I done 40 hours test (telemetry enabled) with PB test build, Rx still connected. Unfortunately I had power outage and need start the test from the beginning.
www.deviationtx.com/downloads-new/catego...o-fixes-for-devo-dsm
Please Log in or Create an account to join the conversation.
- linux-user
- Offline
- Posts: 271
Confirmed! "Indigo 47484e7" not working on (Devo10 MiniCP, V120d02s)vlad_vy wrote: I've tested this build (47484e7), it's non-working. Can connect my Ladybird once only, telemetry doesn't work at all. Will be better to return 'cyrf6936.c' to previous state.
It does connect, and every now and then telemetry values are displayed,
but feels like if one frame every ~5sec were sent.
Would it make sense to make a long term test nevertheless to see if it would reconnect after some hours of operation?
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
Please try new version e1675bd now uploaded to Test Builds
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.
- linux-user
- Offline
- Posts: 271
Hi vlad,vlad_vy wrote: linux-user, can you say more info about your Tx? Additional modules, other mods?
it is a plain Devo10
The only thing I've done:
replaced AILE DR switch with a 3-pos switch, one side spring loaded
replaced CYRF module with another "genuine Walkera telemetry module" a year ago, because i suspected a fault with telemetry.
@Indigo
For me, e1675bd and 47484e7 feel the same:
not working on (Devo10 MiniCP, V120d02s)
It does connect, and every now and then telemetry values are displayed,
feels like if one frame every ~5sec were sent.
Please Log in or Create an account to join the conversation.
- Indigo
- Offline
- Posts: 230
In function CYRF_RxPacketIsGood() we must first check that receive is complete before we set RXOW bit.
RXOW disables buffer overwrite until contents of buffer is cleared. In effect we are locking the buffer for reading, but first we must wait for receive complete flag.
New version 2276207 available in Test Builds.
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.
- linux-user
- Offline
- Posts: 271
Different experience with 2276207 here:vlad_vy wrote: It doesn't work.
Basically it seems to work (Devo10 MiniCP)
But my first impression is, that range is reduced, compared to db5dcb3 (TX power set at 3mW)
But that would need more testing
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
New version 3123e28 is available in Test Builds.
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- Support for walkera telemetry.