Support for walkera telemetry.

More
08 Apr 2015 07:11 #30900 by vlad_vy

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

More
09 Apr 2015 15:39 #30936 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
There is the problem with GPS telemetry. All values always are zero with red background. Tested with nighly build and v4.01 release, the same result.

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.

More
10 Apr 2015 05:08 - 24 Apr 2015 06:25 #30974 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
Now I use latest nightly build with some code changes:

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:
Last edit: 24 Apr 2015 06:25 by vlad_vy.

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

More
10 Apr 2015 14:03 #30986 by PhracturedBlue
Replied by PhracturedBlue on topic Support for walkera telemetry.
Thanks vlad,
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.

More
11 Apr 2015 04:41 #31030 by PhracturedBlue
Replied by PhracturedBlue on topic Support for walkera telemetry.
Vlad, can you test this:
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.

More
11 Apr 2015 06:59 #31032 by linux-user
Replied by linux-user on topic Support for walkera telemetry.
Hi,
got "loss of connection" with deviation-devo10-v4.0.1-b9992c1

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

More
11 Apr 2015 07:29 - 11 Apr 2015 07:37 #31033 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
Sorry, PB, it was false alarm :( . Devo GPS now work fine. I don't know what was the reason, I tried to get GPS telemetry 2 times with nigthly build and 4.0.1, both times I wait about half a hour, without result. Probably it was low signal from sats.

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.
Last edit: 11 Apr 2015 07:37 by vlad_vy.

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

More
11 Apr 2015 09:28 - 24 Apr 2015 06:25 #31036 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
I have not clue what to do with "loss of connection".

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:
Last edit: 24 Apr 2015 06:25 by vlad_vy.

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

More
14 Apr 2015 00:37 - 14 Apr 2015 08:24 #31145 by Indigo
Replied by Indigo on topic Support for walkera telemetry.
I haven't been able to successfully Abort Receive in a reliable way. Aborting itself seems to cause a lock-up.

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
Last edit: 14 Apr 2015 08:24 by Indigo.

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

More
14 Apr 2015 04:55 - 14 Apr 2015 05:35 #31150 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
Do you tried to start any TX or RX mode after Sleep mode? Somewhere I've reed that it doesn't work, only over Idle mode.

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) {};
after that I can't connect at all.

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
Last edit: 14 Apr 2015 05:35 by vlad_vy.

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

More
14 Apr 2015 07:44 - 14 Apr 2015 07:57 #31152 by linux-user
Replied by linux-user on topic Support for walkera telemetry.

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.

Confirmed! "Indigo 47484e7" not working on (Devo10 MiniCP, V120d02s)
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?
Last edit: 14 Apr 2015 07:57 by linux-user.

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

More
14 Apr 2015 08:19 #31153 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
linux-user, can you say more info about your Tx? Additional modules, other mods?

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

More
14 Apr 2015 08:28 #31154 by Indigo
Replied by Indigo on topic Support for walkera telemetry.
Ok, forget that version. I think problem was with changes to Devo telemetry code.

Please try new version e1675bd now uploaded to Test Builds

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

More
14 Apr 2015 08:36 - 14 Apr 2015 08:41 #31155 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
It doesn't help greatly, several seconds and connection lost. Before it throttle work jerkily and LED blinking.
Last edit: 14 Apr 2015 08:41 by vlad_vy.

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

More
14 Apr 2015 09:50 #31157 by linux-user
Replied by linux-user on topic Support for walkera telemetry.

vlad_vy wrote: linux-user, can you say more info about your Tx? Additional modules, other mods?

Hi vlad,
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.

More
14 Apr 2015 10:50 #31160 by Indigo
Replied by Indigo on topic Support for walkera telemetry.
I see the problem.
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.

More
14 Apr 2015 10:58 - 14 Apr 2015 11:03 #31161 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
It doesn't work.
Last edit: 14 Apr 2015 11:03 by vlad_vy.

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

More
14 Apr 2015 11:16 - 14 Apr 2015 11:20 #31162 by linux-user
Replied by linux-user on topic Support for walkera telemetry.

vlad_vy wrote: It doesn't work.

Different experience with 2276207 here:

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
Last edit: 14 Apr 2015 11:20 by linux-user.

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

More
14 Apr 2015 11:51 #31164 by vlad_vy
Replied by vlad_vy on topic Support for walkera telemetry.
Checked once again. Periodically I lost control, in 30 seconds Ladybird twice fall down.

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

More
14 Apr 2015 14:05 #31168 by Indigo
Replied by Indigo on topic Support for walkera telemetry.
Ok, I made function CYRF_RxPacketIsGood() similar to the code used in db5dcb3.

New version 3123e28 is available in Test Builds.

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

Time to create page: 0.111 seconds
Powered by Kunena Forum