-
Notifications
You must be signed in to change notification settings - Fork 16.8k
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
ChibiOS: UART: Add support for RS-485 Driver Enable RTS flow control #26930
Conversation
Looks like this is not supported on F4's because there is no Edit: ifdef added. |
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.
looks good, I'd just like to do a bit of testing. I'll do that testing and get back to you
Interesting, I did not think we supported and RS-485 devices currently. You would still need the converter. This PR would remove the need for the |
I have used this on both a CubeOrange and a MATEKL431 periph node (I had to add the RTS/CTS pins to the hwdef). |
As discussed on the dev call, at some point I hope to rework the Torqeedo library to make use of this because it could improve reliability and/or allow higher data rates. We need to be careful though that it works on all processors (even the lower end ones). It's probably not supported on Linux board either. |
This adds support for outputting a driver enable signal from the UART. That is a line that is held high for the duration of a transmit. This is used with RS-485 transceivers. The STM32 has hardware support for this, so we just need to set the pin to the correct alternative function and set the bit in the UART config.
The new flow control type can be set with the
BRD_SERx_RTSCTS
param.This is MAVLink with it enabled:
![image](https://private-user-images.githubusercontent.com/33176108/326801545-f93aa829-95ac-4496-a747-9798b7776994.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMDg5MDMsIm5iZiI6MTcyMTEwODYwMywicGF0aCI6Ii8zMzE3NjEwOC8zMjY4MDE1NDUtZjkzYWE4MjktOTVhYy00NDk2LWE3NDctOTc5OGI3Nzc2OTk0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDA1NDMyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVmZWI5MmNmOTA3Yzk4YmFiMmU2OTNiNjA3ZDlmMTNhMWYzZTk0NGExYjQxNjlkNDY2ZjBhNThmMmRhOGQ5ZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.yzOZLgEr84fTza0rCnpcfxGgUeD1MEdESijrewr9m58)
Currently this just uses the default timings for the time the pin goes high before the transmit is started and the time it takes to go low after the transmit has finished. There are config registers we could use to change this if we needed to.
In order to know which alternate function to use the information must be passed in from the hwdef.