Half-duplex serial configuration issue

Hello,

I am trying to interface my Pixhawk 4 with a servo that communicates over half duplex uart. For that purpose I wrote the following lua script.

local port = serial:find_serial(0)
assert(port, 'No scripting serial port found!')

port:begin(1000000)
port:set_flow_control(0)

function update ()
    gcs:send_text(0, "Sending FF FF 01 02 01 FB (ping)!")

    port:write(0xFF)
    port:write(0xFF)
    port:write(0x01)
    port:write(0x02)
    port:write(0x01)
    port:write(0xFB)

    gcs:send_text(0, "Exiting!")

    return update, 1000
end

return update, 1000
  • I connected serial4 Tx pin directly to the servo signal wire (also tried a small in series resistor).
  • I configured serial4_protocol to 28 (scripting).
  • I configured serial4_options to 4 (halfduplex).

I should get something like this (request message sent from autopilot and right after the reply from the servo)

But I do not get the response from the servo.

I ve already tested the servo using full duplex uart with my autopilot (and an extra board which exclusively converts full duplex to half duplex) and it works as expected. So the script and the messages sent are correct. My doubt is regarding:

  • the configuration. Apart from serial4_option → 4 do I need to do anything else?
  • the connection. Do I need to add any pull up/pull down/or anything similar?

That should work from a AP point of view, however sometimes the extra protection circuitry that the premium flight controllers have mean its harder for the servo to drive to the logic level. For FrSky telem, a 10K pull down is enough to get it working. If your logic analyser has a analogue mode you might see servo trying to reply but not reaching the logic level.

Thanks for the input. I tried what you suggested. Without any pull down (signal wire and ground) the device does not seem to try to respond.


This is a zoomed out version

I added a 10k pull down resistor just in case, but the signal was similar.

Sorry for the bad resolution of the oscilloscope.

UPDATE

The servo does actually respond. Probably I did some wrong measurements yesterday.

However the signal does not get to 0 but 0.6V. Tried 10k down to 1k resistors but not much changed. Below you can see the resulted signal.

Any ideas on how to fix this?

(2V/div)

It could be that the input protection circuitry is just incompatible with half duplex. 0.6v should be just low enough to get you to low logic state on a 3.3v system.

You could see if one of the nativity supported half duplex telem protocols works (frsky Fport for example), or you could try on another flight controller, typically if it has solder pads rather than connectors there won’t be input protection.

1 Like

Double check, also, that you are actually using pulldown resistors rather than simply installing them in series.

1 Like