RE: XBuddy board GPIO?
Taking a break for the night, but it looks like M42, without a pin number, allows you to write to the front RGB LEDs ("M42 S0" should turn them off, I think?)
RE: XBuddy board GPIO?
So no inputs that you saw?
I had the thought to try to map the pins to the microcontroller pins, but poking around with any sort of voltage on the microcontroller pins on a brand new, not even tested board put me off…plus I wanted to build the printer, not test the board. If by winter nobody else has mapped them, and Prusa hasn’t released the schematic, then that would be a great winter project for the days of being trapped inside. But summer just has too many projects and things to do to be spending a lot of time reverse engineering a PCB.
Just FYI, those *could* be inputs, if you activate an internal pullup resistor, and selectively ground the pin for the input. The diode will protect the board from overvoltage, and the resistors will protect it from excessive current.
I'm trying to filter through the firmware, and figure out which port letter/number combinations are mapped to which marlin pin numbers, but it's a bit of a challenge. My C++ is rusty, and this is VERY high level, to me.
RE: XBuddy board GPIO?
Not sure if this was mentioned in this thread, the pins seem to be defined here: https://github.com/prusa3d/Prusa-Firmware-Buddy/blob/bfb0ffc745ee6546e7efdba618d0e7c0f4c909cd/src/common/hwio_pindef.h#L435 .
Another thought, looking at the buddy board it does not seems like there's any dedicated "user usable" pins; but there are 4 unused ports I can see.
1. is for the MMU
4. is labeled ACCEL (maybe for a future accelerometer powered input shaping?)
2. is labeled "A_TEMP", can't find any references to that in the codebase
3. I can't read the PCB under the cables and I'm too lazy to
That's it, I don't have any solution to provide, just thought I'd add what I found out about.
Cheers.
RE: XBuddy board GPIO?
@pyrho This post has given us the most insight into the possible GPIO header, which you missed:
https://forum.prusa3d.com/forum/postid/665868/
The more people who ping the developers for the pinout and firmware pin numbers, the sooner we might actually get to use the GPIO, here.
RE: XBuddy board GPIO?
If anyone wants to pile on to my question on github, feel free!
RE: XBuddy board GPIO?
Prusa has defined Ports that can be used for external accessories on this >>> page <<<. Extension header isn't supposed to be used but instead J29 (ACCELEROMETER), J23 (I2C), J15(A_TEMP) and J6 (MMU).
Regarding the extension header, here's what I have reversed so far (no warranty, for MK4 Board Revision 0.27 2021):
- .. ? ? .. ? PE5 .. PE3 PE4 .. PE2 PA15 .. PF8 - .. - + .. + EXPANSION 1
RE: XBuddy board GPIO?
sorry if this is a dumb question, but does anyone know the correct parameters for the m42 gcode command to switch the gpio pins in the J29 "accelerometer"
port?
RE: XBuddy board GPIO?
Schematic has been released for MK4: https://www.prusa3d.com/page/open-source-at-prusa-research_236812/
RE: XBuddy board GPIO?
THANK YOU!
Interesting... J9 is labeled "Extension" on the schematic, but "Expansion" on the screen printing on my board, and others.
Looks like it's a bit different, compared to bkerler's reverse engineering.
+24V .. +24V Gnd .. Gnd nAC .. PA15 PE2 .. PE4 PE3 .. PE6 PE5 .. +5V PE12 .. +3.3V
Now, we just need those firmware pin numbers.
RE:
The extension is SPI4 in fact. Fw source code says :
RE:
That technically only covers PE2, PE4, PE5, & PE6, according to the schematic. The rest are still "up for grabs", I think?
Regardless, for those of us without the side LEDs, we should be able to use those pins.
RE:
PE2 would be PIN 66.
Port E, Pin 2 => E=4, 2=2 =>
16*4 + 2 = 66 according to this:
#define MARLIN_PORT_PIN(port, pin) ((16 * (port)) + (pin))
RE:
Ooooh. Thank you! THAT is what I was missing. Where was that?
RE: XBuddy board GPIO?
"src/common/MarlinPin.h" (Global definitions)
and
"src/device/stm32f4/hal_msp.cpp" (SPI4 config and Port)
RE: XBuddy board GPIO?
I marked this as "answered" because I won't be able to test this for a few months, but if any of you reading this would like to test it yourself, and post your results, it would be GREATLY appreciated!
RE: XBuddy board GPIO?
Um, i tried printing a model with the following custom gcode (trying to switch pins pc3 and pc2) at the start of the 2nd layer
M42 P35 S0
M42 P34 S0
M300 S100 P1000
I got the following bluescreen of... problems :
it won't let me upload the gcode here 🙁
RE: XBuddy board GPIO?
Just pack the gcode file into a *.zip file and the forum will accept it.
RE:
Thanks!
Bty, my printers firmware is version 5.1.2+13478
Here is the gcode file for anyone interested:
Part_Studio_2_0.4n_0.2mm_PETG_MK4IS_27m
RE:
My first guess would be that you're trying to do an analog write to a pin that is earmarked for SPI communication. The only pin I'm seeing not earmarked for something is PE12. Give that one a try, just to see if you get BSOD?
Also, you uploaded a .bgcode file, not gcode, which is gonna make it... "fun" to open.
RE: XBuddy board GPIO?
Nevermind. Converted it to ASCII in prusaslicer's gcode viewer