- Posts: 1868
Serial out for LRS boxes
- hexfet
- Offline
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.
- xfapv
- Offline
- Posts: 23
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.
- Elmtree
- Topic Author
- Offline
- Posts: 60
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.
- sbstnp
- Offline
- Posts: 649
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
FrSky Taranis + TBS Crossfire
Please Log in or Create an account to join the conversation.
- Elmtree
- Topic Author
- Offline
- Posts: 60
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
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.
- Elmtree
- Topic Author
- Offline
- Posts: 60
I'll continue work this weekend
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
Please Log in or Create an account to join the conversation.
- xfapv
- Offline
- Posts: 23
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
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.
- Whiffles
- Offline
- Posts: 22
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
Please Log in or Create an account to join the conversation.
- Elmtree
- Topic Author
- Offline
- Posts: 60
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
Please Log in or Create an account to join the conversation.
- Elmtree
- Topic Author
- Offline
- Posts: 60
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
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 .
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
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.
- Elmtree
- Topic Author
- Offline
- Posts: 60
Please Log in or Create an account to join the conversation.
- hexfet
- Offline
- Posts: 1868
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.
- Whiffles
- Offline
- Posts: 22
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- Serial out for LRS boxes