Max softwareserials on Mega2560
March 31, 2020 11:30AM
Hello there,

I've been working a while now on an 3D-printer specialized in paste materials, mainly clay. I've been expoloring extrusion methods and ended up with an mechanical extrusion system (one stepper for an ram extruding material from an cardridge and one stepper for dosing capabilities). For now im using one material but want the option to move to dual extrusion / mixing extrusion in the future. Because i have a quite heavy extrusion system, carrying the material with it (7kg) i want two drivers for the Z motors.

Only with an single extruder I end up with X,Y,Z,Z,E1,E2; 6 drivers, i want to use TMC 2209 because of their stallGuard option, preferably on an Atmega 2560. When i want to run an extra extruder i end up with 8 drivers. How many drivers can an 2560 hand (they use and bidirectional UART pin). I know the 2560 only has 3 hardware serials, so my guess is the rest has to run of softwareserial.

- Does anyone knows what the (reliably) amount of drivers is depending on softwareserial.
- Is this UART line in use continuously or only during setup and setup-related M-codes?

I want to create my own PCB; there is a lot of stuff i don't need on regular motherboards (thermistor inputs/heating options etc) (and $$$, single tmc2209 are way way cheaper).

Greets Tom
Re: Max softwareserials on Mega2560
March 31, 2020 11:50AM
There are other ways to run serial communications with tmc2209.

You can set address for the driver chip and just use one serial device to up to 4 tmc2209 drivers. (so you would only need two serial ports)

On Atmega 2560 uart is only used during setup and setup-related M-codes


Quote
https://github.com/MarlinFirmware/Marlin/issues/14348
Four TMC2209 drivers can use the same HW/SW serial port with hardware configured addresses.
Set the address using jumpers on pins MS1 and MS2.
Address | MS1 | MS2
0 | LOW | LOW
1 | HIGH | LOW
2 | LOW | HIGH
3 | HIGH | HIGH

For the tx/rx pins in marlin you set 4 of them the same tx/rx pin and set the next 4 to the second tx/rx pins

Edited 1 time(s). Last edit at 03/31/2020 12:11PM by Dust.
Re: Max softwareserials on Mega2560
March 31, 2020 11:59AM
As for max software serials, its limited by cpu power and the RX pins have to use specific interrupt capable pins

"so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69)"
so max of 18 from this limit. But you cant use a number of these pins on a ramps.
Re: Max softwareserials on Mega2560
March 31, 2020 03:50PM
Thanks, the TMC2209 is a tad bit shady on that (read; i have a hard time understanding this) (http://www.farnell.com/datasheets/2817994.pdf?_ga=2.232056156.2120275844.1585591824-210330594.1581887789) page 19, fig 4.2. I think that schematic is for having duplicate adressess because the adress number goes from 0-3 (running >4 drivers on the same UART line)? Otherwise an adressing option would be redundant, right?

Out of curiosity, how does Marlin handle the sensorless homing if UART is an setup only thing, is it polling UART during an homing sequence?

Greets Tom
Re: Max softwareserials on Mega2560
March 31, 2020 03:52PM
Quote
Dust
As for max software serials, its limited by cpu power and the RX pins have to use specific interrupt capable pins

Thats first bit i knew, that last bit needed remembering, thanks smiling smiley
Re: Max softwareserials on Mega2560
April 08, 2020 02:16PM
Quote
RuutNova
Out of curiosity, how does Marlin handle the sensorless homing if UART is an setup only thing, is it polling UART during an homing sequence?

Sensorless homing does not involve the UART other than to change the axis sensitivity and possibly the current during the homing move. The DIAG pin on the driver is connected to the endstop input and the DIAG pin goes low when the axis hits a limit. The TMC drivers that are configured via SPI can do sensorless homing without having the DIAG pin connected but that does not apply to the UART-controlled drivers.

In any case, sensorless homing is a chimera IMHO. Physical endstop switches will always be more reliable and accurate.
Sorry, only registered users may post in this forum.

Click here to login