-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spektrum SRXL2 support incl. telemetry #13923
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is far too much of a cut&paste PR. The SRXL code is C code in a global namespace, it doesn't following our coding style and includes heaps of code that just isn't relevant to us. The telem code is a cut&paste from the frsky telem code. I'd like to see the use of common code so we don't just grow the flash usage by a huge amount. The use of static functions and callbacks makes no sense to me as it is communicating within a class. The CRC is duplicated from an existing CRC.
@tridge I can factor out the common pieces of the telemetry code - not a problem.
of course I then need to have the conversation with HH as to whether they would accept changes of that nature, but a conversation worth having I think.
|
On Fri, 3 Apr 2020, Andy Piper wrote:
https://github.com/SpektrumRC/SRXL2 for the changes that we deem necessary. The reason I think this is a good idea is because the protocol is relatively
Any reason not to use a submodule?
|
No reason, except I thought we changed this for CMSIS. Happy to change
to a submodule if that helps?
andy
…On 03/04/2020 23:51, Peter Barker wrote:
On Fri, 3 Apr 2020, Andy Piper wrote:
> https://github.com/SpektrumRC/SRXL2 for the changes that we deem
necessary. The reason I think this is a good idea is because the
protocol is relatively
Any reason not to use a submodule?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13923 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWCLTBPYDYOXT2GTSTC2DDRKZR5XANCNFSM4LV7ZEDQ>.
|
I did not realize rcinput ran in a separate thread. I see I have made a big error here by removing the semaphores. I will put them back. It's easily possible that this is the cause of my lockups. |
Ok refactored into AP_Telemetry to reduce duplication. I think I have also fixed the lockups which were a combination of semaphores and having the wrong options set on the outgoing uart. I have also fixed data rates based on info from HH and the result is much more stable. |
Just in case I didn't make this clear @tridge and @peterbarker spm_srxl.c and spm_srxl.h are identical to the ones in the Spektrum github project and is also the code they run in their hardware, so we really want to adopt it with as few changes as possible if at all possible. |
On Sat, 4 Apr 2020, Andy Piper wrote:
Ok refactored into AP_Telemetry to reduce duplication. I think I have also fixed the lockups which were a combination of semaphores and having the wrong
Something less generic than AP_Telemetry, perhaps?
AP_RC_Telemetry would be better, but perhaps there is something more
specific still?
|
Happy to go with whatever. Will use AP_RC_Telemetry unless you can tell me a better name! |
@andyp1per I like the changes you've made to use a common AP_Telemetry library, that helps a lot.
|
28c99d0
to
8dc1b8c
Compare
@tridge I have pulled in the necessary changes from your branch with a couple of slight modifications:
I have done a PR with these changes SpektrumRC/SRXL2#1 I've also made the packaging modifications you requested and the naming changes that @yaapu requested. It turns out that the UART changes I made for non-blocking/no-rtscts have made the bootup hang go away so I have removed that code. I have done the timing calculation and reduced the outbound budget to 2ms. Turns out we prevent DMA in half-duplex in ChibiOS so I have not tried to use 400k baud |
@andyp1per you missed PR #13846, you need to rebase |
@yaapu done - I don't have hardware to test - are you able to check I haven't broken anything? |
@andyp1per sure, I can test both sport and fport, for frsky telemetry there's also a PR #13850 to test basic functionality in Tools/autotest |
@andyp1per may I ask why did you remove the AP_Specktrum_Telem subtree, having both AP_RCTelemetry.* and AP_Specktrum_Telem.* in the same path it's not a clean layout IMO |
add support for temperature, battery voltage, battery current, flight pack altitiude, airspeed, attitude and compass, GPS, ESC telemetry based on BLHeli status messages and QOS packets. refactor into AP_Telemetry conditionally compile based on HAL_MINIMIZE_FEATURES don't initialize spektrum telemetry if there is no RC uart
refactor naming when using external data AP_Frsky_Telem::init() has to call AP_RCTelemetry::init() and exit. No need to initialize serial ports
switched spm_srxl.c to C++ compilation Correctly set budget for half-duplex writes Tidy PACKED and other externalities disable SRXL2 on IOMCU and softserial - SRXL2 is a serial half-duplex protocol-only fixed buffer overrun in SRXL2 parser fix bugs in decoder sketch and allow output to SITL
now we have @sys in master I'd like to see how much free stack we have left with SRXL2 running |
before the protocol is enabled:
after
|
Built ArduPilot for target mRO X2.1-777 both with andyp1per:pr-srxl2 and master after these changes were merged and cannot seem to get rcinput or telemetry to work with the SPM4651T. Sliders on Required Input>>Calibrate Radio are either blank or stationary (infrequently show anything when trying things but don't change) Build command: "c:/cygwin64/bin/python3.6m waf" (uavcan incorrect syntax error with python2.7)
Board settings have been combinations of Any ideas? Edit: Also tried setting BRD_SER1_RTSCTS=0 Have not reviewed the software but depending on implementation there might be a hardware problem? The handful of notes found on the subject involve a max3232 as a buffer but only saw mention of the TX pin used for connection
|
Sounds like you are doing the right things. I have this working on a Kakute F7 Mini and a Pixracer (F4). On the F7 I've swapped TX/RX (so option 12), on the F4 I am connected to the TX pin (so options 4). I've not tried that particular RX. There have been some firware updates, I guess you might want to try that first. It might be worth putting some debug in AP_RCProtocol.cpp:216 to see if you are able to read any data at all. |
Maybe also try disabling DMA on the port. I think we do this anyway for half-duplex, but worth a shot |
Baud should be 115 |
Switched firmware again and it is now working. The pop-up menus and text descriptions are missing on the full parameter list but here are the settings in case someone else runs into this SERIAL1_BAUD=115 |
There is a problem. I haven't quite figured out why yet but communication is only intermittent. I put a scope on the data lines, levels seem okay and I see lots of 0xA6 0x21 packets when the receiver light is illuminated then after some time the light begins flashing irregularly before staying off completely and the majority of packets are something like 0x05 0x80. The receiver seems to quit talking. I did also notice some voltage sag going to the receiver while it is transmitting and pk-pk current draw is around 50-90ma. It does not seem to be the supply to the FC, but could be because it is powered via USB. I'll try powering externally this evening but is a controller address 0x05 normal? |
For me, USB power was unreliable I had to power from the battery to get any kind of telemetry. |
Yes, it was power. Have to connect an external supply to the receiver power pin. Connecting to the Vin on the FC does not seem to do the trick so this guy must be a bit hard on the peripheral supply. Thanks again! |
Interesting! I think I might change from 3.3v Vdd to something a little more beefy |
Doesn't work with Kakute F7 AIO when connected either to SERIAL6 or SERIAL4. I flashed the 4.1.0dev firmware (master trunk) and set the following params:
Anything I am missing? |
@NitinJSanket on the AIO you have both RX and TX pins on RX6 - are you connecting to the RX pin? It should be: |
Works like a charm, I think I had messed-up the SERIAL6_OPTIONS with the TX/RX pin combo. |
Full support for SRXL2 and Spektrum Telemetry when using SRXL2.
Protocol is half-duplex, non-inverted. Setup is identical to that for FrSky passthrough.
The protocol requires half-duplex and therefore will not work on the IOMCU or with soft serial.
Flight test on a KakuteF7 Mini with these options: