Monarco HAT MCU (microcontroller) is connected as UART device on the Raspberry Pi UART-0 (/dev/ttyAMA0). Data on this interface is normally forwarded between Monarco HAT RS-485 and Raspberry Pi UART-0 in both directions with correct buffering for half-duplex operation.

The configuration of the RS-485 bus on the Monarco HAT consists of two parts:

  • Configuration of internal UART (/dev/ttyAMA0) communication between the Raspberry Pi and the MCU of the Monarco HAT.
  • Configuration of the external RS-485 communication interface.

Internal UART communication (host side communication)

By default, the Monarco HAT MCU expects UART communication with 115200 Baud, 8 data bits, no parity, 1 stop bit. It is up to the user to configure UART port (/dev/ttyAMA0) of the Raspberry Pi to use these settings.

The following prerequisites must be met for the UART communication to work properly:

  1. Linux terminal must be disabled on /dev/ttyAMA0. Remove "console=serial0,115200" from the file /boot/cmdline.txt manually or with commands:
    sudo cp /boot/cmdline.txt /boot/cmdline.txt.rexbak
    sudo sed 's/console=serial0,[0-9]+//' -i /boot/cmdline.txt
    Please check that "console=serial0,115200" was removed successfully, e.g.:
    sudo nano /boot/cmdline.txt
  2. If you have Monarco HAT series E and older (shipped before 10/2017), it is necessary to update the ID EEPROM of your Monarco HAT.

Settings in REXYGEN

Settings of internal UART communication in REXYGEN are described in detail in REXYGEN Support Center.

Settings in Node-RED

  1. The node-red-contrib-monarco-hat palette has to be installed on the device. 
  2. For using Monarco HAT with the Node-RED, it is necessary to install a 3rd-party palette and we can't guarantee optimal functionality. The palette node-red-contrib-modbus will be used in this tutorial.
  3. Add a Modbus node you want to use (e.g. Modbus Read) and open Properties tab. In the Settings -> Server select Add new modbus-client... Fill the dialog as shown bellow.

Note: It is typically not necessary to change the internal communication baudrate. If needed, it's possible using the 0x012 service register of the Monarco HAT (see the Monarco HAT SPI Protocol Reference Manual for details).

External RS-485 interface

  • The external RS-485 bus can be fully configured by service registers 0x010 and 0x011 of the Monarco HAT.
  • Default parameters are: 9600 Baud, no parity, 1 stop bit.
  • If you wish to change these settings, you will typically do it in the initialization phase of your program/script.
  • Please see the Monarco HAT SPI Protocol Reference Manual for details.

Settings in REXYGEN

Settings of the external RS-485 communication in REXYGEN are described in detail in REXYGEN Support Center.

Settings in Node-RED

Settings of the external RS-485 communication can be done in the Monarco HAT Configuration node. This settings must correspond with settings of other devices you want to communicate.