Serial out for LRS boxes

More
18 Apr 2018 04:53 #68710 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
For a test jig I used sbus decoding code from betaflight. There's likely sbus encoding code out in the wild as well.

Mainly I was checking to see if the support functions you'll need are there. I modified UART_SetDataRate to support the 100kbps used by sbus. Currently working on adding a way to set parity and stop bits because sbus uses even parity and two stop bits. Suggest that I'll make a separate pull request for these changes and you can concentrate on the protocols. One reason for a separate PR is I'd like some discussion on the UART implementation which is unrelated to the protocols.

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

More
18 Apr 2018 05:42 #68711 by xfapv
Replied by xfapv on topic Serial out for LRS boxes

hexfet wrote: I modified UART_SetDataRate to support the 100kbps used by sbus.


Maybe you can already expand it to 400k for possible support of CRSF V2 in the next step.

I also got a spec documentation for the protocol from TBS. They said I shouldn't publish it. I will give you access over owncloud.

Thx for the coding! I looked into it but it is far way above my level...

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

More
18 Apr 2018 05:46 #68712 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes

hexfet wrote: For a test jig I used sbus decoding code from betaflight. There's likely sbus encoding code out in the wild as well.

Mainly I was checking to see if the support functions you'll need are there. I modified UART_SetDataRate to support the 100kbps used by sbus.


Forgot to fix this part of the code so that could be part of the issue. Thanks for working on the serial code!

Oh man, how complicated is the xfire protocol? Is the document you have a nicely organized spec sheet?

The reason I did sumd first was because it has a public spec sheet and uses normal baud rates and packets

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

More
18 Apr 2018 08:55 - 18 Apr 2018 09:00 #68714 by sbstnp
Replied by sbstnp on topic Serial out for LRS boxes

Elmtree wrote:
Oh man, how complicated is the xfire protocol? Is the document you have a nicely organized spec sheet?

The reason I did sumd first was because it has a public spec sheet and uses normal baud rates and packets


No public spec afaik, I can ask for one eventually.

OpenTX implementation should help a bit.
XF frame encoding: github.com/opentx/opentx/blob/2.2/radio/...pulses/crossfire.cpp
And the telemetry is in this folder: github.com/opentx/opentx/tree/2.2/radio/src/telemetry

Disclaimer: no idea if they're going to be useful or not. YMMV. It will definitely require some heavy refactoring since OpenTX is C++ not C.

I did want to give it a try some time ago but I haven't touched Deviation in a while and I lack motivation tbh.

Devo 10 + 4in1
Spektrum Dx9
FrSky Taranis + TBS Crossfire
Last edit: 18 Apr 2018 09:00 by sbstnp.

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

More
18 Apr 2018 17:00 #68722 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes
Downloaded. Thanks. I'll read up on it

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

More
18 Apr 2018 17:18 #68724 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
It might be better to remove and just offer to developers through pm. Don't want to get the forum in trouble for copyrighted material. The doc is well written and there's a lot there but doesn't seem unnecessarily complex.

My serialout branch is updated with code to set the parity and stop bits, but won't be able to test til later. If it works I'll make a pull request for just the UART_* changes.

According to the datasheet we should be able to support up to about 2Mbps on the serial link. Changed the SetDataRate function accordingly.

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

More
18 Apr 2018 19:57 #68730 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes
Getting the baud rate correct thanks to your uart.c change now gets me gibberish coming into the SBUS input, but at least something's coming in :D

I'll continue work this weekend

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

More
18 Apr 2018 23:02 #68733 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
The changes for setting parity and stop bits worked. The SBUS tester is now receiving the packets correctly, just with incorrect channel values. Created a PR for the UART_* changes.

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

More
19 Apr 2018 07:41 #68741 by xfapv
Replied by xfapv on topic Serial out for LRS boxes
Deleted the link to the spec sheet. If anybody needs it, let me know.

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

More
20 Apr 2018 19:49 #68769 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
Looks like supporting CRSF radio channels is pretty much the same as SBUS. Receiving telemetry will require the ability to receive serial data and to run the serial link half-duplex. I'll work on extending the UART API for this. Finally, supporting parameter setting such as OSD and VTX configuration will require some type of UI in deviation.

For the physical connection I couldn't find any info on the Crossfire JR module pinout, but Taranis information is available . The Crossfire connection is on the bottom pin of the JR module connector. This pin is unconnected on the T8SG-Plus. It will need to be connected to both UART tx and rx pins for Crossfire. Will need to add a wire from the bottom JR pin to the rx signal, which is available on a nearby connector. The tx signal could also be hard-wired, or could be connected at the trainer jack by making a plug that shorts tip and ring together. This would preserve the option to use the serial port full-duplex when not using Crossfire.

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

More
20 Apr 2018 19:56 #68770 by Whiffles
Replied by Whiffles on topic Serial out for LRS boxes
Interesting, so the T8SG Plus will require a hardware mod. It sounds like they at least provided a connector? I was wondering whether a software solution was all that's required or something will need to happen on the hardware level. This is promising!

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

More
20 Apr 2018 20:25 #68771 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
Just to be clear the Crossfire module can be used with the current T8SG-Plus by using the PPM protocol. The development being discussed is for supporting the CRSF serial interface.

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

More
20 Apr 2018 20:38 #68772 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes
Does it have a trainer port or not?

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

More
20 Apr 2018 21:24 #68774 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
The T8SG-Plus trainer port has uart tx and rx connected to tip and ring respectively. The tx signal also connects to the top pin of the JR module connector.

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

More
21 Apr 2018 02:01 #68778 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes
So could that be used for crossfire right? I'm using the trainer port for my LRS

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

More
21 Apr 2018 20:33 - 22 Apr 2018 00:00 #68783 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
Yes, the same uart pins are connected to both the trainer port and the JR module connector.

In the datasheet I found that the stm32 has hardware support for half-duplex on the tx pin, so only the tx signal will need to be wired to the bottom JR pin for CRSF JR module. No mod will be needed if using the trainer port.

I've added support for receiving serial data and made a pull request . A new protocol TESTSER is included as an example. Test build (6066a0b) available here .
Last edit: 22 Apr 2018 00:00 by hexfet.

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

More
27 Apr 2018 12:33 #68883 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
I've made a first pass at the CRSF protocol. Test build (5026091) is available . This build only supports the RC channel values. No telemetry or configuration yet. No Crossfire module to test with but output looks good on analyzer.

On the T8SG-Plus connect the top and bottom JR pins together. I confirmed with TBS support that if the CRSF signal is present on both pins their module will accept the CRSF protocol on the bottom pin. The CRSF protocol signal will also appear on the tip connection of the trainer port jack on all transmitters.

To use select the CRSF protocol. Please report results.

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

More
27 Apr 2018 12:35 #68884 by Elmtree
Replied by Elmtree on topic Serial out for LRS boxes
Thanks for the work on that. Sorry I haven't been able to work much on sbus. End of the semester crunch right now.

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

More
27 Apr 2018 14:05 #68885 by hexfet
Replied by hexfet on topic Serial out for LRS boxes
No worries. Wanted to put something together to test out the serial code.

Looks like the channel stuffing is the same for SBUS and CRSF so you should be able to reuse part of the code.

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

More
27 Apr 2018 16:07 #68891 by Whiffles
Replied by Whiffles on topic Serial out for LRS boxes
This is exciting news! I just purchased the Crossfire module, so I'll test it on my T8SG plus next week when it arrives.

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

Time to create page: 0.094 seconds
Powered by Kunena Forum