Board Outputs

So through some fairly hairy trial and error I’ve figured out that the TFT screen “Fan” option controls output Fan0.

I’ve also found that M106 P let’s me turn on any of the three fan outputs

Similarly, “Spindle” controls HeatBed2.

I didn’t find any of this documented (perhaps not looking in the right place)
What other goodies/outputs can I manage through the TFT and/or gcode on the SKR Pro v1.2 and is it documented somewhere or is there a config file I could check out?

I’m assuming you are running Marlin. What pins are enabled and how they are assigned is board specific and dependent on your Marlin settings. You need to comb through the following resources:

  • The PINS file for your specific board. The root of the PINS files in the Marlin source is Marlin/Marlin/src/pins. From there you have a to dig a bit to find the specific PINS file for your board, and then read the pre-processor commands to figure out what pins are/could be enabled. For example, the pins file for the SKR Pro 1.2 can be found in stm32f4/pins_BTT_SKR_PRO_V1_2.h and stm32f4/pins_BTT_SKR_PRO_common.h.
  • Many boards will have a (partial) pinout diagram. Do a Google search on your board with the word ‘pinout.’ For example, for the SKR Pro, here is the pinout diagram.
  • Schematic for the board. Some boards have a public schematic. For example, the SKR Pro, here is a schematic for the board.

So your goal of the above three points is to identify what (and sometimes how) pins are enabled in the firmware and where those pins are on the board. Some pins can be enabled with changes in the firmware…specifically #defines in configuration.h and configuration_adv.h. Beyond the fan and spindle g-codes you’ve already identified, there are a couple of other g-codes to look at.

  • M42 - this g-code will allow you to set the pin mode and the pin state for arbitrary pins on your board. For PWM pins, this allows you to set the PWM value for that pin.

  • M280 - this g-code allows you to control a servo. By default, this ability is not enabled in the V1 maintained versions of the firmware. You would first need to set NUM_SERVOS to a value in configuration.h, and then identify what pins are assigned for servo control. For example in the SKR Pro, PA1 and PC9 are used for servo control. You would need to use the pinout diagram to identify where these pins are on the board.

And there are other settings that impact what pins are enabled and how they are addressed. For example turning on a laser may give you a new pin to address in g-code, but may also impact what/how the spindle pin behaves. And there are settings that impact how parameters are interpreted. For example, if you are using inline spindle speed commands with your G0 and G1 commands or M3 and M4 commands, some Marlin settings will determine how the G0 and G1 parameters are mapped to the PWM states of the spindle/laser commands.

I assume you are using a “smart” TFT screen that has its own firmware. This kind of display communicates to Marlin using g-codes, so it is using the same g-codes you’ve already identified to manipulate pin states.

Edit: The PINS file can also be edited to assign a specific feature to a new pin. For example, typically fan pins are 12V, and you may want to control the pin using the fan g-code, but want a 5V (or 3.3V) pin instead. You can reassign the fan control to a new (unused) pin by editing the PINS file.

3 Likes

Excellent answer with plenty of meat to dive itno the details, thank you so much.
Yes, I’m using the SKR Pro v1.2 kit from the V1 store (with TFT so) and the stock V1 firmware (so Marlin).

That tip on M42 is gold, thanks again