Giving birth is not an easy thing

See there!  A son is born — and we pronounce him fit to fight.
There are blackheads on his shoulders, and he pees himself in the night.
We’ll make a man of him put him to trade
teach him to play Monopoly and to sing in the rain.

The lyrics above are from Ian Anderson’s “Thick as a brick”. A bit sarcastic, I agree, but they somehow felt fit for what is going to follow in this blog. See there, a(nother) Open FXx circuit is born! After Open USB FXS has gotten itself into a relatively mature state, I thought, what the heck, why not give that poor FXS circuit a little brother to keep it company? And thus came Open USB FXO.

What is Open USB FXO — or, more correctly, what will it be when it grows up enough to see itself becoming a real circuit? The answer is “a Foreign eXchange Office” adapter, able to connect your computer to the PTT plug on the wall. Forgot to say, your computer will have to run Linux and Asterisk.

I decided to start with an Open USB FXO circuit design by the end of 2010. Other tasks kept me away from posting any details about it until March 2011. Soon I came up with the following schematic (warning! it’s not ready and it’s not going to work!):

Cannot make out anything on the picture above? Try clicking on it and you will get a zoomed-in version that’s readable (though if you cannot make out the big, red warning, you may need eyeglasses — I ‘ll come back to that warning in a second).

Wow, might you think, this schematic is already too advanced! How did that guy come up with it? Well, let me help you change your mind. Much like Open USB FXS, the schematic above is little more than a port of the manufacturer’s reference application circuit. Engineering starts from selecting the telephony chipset, in this case Silicon Labs’ Si3050, together with the line driver chip, Si3019. From then on, what I did as a designer was just to take a look at the manufacturer’s data sheet, import that into CadSoft Eagle and add the same PIC-based front-end that I already had from Open USB FXS — voilà, here came Open USB FXO!

And then it took less than ten minutes to figure out that this was all wrong.

How come? Well, I overlooked a slight detail: contrarily to the Si3210 in my Open USB FXS design, the Si3050 operates at 3.3V. The PIC 18F2550 operates at 5V. They do not interface, full stop. So much for my wonderful first-try design.

Thus, there were two things that I could do: use a 5V/3.3V level converter chip to interface between the 18F2550 and the 3050, or use a different microcontroller that operates at 3.3V. I quickly dropped the first alternative, because it would make the circuit too complicated and add to its cost. Starting with the second alternative, I had already invested much into learning the architecture, the instruction set, the USB idiosyncracies, and the inners of the PIC 18F2550 to let all that go. So, I looked for a different PIC that would be as much as possible compatible with the 18F2550 but operate at 3.3V. That did not take too long to spot: it was the 18F25J50.

At first, the two chips looked pin-compatible, and thus I thought that I could just replace the 18F25J50 in the schematic. Halas, I was once more wrong. There are quite a few differences between the two chips:

  1. The 18F25J50 has about one zillion new special-function registers that do not exist in the 15F2550 (but OK, if I did not need these, I did not have to learn about them all, did I?).
  2. The clock modes are different. However, the 18F25J50 datasheet lists a 20MHz/divide-by-5 option that is compatible with that of  the 18F2550 (needless to say: I ‘d have to stick with 48 MHz core clocking if I wanted to re-use my TMR1 data-handling routine from Open USB FXS).
  3. ICSP programming is different. The 18F25J50 does not have a VPP pin, and uses \MCLR instead (\ stands for “not”: the pin has inverted logic). But then, \MCLR cannot be connected directly to VDD as in my former design, and needs a typical 1k-10k pull-up.
  4. The actual core of the 18F25J50 runs at an even lower voltage, 2.5 V. Of course, the chip has an internal regulator that supplies this voltage. To use that regulator, an external pin (pin 6, called VDDCORE in 18F25J50, which has taken the place of 18F2550’s RA4, which, in turn, has vanished in 18F25J50) needs to be connected via a capacitor to VSS.
  5. The 18F25J50 does not have an EEPROM (puff! — there goes the nice code I developed for storing a board ID and the auto-bootloader…or maybe not? Michrochip have a promising Application Note on their site called “Emulating Data EEPROM for PIC18 and PIC24 Microcontrollers” on their site).
  6. I am not sure whether the bootloader software that I have been using for the 15F2550 will work on the 15F25J50. Maybe it will need modifications. But there is a nice Application Note on that as well.
  7. And then, of course, I would need to adjust VDD from the USB-supplied 5V to 3.3V. A couple of 1N4148 diodes in series would do that alright, yielding about 3.6-3.4 V depending on the actual diode make and the current drawn.
  8. (update, Apr 10): And it seems that the list doesn’t end here; the SDI and SCK pins are also in different places… I am checking for more diffs, while creating the Eagle library for the 25J50. (Update, Apr 12): However, the 25J50 has software-programmable I/O pins, among which are the SPI2 pins (SDI2, SDO2, SCK2). I might program these to coincide with the pins of the 2550’s SPI, and thus save me the additional changes in the schematic. Perfect!

