Archive for June, 2015

Do touch my packs, if you please, Mr. Customs man!

June 30, 2015

Must be some kind of planet
For all the people who can manage.
All of us who can handle it,
With all of this damage.

The Dandy Warhols, “Plan A”

It feels strange to type into WordPress after two years of complete abstinence and four years since any actual work on this project. It’s already year 2015, and last time I had something to say it was back in 2011! For sure, there is good reason for me writing a new post now. But let me not run too fast, or else I will spoil all the joy from readers. Instead of telling right away my reason for posting, I will start telling a story of how the things came, or what the goddess lady Fortuna (who may be the same person as the ancient Greek goddess Tyche) brought about.

Two and a half months ago, an email came in from a gentleman under the name of Victor, who lives in Canada. Victor stated he was interested in both my Open USB FXS and Open USB FXO projects. I patiently explained to him that Open USB FXO is very much in a complete failure state, and he should not expect anything working out of it. In vain. Victor insisted that he was sincerly and truly interested in the project whatever its status was, and he asked that I sent him any materials I had in order for him to build an Open USB FXO board.

Which I did: I unburied my forgotten carton box with the ingredients of Open USB FXO project out of inexistence, dag carefully into it and fished out what I had to in order to compile a kit. As a side note, never before had I compiled an Open USB FXO kit, because I would never pass to anyone something that doesn’t work. Compiling such a kit felt anyway strange…

Then, the package I sent to Victor probably was of great interest to the Canadian Customs Office, who withheld it for five (!) weeks of processing. I guess that, during this time, the Customs authorities had ample time to fully analyze the contents of the kit, make sure it did not contain any harmful substances, and even verify the correctness of the resistance values typed with miniscule letters on the tiny 603 resistors! They must have also had enough time to reverse-engineer the code flashed into the PIC 18LF2550 that was included with the kit into high-level C code, and I am pretty much sure that they checked on the BOM, too, and verified that the kit was complete. Anyways, it is good to know that there are interested hobbyists everywhere out there.

Against all odds, the fact that the Customs guys took their time to process my package was a lucky coincidence.

Why, might you ask. The answer is that, because in the meantime, Victor and I had the time to discuss a bit about the status of the project. And Victor, who proved a very methodical guy, not having in his hands an actual kit to play with, found it useful to devour (information-wise, that is…) the whole PIC18(L)F2x550 manual. And, when he came down to page numbered 362, he noticed that nice graph on Figure 28-2. What this graph says is that the maximum frequency of the PIC18LF2x550 is dependent on the supply voltage. Put in other words, the graph clearly said that this otherwise fine device will not run in 48MHz unless powered with 4.2V or more! No wonder my FXO board did not even start on USB power.

Victor just had found the (first, and doubtedly the only) flaw in my design. Open USB FXO, as currently designed, will never work. While at first it would seem that using a lower frequency is a workaround, actually it is not: the TMR1 interrupt service function that implements the PCM bus (you will have to consult my Open USB FXS blog for more information on what this function is and how it works) will not tick correctly unless the processor core is clocked at 48MHz.

So, what is next? How could we fix that? Well, there are two paths. Let me go back to the reasons for selecting a PIC 18LF2550 for this design: it all has to do with interfacing with the (3.3V) chip Si3050. Hence the trick with the BAV99 double diode, to drop the USB-supplied voltage to approx 3.3V. But then, this PIC will not work at 3.3V/48MHz. It must be powered at 5V. So, what could be done?

Solution #1 (and the one adopted by Victor) would be to stick to PIC18F2550@5V and use a 5V/3.3.V lever converter chip between the PIC and the Si3050. This would have to interface all the SPI and the PCM bus signals, namely SCLK, SDI, SDO, CE for SPI and FSYNC, PCLK, DRX and DTX for PCM. Plus the INT and RESET signals, this totals to 10 signals. Wow, that’s a lot!

Soluion #2 may be a bit more dangerous, and it’s the poor man’s equivalent. It consists in using the 18LF2550, still at 5V, and use resistor-based level reduction for the signals from the PIC to the Si3050 (SCLK, SDO, CE, FSYNC, PCLK, DTX). How about the other four? Well one could gamble on these, and attempt to interface them directly to the PIC18LF2550’s inputs. According to the manual, when powered at 5V, any input with a level of 2V or more is interpreted as a logical one. Logical one outputs from the Si3050 would be close to 3V, so that path looks safe enough (and cheaper than a level converter chip).

Again, I think that we owe much of this to the Canadian Customs authorities who have delayed the package. That’s why I used this, slightly rephrased lyrics from Arlo Guthry’s song “Coming into Los Angeles”. I guess Arlo was afraid of what the officers would find in his bags. While we were lucky they did check my package. I don’t know what they found. I know that all of us did: Victor found a solution, and the Open USB FXO project found a new father. It also found new hope of becoming a reality. A great thanks to Victor, goddess Tyche and the Customs! All of those who did handle it with all of this damage!