First things first, I recompiled my bluepill version of Marlin with the SERIAL port set to 1 and sure enough, there was MY spew of data. I could tell it to list settings with an M503. To move an imaginary stepper, or detect the non-existent temperature.
But most printers connect via USB to something (Octoprint!) and then that something sends orders. So I set out to understand why libmaple's USB support wasn't working. To do this, I used the cheap chinese clone logic analyzers and Windows USB logging, and found that when I plugged the printer in or turned it on, the bus wasn't enumerated.
The bluepill boards have an interesting problem in which they will often not initialize USB without a hack that pulls the data plus line low for long enough for the host to discover, then returns it high so the MCU can actually speak USB.
During my tests,I accidentally bumped a wire and short circuited something such that my CPU let out all the smoke inside and my mouth let out all the curses.
But rather than harp on the shoddy soldering I'd done or my cat's cat-ness of insisting to be petted while I debugged USB interrupts, I took it as an opportunity. Starting from the USB port, I began to trace the leads back. Ground was a short trip. Same for the +. DM went (roughly) straight back to the CPU...but DP did not. It veered off to a transistor leg, and right there I knew it had a pull up or pull down transistor, but I didn't know what pin controlled it.
So, magnifying glass in hand, I proceeded to painstakingly follow the traces back. If the trace was obscured by a part, I took out the handy-dandy soldering iron and removed the part. When the circuit silkscreen obscured it, I took out sandpaper and buffed it off until all I had was nice, shiny copper wires.
And the copper wires, while taking some turns and twists, went back to the PB9 pin.
Next step?
Clone a variant of the bluepill board definition in PlatformIO, and a copy of the board's json file. With that done, I could now change the platformio.ini to describe the board as malyanm200, change the default loader script without affecting bluepill boards, and more importantly, modify the USB intiialization code.
First I tried turning the pin on.
No joy--unless I unplugged the printer and plugged it back in.
Taking a page from the bluepill book, I changed the code to bring the transister high, lower it to signal enumeration, and return it to high.
And boom, there was "Maple," the new name for my printer.
And there was much rejoicing.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.