So here is where I stand right now. I am studying the data sheet and the Application Notes to see if I can use the PIC18F25J50. I think in the end I ‘ll manage it, but who knows… Giving birth is not an easy thing, it seems. Especially if the parent is a guy like me, who first puts down a design and then consults the data sheets. Nevertheless, let us be optimistic. It’s a newborn circuit after all, so let us show it –and its parent– some forgiveness for all the small and big mistakes it contains in its design, and hope that they will get eventually all fixed. Hey, welcome to life, Open USB FXO!

Advertisements

18 Responses to “Giving birth is not an easy thing”

  1. Giovanni Bajo Says:

    Great project! I’m looking forward to see more progress!

    • Angelos Varvitsiotis Says:

      Hi Giovanni,

      Thanks a lot for your nice words! Progress on this one is guaranteed to be slow; these days I am very, very busy with other stuff, so Open USB FXO will have to sleep for a while. Please let me know if you are interested in contributing somehow.

      Cheers,

      Angelos

  2. Gabtek Says:

    Hi Angelos,

    I would like to see if I can help on this project, it’s very interesting.
    I am telco “asterisk” engineer.

    Thanks

    • Angelos Varvitsiotis Says:

      Hi Gabtek,

      Thanks for offering to contribute. At this stage, what is needed is to redesign the circuit and change the firmware accordingly. Can you help in this?

      Cheers,

      Angelos

  3. Brian Says:

    Hi Angelos!

    Well, looks like you’re stalled, but that doesn’t mean I’m less excited about you making progress! I really hope you are successful with this project!! 😀

    Brian

    • Angelos Varvitsiotis Says:

      Hi Brian,

      Thanks for your kind words. The truth is that, at this particular time I am very, very busy with other stuff, so Open USB FXO fails to receive any of my own personal “CPU time”. Hopefully things won’t be like this forever. And, of course, it’s an open project, thus all help is welcome!

      Cheers,

      Angelos

  4. Bruno Macias Says:

    Hola a todos estoy bajo el mismo concepto de tener un fxo module
    y poder en mi caso controlarlo desde la plaquita raspberry pi. Claro no usb sino usando los puertos GPIO del raspberry pi.

    Me llamo Bruno Macias,

    Les dejo este link me ha ayudado a enteder un poco sobre los componentes para un fxo, el cual hasta ahora siempre son los mismo el si3019 y el si3050 lo interesante en el link es otros link
    que detallan un disenio electronico mas para lo mismo.

    Saludos.

    http://www.embedded.com/design/audio-design/4015778/1/Building-an-Embedded-Asterisk-PBX-Part-2

    http://www.rowetel.com/ucasterisk/downloads/fxomod-0.32.pdf

    • Angelos Varvitsiotis Says:

      Hi Bruno,

      (For non-Spanish speakers, this comment speaks about controlling an FXO module with Raspberry PI, using the GPIO ports instead of USB, along the lines of David Rowe’s IP04 design – which however is not a general-purpose embedded system board like the Raspberry PI, but rather a dedicated IP PBX design).

      Bruno, it is not clear to me if you have started making this, or if you are asking me about it. In the second case, you would have to write some firmware or software for the Raspberry PI that would have to provide the driving signals. In his own IP04 board, David produces a 1024kHz for a 4 x 256-kHz PCM bus, and the respective FSYNC signal. Moreover, there is some interim circuitry that makes his FXS and FXO “modules” appear to the system like PCI devices. For the Raspberry PI, you would have to provide this additional functionality yourself.

      Cheers,

      Angelos

  5. ted Says:

    Sorry to the see has stalled as it would be a dream to play with one of these usb/fxo mods on a raspberry pi. it may not seem like it but people are watching this. hopefully someday! 🙂

    • Angelos Varvitsiotis Says:

      Hi Ted,

      Thank you very much for your comment. Comments like this one give me courage, and may eventually give the project the kick it needs to start over. Hopefully, one day (or another). For the time, your comment got me into thinking again what should be my next move in this project, should I find the time to revive it.

      My major problem is that the kinds of errors I experienced suggest a very fundamental error, which however is not visible — at least not to me.

      The supporting data I have are: my FXO dongle board proved impossible to serve as an ICSP programming board for the new PICs. I checked the connections many times and found nothing wrong (though it is absolutely possible that some error eluded me there). ICSP is the simplest form of PIC connectivity, and it should work right away. So, what is wrong there?

      After that, I resorted to using my Open USB FXS boards for ICSP. These finally worked, however after many tries. To make sure that the programmer did not have any damage, I checked again the programmer with one of my old 18F2550s. It worked right away. With the new 18LF2550s, recognition of the device by the programmer was somewhat erratic. And I had to hold the chip very firmly on the FXS board to have it recognized by the programmer. This suggests a possible problem with the specific chips I got me, although I do not believe in this version of the tale.

      Maybe an eye more experienced than mine will catch this elusive design error. Any help is welcome!

      Cheers,

      Angelos

  6. Brian Topping (@briantopping) Says:

    People are definitely watching! FXO/FXS would be a wonderful set of capabilities for rPi!!

    • Angelos Varvitsiotis Says:

      Hi Brian,

      Well, you have FXS for now! Let’s see if anyone can help out with the status of the FXO.

      Cheers,

      Angelos

  7. ted Says:

    Have you maybe tried asking people associated with Digium if they could help find your design error?

    I also have a friend who has at least some knowledge of these matters. If you would put together something specific to ask/show him I would be more than happy to pass it along.

    My email is: tgwaste at gmail dot com. Or you can just reply to the message I sent you regarding the FXS board. 🙂

    -Ted

  8. Mogan Says:

    Hi, can I know where did you get the Eagle library for the Silicon Lab’s chips that contain Si3050 and Si3019?

    -Moga

    • Angelos Varvitsiotis Says:

      Hi Moga,

      I made this library myself. My plans were, when a prototype would work (hence, the design whould be proven), I would made this publicly available at no cost under a GPL-like license (as I have done with the Open USB FXS files). I may do so now as well if you like to have access to the libraries, although the design and the libraries are not proven and may contain errors.

      Cheers,

      Angelos

  9. Dimitris Says:

    I’m really excited that I have found this project, even if I do not have the knowledge to deal with. Are you going to continue with this?

    • Angelos Varvitsiotis Says:

      Hi Dimitri,

      Thank you for your comment, and, again, apologies for taking so long to reply. I am not really active on this project, so I really doubt I am going to continue with it. Guessing from your email account, you seem to be living in Greece, are you? If so, do you know of anyone who would like to “inherit” this project? There are materials and a prototype (and lots of explanations) available for whoever would like to take over.

      Regards,

      Angelos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: