Archive for July, 2011

Did you connect the power plug?

July 15, 2011

The title of this post refers to the standard question from technical support, when one reports a problem with an electrical or electronic appliance over the phone: “is the power cable of your XYZ plugged into the mains outlet”? In this case, XYZ parallels to my brains, and the mains outlet  is something like the outlet of the universal common sense supply (let us assume that this supply exists anyway — and that it has an outlet somewhere…). This post explains why.

I had not written any new post on Open USB FXO since April. In reality, I was barely even thinking about my new project. The official excuse was that my new daytime job occupied just about all of my time. However, I believe that there was a slightly more complex (and much more sensere) explanation: because of the transition from the 18F2550 to the 18F25J50, this new project was now looking too complicated to me. I had already gone once through the realy early stages of design and development, back when I played with that first PIC development board (the one that refused to work unless I held it tenderly in my hands? Remember that?); I had invested much time into learning the PIC compiler and Microchip’s USB libraries; had made my first unsuccessful attempts in creating PIC firmware; and generally, I had stumbled upon every possible obstacle there was during these first steps. If I were to start over with a new processor, I would have to go through the same again — at least, so I was fearing. And I guess that this was what was really scaring me off my newborn FXO project.

Nevertheless, I started some work on the project: I first set to change the (open-source) Eagle library that I was using for the PIC 18F2550 into one for the 18F25J50. The 18F25J50 has vastly different pin names, and producing a schematic with the wrong pin names might work in practice, but would look ugly. The original library already conained the symbol and package formats that I needed, so what was remaining would just be a work of changing pin names. So, starting from the “microchip-pic18fxx5x.lbr” library that I used originally, I removed unneeded packages and symbols and changed the pins of the 18F2550 into the ones of the 18F25J50.

Now, funny, see how working in an open source context changed my view of the project.

Working in open source means sharing your work. If I were to give this new PIC18FXXJYY Eagle library away to others, I had to make it correct.  Changing the pin names would not suffice: as a final touch, I had to correct the HTML markup for the documentation of the library. It was then that I noticed that the original library also mentioned the PIC18LFxx5x, stating that this L stood for “low-voltage” — low whaaaaat?

A quick look into PIC18F2550’s datasheet confirmed that there is a low-voltage cousin of the 18F2550 that I used, namely 18LF2550. No wonder I had not noticed that so far; here is the only reference to “LF” that exists in the datasheet:

Standard devices with Enhanced Flash memory, designated with an “F” in the part number (such as PIC18F2550), accommodate an operating VDD range of 4.2V to 5.5V. Low-voltage parts, designated by “LF” (such as PIC18LF2550), function over an extended VDD range of 2.0V to 5.5V. 

No wonder I had missed that among the hundreds of pages of the datasheet (yes, I know this is no excuse)… Which means that there was a PIC18LF2550, that suited perfectly my needs, without needing to change anything substantial in my design. A quick lookup on Mouser revealed that not only did LF2550 exist, but also that it was in stock and priced quite the same as the F2550. In other words, all these redesign issues that gave me headaches could just vanish by using the 18LF2550!

A small change in the circuit would be required anyway for lowering the voltage to 3.3V. In the point where the circuit draws power from USB:

, I would have to add the two 1N4148 diodes that I mentioned in my previous post, just like this:

, and that would be it. Elementary… And this means that I can use my compiler, my hand-made FD-ART2003 PIC programmer, my flash memory utilities and my firmware without changing anything but the logic that interfaces with the Silicon Labs chipset.

So, after I connected my brains to the universal common sense supply (there had to exist a low-voltage equivalent of the 18F2550, and I should have thought about it before looking at another PIC), the project seems much easier to me, and I can start spending late-night or early-morning hours on it again. The little brother  just grew up a bit, after being stuck in its newborn state for quite some time.

Quick update, Jul 18: I think I will replace the two 1N4148 diodes with a BAV99 double-diode, in order to save some room in the PCB. I am now checking whether other designs use BAV99 successfully for dropping 5V to 3.3V. Anyone who can contribute on this, comments welcome!