Close

Oscilloscope, Ahoy

A project log for Monoprice Mini Marlin 2.0 Support

Getting Marlin to run on the Monoprice Mini/Malyan M200.

jc-nelsonJ.C. Nelson 04/24/2019 at 16:380 Comments

The USB init Pull Request for Malyan M200 V1 systems is now officially merged into ST's Arduino core, which means USB works reliably now. A few minor changes to define UWMEM addresses and allow the MalyanM200 pins to be used with the ST core, and I can compile using the Arduino IDE every time, reliably. 


That's great.

Heaters work, USB, the LCD, fans, SD card, etc. All of that works just fine. There's just one little problem:

THe motors don't move correctly.

Now, if you go back through the project logs, you'll see this is a recurring problem I've fought with a number of different reasons. Sometimes it's the min pulse length (needs to be 2 on my Malyan boards, even though the documentation claims 1 is sufficient). Sometimes it's the ISR timer prescalar/frequency. Some advice from the Marlin github issues suggested that it would be a max rate issue, so I adjusted the settings to match the M200's defaults.

No luck.

Homing moves successfully raise the Z axis, but the other axises don't even budge, they'll occasionally stutter.

And I can't lower the Z axis.

Now, the Z axis is unique in that its step count is ~3x the number of any of the others. This means that missing pulses or incorrect ones have a margin of error. To figure this out, I needed to measure the pulse lenghts and see what's being sent. I do own a scope, a DSO138 hobby scope that I 3d printed a case for. It's a single channel, but I only need to measure one, so I hooked it up to the stepper output after checking to make sure the scope could handle it and ran some tests.

The stepper output is garbage.

But it turns out I made a critical mistake. I'm not measuring the actual pulse, I'm getting the output from the stepper driver. I have two approaches I'm going to chase in parallel. First off, on V2 hardware, there's a beautiful JP socket for Serial2 (what I used to hook up the BL-touch). I'm going to cheat and define the TX and RX pins as X and Y step. I can measure those directly.

Secondly, there's a board definition in Marlin (STM32F1_R) which isn't for a real printer, it's a bluepill. I'm going to get that compiling and load it onto a bluepill. That will let me measure the pulses directly.

It could be that I have everything configured wrong in the timer. It could be that the no interrupts code is causing some blocking. We'll find out.

Discussions