---
name: "mesa_uart"
section: "9"
platform: "linux"
package: "linuxcnc-uspace"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mesa_uart"
---

# mesa\_uart(9)

An example component demonstrating how to access the Hostmot2 UART

## NAME

mesa\_uart - An example component demonstrating how to access the Hostmot2 UART

## SYNOPSIS

**loadrt mesa\_uart \[count=*N*\|names=*name1*\[,*name2...*\]\]**

## DESCRIPTION

This component creates 16 input and 16 output pins. It transmits  {name}.N.tx-bytes on the selected UART every thread cycle and reads up to 16 bytes each cycle out of the receive FIFO and writes the values to the associated output pins. {name}.rx-bytes indicates how many pins have been written to.  (pins \> rx-bytes simply hold their previous value)

This module uses the names= mode of loadrt declaration to specify which UART  instances to enable. A check is included to ensure that the count= option is  not used instead.

The component takes parameters in the form of a comma-separated list of UART instance names, for example:

 **loadrt mesa\_uart names=hm2\_5i23.0.uart.0,hm2\_5i23.0.uart.7**

Note that no spaces are allowed in the string unless it is delimited by double  quotes.

The UART instance names are printed to the dmesg buffer during the Hostmot2  setup sequence, one for each UART instance included in the bitfile loaded to  each installed card during the Hostmot2 setup sequence. Type "dmesg" at the  terminal prompt to view the output.

The component exports two functions, send and receive, which need to be added to a realtime thread.

The above example will output data on UART channels 0 and 7 and the pins will  have the names of the individual UARTS. (they need not be on the same card, or even the same bus).

Read the documents on "halcompile" for help with writing realtime components: http://linuxcnc.org/docs/html/hal/comp.html

## FUNCTIONS

- **mesa-uart.***N***.send** (requires a floating-point thread)

  - **mesa-uart.***N***.receive** (requires a floating-point thread)

  ## PINS

- **mesa-uart.*N*.tx-data-*MM* u32 in (MM=00..15)**

  Data to be transmitted

- **mesa-uart.*N*.rx-data-*MM* u32 out (MM=00..15)**

  Data received

- **mesa-uart.*N*.tx-bytes s32 in**

  Number of bytes to transmit

- **mesa-uart.*N*.rx-bytes s32 out**

  Number of Bytes received

## AUTHOR

Andy Pugh andy@bodgesoc.org

## LICENSE

GPL
