UART-INTERNET BRIDGE FIRMWARE

DESCRIPTION

This firmware implements transparent data exchange between the device's serial (UART) interface and an Internet server. UART can be connected to anything - for example, a legacy device. In this case, UART-INTERNET bridge makes a legacy device connected to the Internet.

An Internet server could be a plain TCP server, or a WebSocket server, or a MQTT server. You must develop such a server. We provide an example implementation of the WebSocket server - see an interactive console below which allows you to test this firmware straight away from your browser.

All data that is sent to the UART, will be received by the server. Likewise, all data that server sends back, will be sent to the UART. Therefore, a server code can implement data exchange with the UART as if it was connected to the server directly:

Message boundaries

This firmware does not implement any logic whilst forwarding data to and from the UART. Data is transferred as-is, no modification happens in any direction. Message boundaries are determined by timing.

Security

Authentication and encryption is provided by the TLS layer. The server side must be a TLS1.2 server with client-side authentication (mutual TLS) for the industry-standard level of security.

EVALUATION INSTRUCTIONS

INTERACTIVE CONSOLE (desktop-optimised)

This console connects your browser window to your flashed device. This is possible because browsers implement WebSocket protocol. This page has a tiny websocket client (see uart-to-websocket.js) that creates a connection to the websocket server that runs on mongoose-os.com website. Your flashed firmware also connects to the mongoose-os.com websocket server, and advertises itself, becoming visible on the interactive console below.

Choose device

  • (no devices connected)

Message Log

clear
Edit:

CONFIGURATION REFERENCE

To get all firmware settings, execute mos config-get command. To set any setting, execute mos config-set PARAM=VALUE command. The list of UART and Internet server settings is below.

Note that the device could be in client or server mode. In client mode, device initiates connection to the server. In server mode, device listens for connections.


  "tcp": {
    "client": {                                 # Client mode settings
      "reconnect_interval": 5,                  # Reconnection interval, seconds
      "remote_addr": "mongoose-os.com:443",     # Server HOST:PORT
      "tls": {                                  # TLS settings
        "ca_cert": "ca.pem",
        "cert": "",
        "server_name": "mongoose-os.com"
      },
      "ws": {
        "enable": true,                         # Enable websocket mode
        "protocol": "",
        "uri": "/uart-to-websocket/device/????????????"   # URI to connect to
      }
    },
    "evict_old": true,                # On device ID conflict, evict old entry
    "keepalive": {                    # Heartbeat settings
      "count": 10,
      "idle": 60,
      "interval": 6
    },
    "listener": {                     # Server mode settings
      "port": 8910,                   # Port to listen on
      "tls": {                        # TLS settings
        "ca_cert": "",                # CA certificate for mutual auth
        "cert": ""                    # Server certificate
      },
      "ws": {
        "enable": flashed             # Enable websocket mode
      }
    },
    "rx_buf_size": 2048,              # Receive buffer size, bytes
    "status_interval_ms": 1000,       # Status interval, milliseconds
    "tx_buf_size": 2048               # Transmit buffer size, bytes
  },
  "uart": {
    "baud_rate": 115200,              # UART speed
    "rx_buf_size": 1460,              # Receive buffer size, bytes
    "rx_fc_ena": false,               # Enable flow control
    "rx_linger_micros": 20,           # Microseconds to continue reading before sending
    "rx_throttle_when_no_net": true,  # Throttle when no network
    "status_interval_ms": 1000,       # Status interval, milliseconds
    "swap_rxcts_txrts": false,        # Swap RX / CTS and TX / RTS
    "tx_buf_size": 2048,              # Transmit buffer size
    "tx_fc_ena": false,               # Enable TX flow control
    "uart_no": -1                     # UART number, -1 to disable
  }

Contact us to inquire on Commercial License terms, or have any further questions.

CONTACT US ON COMMERCIAL LICENSING