Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #15602
    drgorma
    Participant

    I have to run the M64 acoustic modem by a microcontroller (STM32) in which I cannot use Python. Are there any libraries and code examples in C or C++ for Water Linked modems I can use? Or, can I run the wlmodem library in MicroPython instead of Python 3?

    #15603
    wlkh
    Keymaster

    We haven’t tested the Python library on MicroPython, so I have no idea if it will actually work.

    The Python library has some fancy functionality which might not be needed in your application.
    You can actually communicate using the modems by typing the commands in a serial terminal directly.
    If you type the protocol example commands manually you should be able to get communication going:
    https://waterlinked.github.io/docs/modems/modem-m64-protocol/#examples

    Implementing the basic communication functionality should be fairly straight forward.
    I suggest ignoring the checksum to simplify the code (the checksum can be used to detect bit errors on UART but is not required)
    Setting configuration (channel, role) is persistent so you can set that manually in advance of using the modems.

    So the what you need to get the basic functionality working is:

    – Implement sending data. Ie. sending ‘wcq,8,’ then exactly 8 data bytes and then newline (‘\n’)
    – Implement reading packets back. Ie checking that the line you receive starts with ‘wrp,8,’. The next 8 bytes are the payload)

    Full protocol documentation is here:
    https://waterlinked.github.io/docs/modems/modem-m64-protocol/

    #15615
    drgorma
    Participant

    Thanks! This really helps! If I did not want to do it manually and wanted to write a code in any language, I guess I just need to write/read to the serial port the same commands in the same format as they are listed in that table, am I right? E.g. if I am using an Arduino and wanted to check the Modem-M64 serial protocol version, I would write: Serial.print(“wcv”)?

    #15616
    wlkh
    Keymaster

    Yes, you can use the same as the table.
    Your example is almost correct, you need to include a newline too. So you would write: Serial.print(“wcv\n”)

    #15617
    drgorma
    Participant

    Thanks a lot! Will start a code from scratch then. I agree it might be better for my application without the wlmodem library. If you have any similar examples built without it and you can share with me I would really appreciate it. Thanks once again.

    #15618
    wlkh
    Keymaster

    No problem! Unfortunately we don’t have any examples using C available. If you would be willing to share the code you implement (on github or similar) I’m sure others would be thankful.

    #15619
    drgorma
    Participant

    Sure! Will do when it is done. Thanks

    #15916
    wlkh
    Keymaster

    FYI: Benjamin shared an Arduino Library in another thread.

    #15925
    drgorma
    Participant

    This really helps! Thanks!

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Not a member yet? Registere here!