You can manage multiple TMC2209 drivers using different addressing and wiring strategies.
1. Unidirectional: Multiple chips with identical settings
Connect all chips to the same serial line. No addressing is required; they will all receive the same commands in parallel.
2. Unidirectional: Multiple chips with different settings (One UART)
Assign unique serial addresses using the hardware pins MS1 and MS2. You must specify the address during setup().
3. Bidirectional: Multiple chips with different settings (One UART)
When using bidirectional communication on a single UART line with multiple addresses, you must increase the reply delay to prevent non-addressed chips from detecting transmission errors during read access.
Required Method: setReplyDelay(uint8_t delay)
#include <TMC2209.h>
TMC2209 stepper_driver_0;
const TMC2209::SerialAddress SERIAL_ADDRESS_0 = TMC2209::SERIAL_ADDRESS_0;
TMC2209 stepper_driver_1;
const TMC2209::SerialAddress SERIAL_ADDRESS_1 = TMC2209::SERIAL_ADDRESS_1;
const uint8_t REPLY_DELAY = 4;
const long SERIAL_BAUD_RATE = 115200;
void setup()
{
stepper_driver_0.setup(Serial1, SERIAL_BAUD_RATE, SERIAL_ADDRESS_0);
stepper_driver_0.setReplyDelay(REPLY_DELAY);
stepper_driver_1.setup(Serial1, SERIAL_BAUD_RATE, SERIAL_ADDRESS_1);
stepper_driver_1.setReplyDelay(REPLY_DELAY);
}