Pixhawk4 mini: Use of RCIN as serial port

I have had multiple issues with my old Radiolink Pixhawk and decided to swap it with a Pixhawk4 mini that I had available. The job is almost completed. The only issue remaining is my solution to receive NMEA data from my echo sounder. This was working well on my old pixhawk using serial 4 and baud 4800. As the mini has less physical serial ports readily available I decided to use the RCIN.

Firmware 4.2.3 selected as this is what my old Pixhawk also had. And right now I want just to swap the autopilot without need to redo any tuning, firmware upgrade can come later.

In this documentation I read that the RCIN can be used as a regular serial port:
https://ardupilot.org/copter/docs/common-holybro-ph4mini.html
Quote:

The RCIN port can be used as RX or TX as a general UART using the SERIAL4_OPTIONS bits to swap pins

The options to “swap pins” using the options is not very precise. I may not have the correct settings as a result. I have tested using the following settings, so far without any success:

SERIAL4_OPTIONS = 0
SERIAL4_OPTIONS = 8

Cabling:
Further the same link has documentation for the RCIN pinout. I made an assumption that I should use the following pins:
1: 5V
2: TX
3: RX
4:
5: GND

Further settings:
SERIAL4_PROTOCOL = 23 (default value for PX4 mini, did not change it)
SERIAL4_BAUD = 4 (for 4800 as working well with my old Pixhawk)

Can anyone tell me if I am on the right track here? Most important when the boat is now opened, obviously, to get the physical cabling right. Settings can be played around with at any time.

disregard

Rx inversion should be set (Tx too? no idea) in OPTIONS, PROTOCOL needs to be 9.

EDIT: Nevermind, just had a look. Seems like you can use it either as SERIAL4 Rx OR Tx. SERIAL4_OPTIONS,0 would be Tx, SERIAL4_OPTIONS,8 Rx. I don’t actually think you need to mess with the inversion bits.

Thanks. In that case (either as TX or RX), how then about that cabling of the pins? As I have no need to speak to (only need to listen to) the device, RX on the RCIN is all I need.
Right now, RX is wired into pin 3:

image

To receive NMEA the rngfnd1 is set up with baud, type and min/max distances. And frame class set to 2 for boats. The SERIAL4_OPTION should have been set to 9 as you stated before editing the response, and overlooked detail from me. So now the only detail remaining is the physical cabling and then experimenting with settings.

Right, SERIAL4_PROTOCOL,9 was correct, didn’t mean to edit that one out. The Rx/Tx pin should be 2, and I assume SERIAL4_OPTIONS,8 should work.

There is another free UART, SERIAL5, assigned to the debug port. I am using this port for driving a Caddx Vista OSD.

1 Like

Thanks to both!

I had to give up the RCIN/SERIAL4. No matter what I did I could not get it to work. Solution from Gerd was instantly OK.

As my mini has an externally exposed debug port and the connector (not sure which type it is) came with the kit I built another variant of my interface to run on 3.3V instead of 5V. Debug port seems to be 3.3V only. Plugged it in, then set:
SERIAL5_PROTOCOL = 9
SERIAL5_BAUD = 4
And SERIAL4_PROTOCOL back to its default value of 23

Rebooted the autopilot. And the data was instantly available :slight_smile:

1 Like