- Posts: 33
Protocol Stacks
- rcH4x0r
- Topic Author
- Offline
The 'stack' consists of 3 modules:
Radio Resource Manager: This module is responsible for establishing radio links (Tx-Rx, Tx-Tx etc) and scanning/selecting the RF channels that are used (Walkera use a hopping sequence 12 packets long, 4 packets are transmitted on 3 channels). This is also where I propose to put the 'heartbeat' timer that triggers then regular transmission of packets
Radio Link Controller: This module is responsible for building the packets that are sent
Physical Layer: This module intialises the SoC's hardware (GPIO, SPI etc) and controls the radio chip
There are 3 protocols I would like to support:
Old Walkera 4/6/8 channels
New (Devo) Walkera 6/7/8/12 channels
DSM2
This is going to take a while to achieve
I have a cheap DSM2 Tx that came with my Champ aircraft which I want to hack into the Devo8. The reason is that we can very quickly actually test / use the Deviation FW even if the Walkera protocol isn't complete. Obviously the ultimate goal is to provide all the protocols using the native CYRF6936
I think this code should live in a directory at /src (i.e. /src/radio) since it will be applicable to all targets
Please Log in or Create an account to join the conversation.
- FDR
- Offline
rcH4x0r wrote: There are 3 protocols I would like to support:
Old Walkera 4/6/8 channels
New (Devo) Walkera 6/7/8/10/12 channels
DSM2
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
I do have a J6Pro for my nine-eagles Helis that I'd like to support on the Devo (it is also based on the CYRF6936). I haven't done any protocol work yet though.
As for your layer definitions, at what level do I choose the protocol? Is it effectively a different Radio Link Controller for each protocol with a shared Radio Resource Manager for all protocols, or do you have a different Radio Resource Manager for each protocol as well?
You said that the RRM is responsible for initializing the links and selecting channels, but each protocol may do this in very different ways (I'd like to add support for the A7105 (turnigy module) for the same reason you want to add the DSM2. I assume the steps will be similar (it is SPI, and I basically know the protocol to talk to it). I guess it'll be easier for me to understand once I see how your code is partitioned.
Please Log in or Create an account to join the conversation.
- FDR
- Offline
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
My idea is that a Walkera Devo-XX (WDXX) protocol is composed of a generic Walkera Devo RRM + the appropriate RLC (6/7/8/10/12 channel). The WDXX RRM/RLC normally sits on top of a CYR6936 PHY but a flexible stack would allow other PHYs
DSM2/A7105 module stacks will be mostly 'transparent' and very limited in functionality - no telemetry, no Tx -> Tx.
In all cases the RRM will provide the timing info required to send packets at the correct interval.
>>each protocol may do this in very different ways
Exactly, so we allow for separate WDXX RRM, old Walkera 4/6/8 RRM, DSM2 module RRM, DSM2 native RRM, A7051 RRM etc etc all doing their own thing. Each type of RRM will work with >= 1 RLC. DSM2 & A7051 modules will likely use the same, thin, RRM (different timer intervals ?) & RLC (different channel ordering ?) but the PHY is different (SPI vs DSM2???)
The DSM2 module stack should make a very good model for a A7105 module stack.
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.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
I don't know what the transmit rate is, I will measure it when I find my LA
Please Log in or Create an account to join the conversation.
- FDR
- Offline
Olders probably are on 22ms.
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
Please Log in or Create an account to join the conversation.
- FDR
- Offline
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
Please Log in or Create an account to join the conversation.
- FDR
- Offline
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
FDR wrote: May be, but it woldn't have too much sense sending commands more often, if the servos got new values only every 11ms anyway...
One reason _might_ be to allow for 1 or more packets to be lost during transmission. It makes even less sense for a switch on the receiver to control the rate of transmission.
FDR wrote: Well, it doesn't say anything about the transmit rate and how it is related to the servo's 11/22ms rate, so at the and you have to measure it, I guess...
No, it doesn't, it tells us what the function of the Rx switch is.
I was looking at my notes on the old Walkera system & that sends every 2.6ms
Please Log in or Create an account to join the conversation.
- FDR
- Offline
If it sends every 2.6ms, then the whole three frequency sequence will fit in the 11ms servo window, not to mention the 22ms one...
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
I have only looked at 4 channel Walkera gear & those 4 channels occupy a whole packet (stick position and trim values). It may well be that the protocol changes for 6 & 8 channel sets
What I don't understand is why Walkera transmit the stick position and the trim value. Makes no sense to me
Please Log in or Create an account to join the conversation.
- FDR
- Offline
One thing I can think of is: the onboard flybarless systems should handle the stick input and the trim value in a different manner. But still: how often do you change the trim within a flight?
I hope the devo protocol is a more deliberated one...
Please Log in or Create an account to join the conversation.
- FDR
- Offline
Not to mention if the interrupt can happen while writing a single multibyte value! Can it be, or they are one clock operations, as I think they are?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Offline
- Posts: 4402
Assigning a 32bit value is an atomic operation (non-interuptible), so you shouldn't need to worry about a single channel being corrupt.
Please Log in or Create an account to join the conversation.
- rcH4x0r
- Topic Author
- Offline
- Posts: 33
FDR wrote: I thought to a previous topic about the values, calculated by the main UI loop, and then sent by the interrupt: somehow it should be assured, that all the channel values sent out were calculated at once. Since the timer will interrupt the calculating process, it can happen, that for example two channels are freshly calculated, but the rest are from the previous task. I think it can be dangerous...
Not to mention if the interrupt can happen while writing a single multibyte value! Can it be, or they are one clock operations, as I think they are?
Don't worry about it, proper design will ensure that only a complete, consistent set of values will be picked up and sent. For example, interrupts will be disabled during the final step of processing, when the 'control mixer' is transferring a new set of data to it's output buffer ready for the transmission in the 'transmit' ISR
Please Log in or Create an account to join the conversation.
- FDR
- Offline
I dont think it would be catastrophic, just for exapmle in case of a mixed only channel, if the master value is from an other calculation than the mixed one, the rx will see it as a jittering or a random noise as opposed to the expected value, because sometimes it is right, but sometimes it's not. But you are probably right, it won't make too much difference in a few ms...
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- Protocol Stacks