davwys / arduino-sport-to-mavlink

Arduino Sketch for converting FrSky S.Port telemetry data to MAVLink format
18 stars 6 forks source link

ATmega 32U4 (Arduino Micro) not supported #1

Closed zosko closed 3 years ago

zosko commented 4 years ago

Hi, i have R9M 2019, i have try this but seems not working on mine side.

Taranis X9D 2019 -> R9M 2019 -> S.Port (from R9M 2019) -> Arduino Micro -> APM Planner 2.0

Is there big difference between R9M and R9M 2019 in that s.port ?

That is how i connected, what should i debug to find where is problem ?

Im using Arduino Micro (ATmega32U4) , and to able to compile for it i have change in

FrSkySportSingleWireSerial.cpp -> LINE 83

elif defined(__AVR_ATmega328P__) || defined(ESP8266)

to

elif defined(AVR_ATmega328P) || defined(ESP8266) || defined(AVR_ATmega32U4)

davwys commented 4 years ago

I think this is not due to the R9M 2019 (since S.Port is standardized for all FrSky devices), but rather due to the Arduino Micro / ATmega32U4, which is not officially supported by the S.Port library I'm using.

If you have an Arduino Nano, could you try using that? Since these boards are very cheap (<$2), it probably didn't make much sense for the developer of the S.Port library to implement support for non-328P boards, hence why it wouldn't work.

zosko commented 4 years ago

Okey, now im using Arduino Nano.

S.Port GND -> GND Arduino S.Port Signal -> 4.7Ohm -> D2 Arduino

Arduino powered by USB and connected to APM Planner 2.0 on 115200 Baud.

In iNav is selected Smart Port telemetry on 57600 Baud.

X4R currently im using, and on my Taranis i receive telemetry with iNav LuaTelemetry. But on this case i dont know how to GETOUT telemetry from Taranis to send to Arduino. I have 3 pins under battery cover (S.Port, VCC, GND) but seems not working maybe is lock. In Taranis HARDWARE menu i dont see anything about SERIAL.

I will make test with R9M2019 with R9 Slim+ receiver and let you know.

edit.. I have R9M2019 on ACCESS mode

Question: Do i need inverted signal ?

davwys commented 4 years ago

First, your baud rates should match on both - you can adapt the code on the Arduino to 57600, or change it in iNav. Second, since I don't know much about iNav: Do the sensors show up on your Taranis on the telemetry screen? Having them show up there (with the expected/normal FrSky sensor address) is required for the S.Port translation to work, as it won't recognize the sensors otherwise.

I would assume S.Port telemetry from the internal module gets forwarded to the Taranis module bay. This seems to be the case, as described here: https://github.com/opentx/opentx/wiki/Taranis-IO-ports If you have access to an XJT JR module, you could also test the Arduino setup by connecting to its S.Port and getting telemetry from there.

No, you should not need to invert the S.Port signal.