This page is under construction and may not have complete or up-to-date information.

thinkyhead

Serial Ports

Description

Connecting to hosts, serial controllers, and CAN bus

hardware, serial

Use these options to define the machine hardware, including the mainboard, serial ports, etc. These are the most basic settings for every type of machine that Marlin supports.

1.0.0

#define SERIAL_PORT int

Select the serial port for host communication.

This setting allows you to choose which serial port on your board will be used for communication with the host computer. Serial port -1 is typically the USB emulated serial port, if available. Note that the first serial port (-1 or 0) will always be used by the Arduino bootloader.

🗳️ Options: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
👁️ Examples
#define SERIAL_PORT  0 // Set the first serial port to UART0
#define SERIAL_PORT -1 // Set the first serial port to Native USB
1.0.0

#define BAUDRATE int

Default communication speed for all serial ports.

This setting defines the baud rate for serial communication. A baud rate of 250000 works in most cases, but you might try a lower speed if you commonly experience drop-outs during host printing. You may try up to 1000000 to speed up SD file transfer.

🗳️ Options: 2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000
👁️ Example
2.0.0

//#define BAUD_RATE_GCODE

Enable G-code M575 to set the baud rate.

This setting allows you to use G-code M575 P<port> B<baud rate> to dynamically change the baud rate during operation.

2.0.0

//#define SERIAL_PORT_2 int

Select a secondary serial port for host communication.

This setting allows you to choose an additional serial port on your board for communication with the host computer. Currently, Ethernet (-2) is only supported on Teensy 4.1 boards.

🗳️ Options: -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
👁️ Example
2.0.0

//#define BAUDRATE_2 int

Baud rate for the secondary serial port.

This setting defines the baud rate for the secondary serial port. Enable this option to override the default BAUDRATE setting.

🗳️ Options: 2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000
👁️ Example
2.0.0

//#define SERIAL_PORT_3 int

Select a third serial port for host communication.

This setting allows you to choose an additional serial port on your board for communication with the host computer. Currently supported for AVR, DUE, SAMD51, LPC1768/9, STM32/STM32F1/HC32, and Teensy 4.x boards.

🗳️ Options: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
👁️ Example
2.0.0

//#define BAUDRATE_3 int

Baud rate for the third serial port.

This setting defines the baud rate for the third serial port. Enable this option to override the default BAUDRATE setting.

🗳️ Options: 2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000
👁️ Example
2.1.3

//#define RS485_SERIAL_PORT int

Select a serial port to communicate with RS485 protocol.

This setting allows you to choose which serial port on your board will be used for communication with the RS485 protocol.

🗳️ Options: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
👁️ Example
2.1.3

//#define M485_PROTOCOL int

Check your host for protocol compatibility.

This setting allows you to specify the protocol used with RS485 communication. Leave this set to 1 to use the default protocol. Check your host for protocol compatibility.

2.1.3

//#define RS485_BUS_BUFFER_SIZE int

Buffer size for RS485 bus.

The size of the CAN bus buffer. This should be set to the maximum number of messages that can be sent in a single CAN frame.

1.1.0

//#define BLUETOOTH

Bluetooth wireless interface.

Enable the Bluetooth serial interface on AT90USB devices.