Close

USB Revisited, plus Timer work

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 04/16/2019 at 17:120 Comments

I've been fighting PlatformIO to get it to build, so for now, I switched back to compiling with the Arduino IDE. I wasn't terribly surprised to see that the V2 board (an STM32F070 board) simply worked with USB CDC. Why? Because the V2 doesn't have a pullup transistor. It has the place for one (and I'm near certain PB9 could be used as an output with a little soldering), but it doesn't have it.

The V1 board variant turns on PB9 on variant init.

However, V1 USB doesn't work. The reason why is related to a previous log on USB support. The ST Arduino core signals reenumeration by pulling DP low. However, if DP is being fed by a pullup transistor, pulling it low alone doesn't do the trick.

To fix this, we need to make the reenumerate function weak, something I've opened a PR to do, and add a reenumerate to our variant, something I've also done.

Timer wise, we have to deal with the fallout of an earlier log where I noted that timer conflicts with hardware PWM could cause resets. To handle this, I consulted the timer map and the PWM map.

We use PB3, PB6, PB7, and PB8 in analog write (FAN2, HEATER, HOTEND, and FAN1). This leaves timers 1 and 3 open, which just so happen to also (apparently) be available on the 070. So I've updated the pin map and will test.

Discussions