I have been working on a project where I control 4 bipolar stepper motors with an Arduino Uno and a CNC Shield and four TMC2209 stepper drivers. It all works fine, but now I want to include the StallGuard feature (and read the Stallguard values). For this, I know I need to establish a UART connection. Since the CNC Shields do not have the RX and TX pins of the TMC2209 connected to the RX and TX pins of the Arduino, UART connection is not possible, but can we connect it manually?
I was wondering: is it possible to use jump wires and to manually connect the RX and TX pins (that are available on the top side of the TMC 2209 stepper driver module) to the RX and TX pins on the CNC shield that are connected to the TX and RX pins on the Arduino?
An alternative: connecting the RX and TX pins on each TMC2209 driver to a secondary Arduino board (since using digitalRead will interfere with the step commands?)
Check that those Tx/Rx on the shield are connected to the D0/D1 pins on the UNO. Then You can connect **one ** TMC2209 to them. Note: Connect the UNO side Tx to th TMC2209 Rx, UNO Rx to TMC Tx!
Thanks Railroader! Good point: Rx ofcourse needs to be connected to Tx and visa versa. Sorry for the confusion in the image.
Also, the Tx and Rx pins as indicated in the image on the CNC shield is connected to the arduino uno Rx and Tx pins.
But still is the whole configuration possible? And is it possible to use the Rx and Tx pins on the arduino while keeping the uno connected to a pc and watch the serial monitor etc?
And for multiple Rx and Tx communication possibilities: could I make use of software serial library to make more virtual Rx and Tx pins?
I actually want to use step/dir and meanwhile read out the stallguard values that are configured using UART for each stepper motor. I know that both UART and step dir control is possible, but I’m not sure how to read out the stallgaurd values for all four stepper motors using UART (Rx Tx) simultaneously.
Was thinking about using two arduino’s as well: one for the motor control and one for reading the Stallguard Values, but still not sure about being able to read that many values at the same time with UART
That's not possible. If You can use a stall guard output pin and connect it as a limit switch You can read 3 stall guards.
Two controllers, quadruple difficulties....
Read several things "at the same time" is not possible. Each reading takes the time for the code to execute as well as serial coms are not syncronized.
Hmm.. this is frequently described: using step and dir commands and UART communication simultaneously and I just bought an e book that describes using them simultaneously. However that is without a CNC shield and with an ESP32.
Also, the stallguard feature will be for load features. It will not be used in an CNC machine. I use The CNC shield as it is just easy for wiring four stepper drivers and motors.