ST Core Progress

A project log for Monoprice Mini Marlin 2.0 Support

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

J.C. NelsonJ.C. Nelson 10/22/2018 at 16:160 Comments

As I noted last time, I had an official build up and running (and crashing) with the ST Core. The first thing I did was a huge set of hacks. Remember, at this stage, I simply want to get something working. The next stage will be to tease out the proper fixes for each of my hacks. That said, I knew the first thing necessary, and did it -

Adding support for an already running Watchdog to the IWatchdog library. The M200 uses the IWDG, not the WWDG. The W in WWDG stands for "Window" (as opposed to "Independent" for IWDG) and means you need to reset the watchdog within a specific window or else suffer the consequences.

I hacked together an "alreadyRunning()" call for the IWDG and moved on. Now I could boot Marlin (no USB support) and see the output. How am I doing this? I have a TTL converter hooked to SERIAL1 - the display port. I disabled the Malyan LCD support and set Serial to Serial1, allowing Marlin to spew to my serial monitor.

It reset every eight seconds.

Now, this should set off alarm bells, since that's the reset period of the IWDG, but some testing showed that if I short-circuited the loops, my code ran just fine.

So this began a series of adding debug statements and watching the spew, and soon enough I came to the conclusion that this was an ISR issue.

Why? Because if I disabled all interrupts, the machine kept running, though serial, of course, didn't work so well.

So I commented out the temp interrupt, moving the watchdog reset to the inner loop.

Everything ran.

Enabled the stepper ISR-- boom, random crashes return. 

So, where to from here?

Now we need to know if it's a macro/HAL issue, or if the stepper ISR itself is crashing. Fortunately for us, this is relatively easy to rundown. To do so, we'll put a return immediately after the stepper IRS's function begins. If it's an enable/disable/timing/macro issue, the machine will still reset. If it's something deep down, it won't.

Once I had an M200 I'd soldered debug headers to, then reset the protection bit, flashed the bootloader back onto, and could debug via ST-link. We may wind up back there.

But not yet.

For those of you wondering when V2/070 support will come, fear not. Once this is running, adding a board definition for 070 becomes relatively simple, porting the board definition/startup code from STM32GENERIC. That will likely be AFTER USB support. We need to have something functional before we extend scope.