Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeaTalk 1 connection #7

Open
norbert-walter opened this issue Nov 25, 2021 · 10 comments
Open

SeaTalk 1 connection #7

norbert-walter opened this issue Nov 25, 2021 · 10 comments

Comments

@norbert-walter
Copy link

Implementation of SeaTalk 1 for M5Stack Atom with a special driver circuit for SeaTalk with a ATOMIC DIY Proto Kit.

@hwater
Copy link

hwater commented Mar 15, 2023

Anyone here for an interrupt driven bitbangling serial 9 bit driver for core0?
If i remember correctly, the z80 made it in software with autobaudrating up to 57000 Baud.
For an ESP32 ppppfffft.!

@hwater
Copy link

hwater commented Mar 16, 2023

Just for fun i just asked ChatGPG https://chat.openai.com/chat this Q: program esp32 seatalk 9bit

@hwater
Copy link

hwater commented Mar 16, 2023

and got:

#include <HardwareSerial.h>
#include <Seatalk.h>

#define SERIAL_RX_PIN 2
#define SERIAL_TX_PIN 3

HardwareSerial Serial9bit(1);
Seatalk seatalk;

void setup() {
  Serial.begin(4800);
  Serial9bit.begin(4800, SERIAL_9BIT, SERIAL_8E1, SERIAL_RX_PIN, SERIAL_TX_PIN);
}

void loop() {
  if (Serial9bit.available()) {
    byte data = Serial9bit.read();
    if (seatalk.parse(data)) {
      // Seatalk message received
      switch (seatalk.getMessageId()) {
        case SEATALK_DEPTH:
          // Handle depth message
          float depth = seatalk.getDepth();
          break;
        // Handle other Seatalk message types here
      }
    }
  }
  
  // Send Seatalk message example
  uint8_t msg[5] = {SEATALK_DEPTH, 0x02, 0x3F, 0x00, 0x00};
  Serial9bit.write(msg, 5);
  delay(1000);
}

I will try this if i connect my old fishfinder....

@wellenvogel
Copy link
Owner

As far as I know the ESP32 hardware uart cannot really handle 9 Bits.
When going for bitbanging (Software serial) I'm not sure if this will work reliable in the multi threaded environment we use here.
What I found an interesting approach is to use rmt:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/rmt.html
https://github.com/naffej/esp32-rmt-uart
Would give all the flexibility we need for 9 Bit (and would give us additional uarts for lore nmea0183)
But finally it's a lot about testing. For me it's difficult as I do not have any seatalk device to work with.

@hwater
Copy link

hwater commented Mar 16, 2023

This looks really impressive. Did not know this, mabe i will find some time for an deeper Look while next Lockdown.

Thanks a lot for your work in this boating community.

@oxbown
Copy link
Contributor

oxbown commented Mar 22, 2024

One idea...
ESP32 boards come with a protocol called RMT. The main purpose of the RMT is to transmit/receive IR signals
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/rmt.html

But in the magic world of programming..... some projects use the RMT to make custom protocols of transmission (like the PIO of the RP2040/RPI-pico)
https://github.com/naffej/esp32-rmt-uart
In that project use RMT to make custom UARTs
Could be adapted to read/write Seatalk. The library mentions 9bits support in the code

@wellenvogel
Copy link
Owner

yes - see my comment above.
I would consider this a really interesting feature - but I do not have any seatalk1 device for testing....

@norbert-walter
Copy link
Author

Hi Andreas, I have a old depth transducer ST60 Tridata from Raymarine with Seatalk1 protocol. If you want I can send you the transducer as test device.

@oxbown
Copy link
Contributor

oxbown commented Apr 15, 2024

This guy made a port of seatalk autopilot remote for esp32 board, the project use the espsoftwareserial library for 9 bit uart coms

@wellenvogel
Copy link
Owner

Yes, looks interesting. But without a device it will be hard...
In the moment I'm busy with some other tasks any way - but would be an interesting feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants