Troubleshooting

If you're lucky...

and you turn on the SMuFF for the first time, it'll greet you with a funny little tune and a status screen on the display. If you're not, well, that's where troubleshooting starts.

Luckily, I've integrated a couple of "helpers" in the firmware, that can make troubleshooting much easier, if you know where to look at.

Know your tools

There's one major tool that will not only help you setting up your SMuFF for the first time but also can assist you when troubleshooting. This tool is called SMuFF-WebInterface or SMuFF-WI or WI for short. It's a web page hosted on my Github repository, which is able to connect to your SMuFF using the Web Serial feature of your Edge or Chrome browser (most other browsers unfortunately lack in supporting this standarized browser feature).

First Step

Remove the SD-Card from the SMuFF controller board and put it into your PC. You'll find a file named debug.txt on it. Open that file and replace the content with "255" in the first (and only) line.
Now, if you plan to connect your SMuFF to your PC via the default USB port of your controller board, append a ";0" (semicolon - zero) to this line.
If you're connecting the PC via the TFT header on your controller board, you don't need to append anything, since this is the default configuration.
Save the file, put the SD-Card back into the SMuFF and reset the board.

Second Step

Navigate to the SMuFF-WI URL, make sure you've connected your PC to the SMuFF via either USB or a TTL serial connection and click on the SMuFF image after it has been loaded. WI will pop up a dialog, asking you on which serial communication interface (or COM port) you want to establish the connection. Under normal conditions, there should be only one entry listed

If you get a whole list of available COM ports, you'll have to figure out which one it is first. To do so, disconnect the SMuFF and reconnect while this dialog is still open. The according COM port will disappear from the list then reappear. Pick the port by clicking on it and then click on the "Connect" button.

SMuFF-WI will now try establishing a communication with the SMuFF via the given COM port. If it fails, in most cases this means, you have picked the wrong COM port.

If WI is successful, the main interface will show up with the Dashboard page opened and, most important, the Settings Wizard.
I highly recommend to run and finish the Wizard for the very first setup. It will configure the most basic settings that are specific for your particular SMuFF build.
After finishing the Wizard, reset your SMuFF in order to make sure all the modified settings will take place (some of them, such as TMC2209 configurations, do indeed need a reset - in some cases even a power cycle).

Third Step

Our main topic of interest on the Dashboard page is the Console window. This contains all the data exchanged between WI and the SMuFF.

Look at the first couple of lines and you'll see something like this:

The Console screen is split into two sides: On the right you'll see stuff the WI has sent (the orange bits), on the left responses from the SMuFF.

The first command after a successful connection sent by WI is M115, which asks for the firmware info. The SMuFF shall respond with FIRMWARE_NAME: Smart.Multi... 

Here's the first stage to check out the environment. The SMuFF will tell you for what configuration it has been compiled. Check if you have the correct configuration, i.e. has the firmware been compiled for the controller board you have, does the display match and so on.

If there's something fishy already, recompile the firmware according to your setup and flash it to the SMuFF. 

The next big block of text is coming from the SMuFF startup code, prefixed by setup start.

If you don't see this kind of information but only a few lines, this means the Debug-Level settings have been modified. Go to the Settings page -> Options tab and turn all Debug-Level switches on. Then reset the SMuFF.

Also: At this stage might seem the SMuFF is hanging at the very start before the enumerating I2C Devices... This happens if you have I2C devices configured (such as the FeatherWing Servo Board or LeoNerd's Display Module) but no I2C devices are actually connected to the controller board. To solve this, check the physical connection of those devices.
This function will eventually time out, but it will take quite some time.

You can ignore the echo: dbg: (...) part of each line, the important message here is the stuff behind. As you can see, SMuFF tells you exactly at which step of the initialization it currently is (i.e. setup Display, setup Encoder, etc.)  and eventually, what the result of this operation was, for example "enumerating I2C Devices on bus 3 o.k.".

You will also get a report on what the reading of the different config files has resulted in. If you spot an error here, this could mean that your config file is either too large or (in most cases) the SD-Card was corrupted.

The startup is pretty complex, so there's more.

Watch carefully whether the serial interfaces are all set up with the correct baud rate. You'll need that information later on when connecting the SMuFF to the Raspberry Pi (OctoPrint / Klipper) or the printer itself (Marlin).

And even more...

Read through all the messages and see if you spot something "strange". Take the screenshots above as a reference for a working device.
Keep in mind: All those messages are not meant to be fully understood by you, those are only indicators, if someone (for example me) asks you at which point it fails.

The setup is finished, when the setup end message appears. At the end, SMuFF also tells you at which port (on the controller side) you're currently connected to.

Fourth Step

If the previous steps didn't ring any alarm bells, it's time to move on and test the components separately. Move on to the top of the Dashboard and check the states of the Selector / Feeder (E1/E2) endstop sensors. 

Selector is supposed to show a green tick mark if the Selector is homed. In the case as shown in the picture above (where T0 is selected) it's also possible to have the Selector ticked because the T0 and Home positions are really close together. As soon as the Selector moves away from T0, it's supposed to show a red X.

You can check that by clicking the "Motors Off" button down below and then moving the Selector by hand, by rotating the pulley of the Selector stepper motor left or right.

If the state of the Selector doesn't change at all, check your wiring of the Selector endstop sensor. Keep in mind that an optical sensor, as supposed to be used by default, needs at least +3.3V in order to work correctly whereas mechanical sensors only rely on GND and Signal.

If the state of the Selector looks like it's inverted (tick mark only shown when homed), you need to invert the Endstop Trigger State on the Settings page -> Selector tab.

The Feeder E1 (the one on the Selector outlet) is supposed to be ticked as soon as filament is loaded. You can also check this behavior by pulling the flag up and releasing it again. The change should be visible in WI instantly.

The Feeder E2 is only relevant if you're running a DDE configuration. In that case, this is the 2nd endstop which tells the SMuFF whether the filament  has been loaded in the DDE extruder.

Same here: If the Feeder (E1/E2) state doesn't change at all, check your wiring of the Feeder endstop sensor.

If the Feeder tick mark is shown while no filament is loaded, you'll need to invert the Endstop Trigger State on the Settings page -> Feeder tab (for the SMuFF Feeder) or DDE tab.

Next, check the Relay.
Before you do that, make sure that the stepper motors on your printer have been turned off
After the startup it says E (which stands for External) and the default. When you click the panel, two things will happen: First, you'll hear the relay clicking, second, the state switches from E to I (which stands for Internal). Also, the LEDs on your relay board will light up, depending on the type of relay board you have.
Keep in mind: In Bowden mode, this is the only state where the SMuFF is able to spin the Feeder stepper motor. 

If you don't hear the relay clicking (switching), check whether the relay board is wired up correctly (+5V, GND, Signal and jumpers all set correctly). Make sure the controlling signal is coming from the right header on the controller. It usually is the TH0 connector, if not specified otherwise.

Next, check the Lid servo. It shows an unlocked, red symbol, if the Lid servo is disengaged and a locked, green symbol if it is engaged. By clicking on this panel, the states will change immediately. 

If nothing happens, check the wiring. If you're using the Multiservo option, make sure you've connected it at the correct pin-header position, which by default is #1, whereas #0 is reserved for the Wiper servo. Also, make sure the servo is operation at its specified voltage.

Fifth Step

If all of the above worked correctly, click the Home All button and the Selector is supposed to move to its home position, which is at the rightmost position. WI will show you a T-- in the tools dropdown. 

If the Selector moves in the opposite direction, you need to flip the Invert Step Direction on the Settings page -> Selector tab.

If the Selector isn't moving at all but rather rattles, you'll need to swap the two middle wires of the 6-pin connector on the stepper motor.

If homing was successful, feel free to iterate through the tools in the tools dropdown one by one (T0, T1, T2, ...). The Selector is supposed to move to the according position and the tools dropdown will update accordingly.

If the Selector movement doesn't match the Filament Guide positions exactly, check the Steps per mm, Tool Spacing and 1st Tool Offset on the Settings page -> Selector tab. Tool Spacing is supposed to be 21 mm, 1st Tool Offset 0.5 mm by default, unless you have built a "very special" version of the SMuFF.
The Steps per mm value is 80 by default, unless you have a 0.9° stepper motor (instead of the standard 1.8°), in which case the value has to be 160 or your motor pulley has more or less then 20 teeth. In the latter case you have to calculate the correct steps/mm value. The easiest way for doing this is by using the RepRap calculator for Stepper Motors.

Sixth Step

If you were successful so far, try loading a filament. You do this by inserting filament in the Filament Guide and moving the Selector to the loaded tool. Then click the Load Filament button. The SMuFF will first switch the relay to I state, then push the filament into the Selector at a lower speed until the Sensor is triggered and finally push the filament all the way out at a higher speed.

If the Feeder isn't moving at all but rather humming or rattling, you'll need to swap the two middle wires of the 6-pin connector on the stepper motor. If it's neither humming nor rattling but rather standing completely still, this might point to a wrong polarity at the relay board signal. Go to the Settings page -> General tab and flip the Invert Relay Signal setting. Save it and try loading the filament once again.

If it is loading but you see the filament slipping, go to the Settings page -> Lid tab and increase the angle of the Lid Servo Close position by steps of 5 degrees.

If the Lid servo is already at it's max. position but the filament is still slipping, check if the grub screw of the main drive gear in the Filament Guide is tight.

If the Feeder stepper motor is running into a stall at some point, go to the Settings page -> Feeder tab, increase the Maximum Speed and Acceleration Speed in steps of 100 and try to find the sweet spot.

After the SMuFF has successfully loaded the filament, unload it by clicking the Unload Filament button on the Dashboard. If everything else has worked so far, this should be a no-brainer. Not many surprises are being expected here.

Seventh Step

If you have the options Wiper and/or Cutter installed on your SMuFF, check their functions by clicking the according buttons Wipe Nozzle and Cut Filament.

If none of them is working, check the wiring first. If you use the Multiservo board, make sure the servos are connected at the right pin-headers. By default, header #0 is for the Wiper, header #1 for the Lid and header #2 for the Cutter.

That's it.

If you got all of steps above working successfully, your SMuFF has passed the initial test. Now you can move on to the Run Test page, pick the Feeder_Test-X_Tools and run it.

Make sure this test runs long enough, so you can rest assured there's no potential hidden cause of failure. Some issues may pop up after quite some time of operation, and you don't want them to happen mid print of your first multi material print. 

To be continued... maybe...