29-Apr-2019, 08:31 AM
I was inspired by another member (bbffigjam) to look into turning off the hardware inversion circuit on F4 flight controller. And credit goes to teralift from a different forum for the information.
As many of you know, unlike F3 and F7, F4 MCU do not have a built-in inverter. Most manufacturers are adding an inversion circuit to one or two of their UART for use with Frsky SBUS and S.Port. In some cases, you can turn this inverter off. Any FC that uses a GPIO pin to trigger the inversion, this method below should work. Not everyone uses Frsky, this way they can reclaim back at least UART RX, if not also a UART TX.
I have only tested this on my CL Racing F4 which I have on hand.
The first thing to do is go to your target source code and see if your FC has a control pin for the inverter.
Goto Github betaflight source code.
Go into "src" folder.
Then "main"
And then "target" or click the link below
https://github.com/betaflight/betaflight...ain/target
Now look for the folder containing your target firmware and go into that folder.
Look for a file "target.h" and click on the file.
Look for the line
Note the pin number, in this case PC0 (pin C00). Also note the comment "PC0 used as inverter select GPIO". If you don't have the comment notation, I don't know if it will work or not. In my case, I only have one inverter that is selectable, even though my CL Racing also have a second inverter for the telemetry. I have not tested whether this inverter is used for both UARTs. When I am not too tired, I will test the inverter on telemetry.
Now that you have the information, connect your FC to Betaflight configurator.
Goto CLI
Type "resource". You should see a line like below. Remember my pin is C00, yours will likely be different.
Free the resource
That should turn the inverter off. But for some reason, the inverter is still on.
If you want to turn the inverter back on, you can reassigned the resource INVERTER back to C00, or you can manually trigger the PINIO
If you want to turn if off again
As many of you know, unlike F3 and F7, F4 MCU do not have a built-in inverter. Most manufacturers are adding an inversion circuit to one or two of their UART for use with Frsky SBUS and S.Port. In some cases, you can turn this inverter off. Any FC that uses a GPIO pin to trigger the inversion, this method below should work. Not everyone uses Frsky, this way they can reclaim back at least UART RX, if not also a UART TX.
I have only tested this on my CL Racing F4 which I have on hand.
The first thing to do is go to your target source code and see if your FC has a control pin for the inverter.
Goto Github betaflight source code.
Go into "src" folder.
Then "main"
And then "target" or click the link below
https://github.com/betaflight/betaflight...ain/target
Now look for the folder containing your target firmware and go into that folder.
Look for a file "target.h" and click on the file.
Look for the line
Code:
#define INVERTER_PIN_UART1 PC0 // PC0 used as inverter select GPIO
Note the pin number, in this case PC0 (pin C00). Also note the comment "PC0 used as inverter select GPIO". If you don't have the comment notation, I don't know if it will work or not. In my case, I only have one inverter that is selectable, even though my CL Racing also have a second inverter for the telemetry. I have not tested whether this inverter is used for both UARTs. When I am not too tired, I will test the inverter on telemetry.
Now that you have the information, connect your FC to Betaflight configurator.
Goto CLI
Type "resource". You should see a line like below. Remember my pin is C00, yours will likely be different.
Code:
resource INVERTER C00
Free the resource
Code:
resource INVERTER none
save
That should turn the inverter off. But for some reason, the inverter is still on.
Code:
resource PINIO 1 C00
save
If you want to turn the inverter back on, you can reassigned the resource INVERTER back to C00, or you can manually trigger the PINIO
Code:
set PINIO_CONFIG = 129, 1, 1, 1
save
If you want to turn if off again
Code:
set PINIO_CONFIG = 1, 1, 1, 1
save