-
-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
bug 🐛Something isn't workingSomething isn't working
Description
Describe the bug
Using the ibus receiver class with an inverted line connected to a RP2040 mcu only yields 0 for all channels. The reason being that the ibus.setup() routine has architecture dependent code which does not honor the ibus._inverted flag.
A valid workaround is to add the inverting calls to the main sketch:
ibus receiver(&Serial1, SBUS_RX_PIN, SBUS_TX_PIN, true); // RP2040 requires a TX_PIN so to not hang up the mcu
void setup()
{
Serial1.setInvertRX(true);
Serial1.setInvertTX(true);
receiver.begin();To Reproduce
I can try to provide an example sketch that demonstrates using the ibus protocol with the rp2040, if this is required.
Additional context
The problematic code can be seen in this line:
Line 18 in b97e68f
| serialPort->begin(IBUS_BAUDRATE, SERIAL_8N1); |
The issue is resolved by adding two lines with calls to serialPort->setInvertRC() and serialPort->setInvertTX() before serialPort->begin(), changing the code to:
#elif defined(ARDUINO_ARCH_RP2040)
SerialUART *serialPort = (SerialUART *)_rxPort;
serialPort->setPinout(_txPin, _rxPin);
serialPort->setInvertRX(_inverted);
serialPort->setInvertTX(_inverted);
serialPort->begin(IBUS_BAUDRATE, SERIAL_8N1);
#else
Metadata
Metadata
Assignees
Labels
bug 🐛Something isn't workingSomething isn't working