I have tested a lot of examples found here to read and write RayMarine SeaTalk data, which is a proprietary Raymarine 9-bit data protocol.
I have tested Nick Gammon's latest (?, according to the website) mods to 'hardwareserial' in IDE 1.6.9 (the last version that is known to work with it) on an Arduino Mega, but cannot get it working correctly.
There are a lot of different versions of these files, and the mods are quite old. There are also some older topics regarding SeaTalk but they all either send or receive data. I can accomplish either one also, but not both of the using the same version of Nick Gammon's modified HardwareSerial files.
Is there anyone out there that has a working example for me that can read and write SeaTalk data, including the necessary libraries?
Raymarine: 4800 baud, 1 start bit, 9 data bits, 1 stop bit ? no parity ?
Should that 9th bit also be transmitted ? What is it ? Is it a checksum or parity ?
How important is it to read that 9th bit ?
Via RS-485 ?
Your best option seems to be a ESP32. Then look on Github if the library has many stars and if Issues are being fixed lately.
Serial/UART communication with 9 data bits is not uncommon. The Python programming language allows that option (if the hardware supports it). Even MicroPython that can run on a ESP32 or Raspberry Pi Pico allows 9 data bits.
I have built an autopilot for my sailboat based on the PyPilot open source autopilot. This is all working, but I would like to use a Raymarine standard autopilot control unit (ST7002) to control the autopilot. The ST7002 uses the SeaTalk protocol to talk to other equipment. Therefore I need to read SeaTalk messages that the ST7002 sends out when a button is pressed, and I need to write SeaTalk messages to put data on the ST7002's screen.
I do not have any ESP32 boards, and have some preference to get all this working on an Arduino Mega, but if the ESP32 will be a sure solution, than maybe I can have a look into that board.
What is not working ?
If you add the files of Nick Gammon's "HardwareSerial9bit.zip" to a project for your Mega board, does it compile ? or do you get communication problems when using it with the RayMarine equipment ?
I can not test the communication with RayMarine equipment myself, I'm afraid that I can not help any further.