The awesome embedded adventures logo goes here!
GO

EMBEDDED ADVENTURES: CONNECT THE WORLD AROUND YOU

All news articles
Resetting the 18F14K50

5 July 2010

Have a look at the schematic below:

14k50 Schematic

It's a snipped from an upcoming product designed to give you USB to UART serial, all based on the fantastic new 18F14K50 chip.  Sure, you can buy dedicated chips for this purpose, but why wouldn't you use a completely hackable microcontroller if you can do so at the same cost?  That's what we thought too.

Fast forward to getting a prototype board made and soldered up. It programs okay, software runs on it. Then we hit the reset button. Nothing!  No reset. Very strange.

That reset button circuit has worked on many other projects.  You can see how the 10k resistor pulls MCLR high, and the button pulls it low.  Once you have a pull-up though, there's a new problem.  When you program the chip, MCLR is set to 9v-14v (depending on the PIC).  That's fine except now we've tied our "5v" line to MCLR and hence also to up to 14v.  Some chips aren't going to like this (not least of which the PIC itself).  If you have another chip connected to this 5v line, it's probably not going to be a happy camper having 14v thrown at it.

The 1N4148 diode is designed to allow programming but protect the rest of the circuit from the Vpp programming voltage that's applied to the MCLR pin.  All good, but why doesn't the reset button work on this circuit? 

14k50 datasheet clip

Aha! As usual, the datasheet reveals all.  The MCLR has an internal pull up, which is not the case for a lot of other PICs.  Now, because there's a pull-up on the other side of the diode, the line is prevented from pulling low. (Or, strictly speaking, from not being pulled high, which is enough for the PIC to be reset).

Actually, this is a nice inclusion, since we can not only do away with the pull-up resistor, we can do away with the diode as well.  This leaves us with:

New 14k50 schematic

That's much cleaner.  We'll let you know how we get on once it comes back from the fab house.  In the mean time, we're doing some pretty interesting USB debugging, which we'll write up in due course.  At this point, we need to know what's actually going on at the wire level, so we've hired a Packet Master from MQP Electronics.  We think this is a great idea.  We have a real need for an analyser right now but probably not on an ongoing basis, so hiring one for a week makes a lot of sense.