MF70 CNC Control Board
Posted by retromaster on November 6, 2009
Here is the control board for the CNC-converted MF70. I opted for a rather simple design. It contains a PIC18F4550 microcontroller and 3 ULN2003A darlington arrays for driving the steppers. The PIC handles USB communication with the PC host, interprets incoming commands and controls the motor stepping sequences. It is probably a bit of an overkill for this kind of project but I already had some :). There is a ULN2003 per motor, implementing unipolar drive. The motors I use here are 12V, 0.6A motors and with a some current limiting a ULN2003 is able to drive one although not exactly at full torque. The whole system is powered from a 12V, 2A power adapter.
As the pictures show, I had to solder directly to the USB data pins on the board to get the USB communication working reliably. Using the on-board type B USB connector did not work very well, and I guessed that it was due to the rather long differential USB data traces on the single-sided board. To be honest, I did not pay much attention to the impedance of the USB traces and it seems this was a mistake :(. Anyway, I’ve already redone the PCB layout to shorten (and thicken) the USB traces to better meet the impedance requirements. To achieve this, I’ve rotated the PIC sideways in this new layout. I haven’t built the new layout yet, but I guess it might be one of the first PCBs I’ll build with the MF70 CNC when I get it working.
In its current state, the board can step the motors and it is detected properly as “Retromaster MiniStep” by the host OS. I decided to use the WinUSB API on the host side to avoid writing a device driver. Up until now, I tried to get USB control transfers to work with the firmware as that mode of communication seemed appropriate for this type of device. Even though control transfers with no data stage work fine, I could not get control transfers with a host-to-device data stage to work. I did examine the Microchip USB firmware thoroughly and tried several things, but without an in-depth knowledge of how USB control transfers and Microchip silicon work, I could not succeed. What makes matters worse is that Microchip firmware documentation on the subject is rather poor (and likely inaccurate), and to my knowledge none of the available device firmware examples use this kind of control transfer, which leads me to suspect that this functionality of the firmware was never properly tested. Anyway, I dropped the idea, and decided to use bulk transfers instead.