Unable to find UART pins for Prusa MMU v2.0
-
Once my new printer is finished, I want to work on getting a Prusa MMU v2.0 working. With the Duet WiFi I am having trouble allocating the pins I need. We know the MMU v2.0 uses a simple UART for communications, so I am trying to find UART pins on the ATSAM4E8E.
RXD0 and TXD0 are used for SPI0, which means it's occupied for external SD card and PT100 sensor
RXD1 and TXD1 are used for the TMC2660 SPI1
URXD0 and UTXD0 are used for the PanelDue
URXD1 and UTXD1 are used for the ESP8266
And that's all the hardware UART/USART available on the ATSAM4E8E
So as you can see, we are kind of screwed...
Using a multiplexer is tricky because we might miss messages coming back from the MMU, there's no flow control. We can't cleverly share SPI with UART without somehow making sure the MMU control board doesn't need to talk back unexpectedly. Since the MMU has user accessible buttons, that might be challenging or at least annoying to accomplish. The best way is to have a 5th UART one way or another.
There's no official SoftwareSerial or bitbang UART library for the Due but I did find https://github.com/antodom/soft_uart , it requires a timer per pair of pins. I haven't dug too deep into RepRapFirmware yet but it seems like there's enough. Also I think the MMU only needs to do stuff when the entire printer is sitting still, maybe the extruder motor is running. Nothing is super busy or timing critical (we can change baud rates too), I don't think there's a problem using bitbang.
There's also I2C or SPI available on the MM-control circuit, firmware on the MM-control needs a bit of touchup if we want to use that instead
Did I miss something? Is there a easier way I overlooked? Did I misunderstand how the ATSAM handles peripheral pin multiplexing? Got any suggestions?
Thanks
This won't be a fast project, can't get my hands on a MMU v2.0 that fast anyways, but I don't want to screw myself over when the time comes. I have a Einsy RAMBo as a backup, but my whole project is centered around the fact that AVR based boards cannot print large circles fast enough (I ended up with less-than-perfect vase prints)
-
Some possible solutions:
- If you are not using PanelDue then you could use UART0
- Use SPI
- Use a Duet Maestro if it is adequate for your project. There is a spare UART available on 2 of the 4 expansion pins.
- Make a hardware modification to the Duet WiFi so that UART1 is jumper-delectable between the ESP module and the MMU. RepRapFirmware only uses the UART to talk to the ESP module for uploading new WiFi firmware and for retrieving debug information, not during normal use.
- Use a Duet Ethernet instead of a Duet WiFi. Apart from reading the URXD1 pin at startup to see if it is grounded (indicating a Duet Ethernet), it doesn't use UART1.
- Don't use the MMU control board, drive the stepper motors etc. directly from a Duet + DueX if needed
Don't forget the the MMU board probably uses 5V signal levels, and the Duet is 3.3V.
-
Thanks, especially for the little gotchas like how the Duet checks if URXD1 is high at boot, great to know and easy to miss
Is the support for the MMU v2.0 on the roadmap for you guys at all? How welcome would code contributions for MMU integration be? Is there anything you would like me to avoid doing?
-
@frank26080115 said in Unable to find UART pins for Prusa MMU v2.0:
Is the support for the MMU v2.0 on the roadmap for you guys at all? How welcome would code contributions for MMU integration be? Is there anything you would like me to avoid doing?
It's not on our roadmap, although that could change if enough users request it.
It might make more sense to use the Duet to drive the motors etc. in the MMU directly. Alternatively, another user has made a device similar to the MMU, see https://forum.duet3d.com/topic/6346/multi-material-filament-feeder-repurpose-e1-stepper-driver.