Friday, May 8, 2009

Post Card #11 - Time Warp, Part One

Wow. The past two years have absolutely flown by. I started this blog at the time I started to get deeply interested in open-source software and subsequently open-source hardware. My original goal was to pursue building a USB-based T1 interface that could be used with FreeSWITCH. At the time there was no TDM interface for FreeSWITCH, so I couldn't use it to replace the outbound IVR that I had started building in Asterisk. However, the FS developers soon thereafter came up with OpenZAP, a TDM abstraction layer that allows FreeSWITCH to talk to TDM cards from Digium, Sangoma, PIKA, Rhino Technologies, OpenVox, etc. In one fell swoop my original motivation for this journey was neutralized. I consider that a good thing.

So now what? Well, I have new journeys. I have since changed employment and I now have another child. (Final score: 1 girl, 1 boy, hundreds of nights of frequently interrupted sleep.) I also have a new open source journey: FreeSWITCH. I now work for an open-source friendly company who supports FreeSWITCH and I now have a full-time job that allows me to work with Anthony, Brian, and Mike on a full-time basis. I consider myself extremely fortunate. How did I get here?

Nearly three years ago I started researching this interesting idea of an open-source PBX, Asterisk, and I quickly learned about the schism in the community. From my perspective I could see two main groups: those who supported the Digium way of doing things and those who felt that Digium was more like the "Digistapo." I asked about it on the Asterisk users list and was immediately attacked for being a troll and for going off topic. Fortunately, a long-time Asterisk user and TDM developer, Tzafrir Cohen from Xorcom, mailed me off list and gave me some background. I was very grateful for that. It helped me see where things were and where things were going.

What I discovered was that those who disagreed with the way Digium was handling things fell into two groups: the OpenPBX (now CallWeaver) group and the FreeSWITCH group. The former forked the Asterisk code base and took it in another direction. The latter started an entirely new telecommunications platform from scratch. At the time I was still new, but I investigated all three projects. I immediately liked the goals held out by the FreeSWITCH developers, but the project was still in its infancy and I couldn't really do much with it at that point. I decided to sign up on the mailing list and watch it. I visited the CallWeaver site but honestly I didn't see a lot of activity, nor did I see any real benefit for me to use it. Furthermore, I immediately purchased Asterisk - The Future of Telephony, aka the starfish, the moment I saw it on the bookshelf. That part was settled: I would use Asterisk to build my outbound IVR.

I spent many hours playing with Asterisk. I convinced my boss to let me buy a 4 port T1 card and play around. Being the PBX guy at our office, I knew how to "liberate" a PRI circuit for me to play with, plus I connected the Asterisk box to our existing office PBX. I was having a lot of fun learning how to do all sorts of fun stuff. And then... there were CDRs. I began to see that there were issues making CDRs work the way I wanted. For an outbound IVR I would need a lot of information, including on calls that failed for one reason or another. Frankly, I had headaches trying to get what I needed. I ended up writing nasty hacks to get the data I needed, using shell scripts and Perl to stitch together the data necessary to fill out my IVR history database. It felt like I was writing hacks to make up for deficiencies in Asterisk. I decided to look around.

I kept gravitating back to FreeSWITCH. I was keeping up with the users list and I could see that progress was happening slowly but very steadily. Then one day OpenZAP arrived! That was June 2007. Finally I could play with my IVR on FreeSWITCH! Well, sort of. I soon realized that the FreeSWITCH way of doing things was much different than the Asterisk way. If I may paraphrase Yoda: I had to unlearn what I had learned. Also, not too many in the FreeSWITCH camp were actually using TDM, so I was a bit of a pioneer. I must say that I was pleasantly surprised - I asked lots and lots of questions about OpenZAP and FreeSWITCH and I received answers directly from all three developers: Anthony Minessale, Brian West, and Mike Jerris. They also patiently helped me learn while also taking my feedback and making OZ better. All the while I did my best to document everything on the wiki. Things kept moving forward. Pretty soon I was able to tell the difference between a bug and a misconfiguration. In some cases there were both. I've lost count of how many "PEBKAC-induced segfaults" I discovered! Things kept moving forward.

I started spending more time on the IRC channel. (#freeswitch on irc.freenode.net) I slowly got into the position of assisting others and being the volunteer OpenZAP documentation guy. I like doing documentation so when Brian West suggested a weekly conference call to discuss documentation issues I volunteered immediately. We did those calls for a few months and cleaned up a lot of the documentation on the wiki. That kind of pooped out, though, because with users all over the world it was nearly impossible to find a time that worked for everyone. However, I still did my best to help out with the documentation and I volunteered to be a doc marshall.

Things were leading up to ClueCon 2008. I wanted to go but I couldn't afford it. Then one day Brian asks me what it would take to get me to ClueCon. I mentioned that I couldn't afford the entrance fee and the hotel, so if I could sneak in for free and have a roommate then I'd be good on that front, but the biggest hurdle would be getting permission from my boss. And by boss, I mean my wife. With two young children it would be a challenge, but she could see how badly I wanted to go, so we made the arrangements. I had to take vacation time because technically this wasn't for my day job. I was very glad I went. I met a lot of people whom I'd chatted with via email and IRC. I also had a very interesting conversation with Brian. But that's another story...

Monday, May 28, 2007

Postcard #10 - New purchases

Scroll to the end of this post to see a summary.

Well, I've been out on a bit of a hiatus. In addition to being ill, I've had the usual domestic responsibilities plus lots of stuff at my day job. However, I did make some progress in the acquisitions department.

First, I found a cheap copy of Build Your Own Printed Circuit Board. For $13 on eBay I figured that I couldn't go wrong. I'll report back on what I think of this book at a later date.

Second, I bought a development/learning board, the Spartan 3 starter board from Digilent. I figure this is a great item for getting familiar with embedded programming and how to handle FPGA's.

Third, I bought an Oscilloscope! I know I'm crazy, but I decided that if I'm gonna take the plunge, I'm going in head first and eyes wide open. It only set me back $181 out the door, so that's not so bad. It's an older Tektronix unit, the 2445. I figure it's a good place to start since it has four channels and a bandwidth of 150Mhz. (I hope that's enough for my projects!)

Of course, I have been reading as well. Not too much, just some light stuff. I've started on Understanding the Linux Kernel. I'm trying to get a feel for how the Linux kernel is related to the physical hardware. So far it's very interesting stuff. The book is a bit huge, but then again, so is the kernel. I'm starting from the beginning to make sure that I don't leave myself with too many knowledge gaps. Once I feel comfortable with the basics then I'll probably jump ahead to devices and drivers, specifically the PCI stuff and then the USB chapter.

None of my new toys have come in yet. When they do I'll get my lab set up. My boss has been totally cool about all of this - it's her money and therefore her stuff. I told her that I've been pouring her money into my brain. She's okay with it as long as I can apply the knowledge to our business. That, of course, is the challenge.

I'll be back next time with more tidbits that I've discovered.
-MC

Tuesday, May 15, 2007

Postcard #9 - Book Review, (g)EDA update

Scroll to the end of this post to see a summary.

Well, I've been doing a lot of reading lately because that's all I can do right now. I've been doing a lot of basic electronics refreshing. My trusty Radio Shack learning lab has been pretty fun. The little project books that come with it are well-written, and you can tell that the author, Forrest Mims, is genuinely enthusiastic about electronics. The exercises aren't brain-busters by any means. However, the act of physically laying out your components, double-checking your connections, then triple-checking your connections before flipping the power switch, is great practice. I can feel the character building inside... :)

I finally got all of the gEDA stuff running on my laptop. I had to go back to Centos 4.4 and I did a 'workstation' install. I still had to do the manual install because the installer program is broken badly. (It is a Python script that relies on a GTK library prereq that is missing/broken/messed up.) Anyway, it seems to be working, so at some point I can start playing around with circuits without actually blowing stuff up. For kicks, I downloaded TinyCad to get a different perspective. I'll report back my opinions at a later date.

Lastly, the books. I've moved away from USB Complete for a while so that I can focus more on the basics. I've been perusing Digital Electronics Demystified and I've been slurping down Designing Embedded Hardware. Here are my thoughts:

Digital Electronics Demystified - The author starts out with a good explanation of Boolean logic, but he quickly digresses into an overwhelmingly confusing discussion of what I can only describe as the logic version of spaghetti code. This was to set up the introduction of two related principles: the "sum of products" and the "product of sums." Good principles, poor introduction. Mercifully, the chapter ended and the next chapter got back to basics. I'm not keen on the author's style, although when I looked up a specific chip - the 555 timer - his entry and explanation were actually pretty good. I'm continuing this one with guarded optimism.

Designing Embedded Hardware - This is an instant classic! The author knows his stuff and presents it very well. You can tell that he is not merely an expert in his field of study, but that he is also an educator. I'm really enjoying his book so far. (I've just got to chapter 4.) The principles of embedded design translate nicely into the idea of building self-contained peripherals. I can highly recommend this book, which I personally got from an eBay auction.

Thanks for letting me ramble. If you have any reading suggestions I'd love to hear them. I'll be in touch soon, hopefully with something more substantive.

-MC


Summary:
  • The Radio Shack learning lab I bought is not glamorous, but is fun and useful for getting back to basics and practicing circuit design and layout
  • Finally got gEDA working with Centos 4.4
  • Have been reading a few electronics books. Designing Embedded Hardware is an excellent read, a book I can highly recommend to anyone interested in learning more about the subject.

Friday, May 11, 2007

Postcard #8 - Knowledge vs. Naivete

This is just an update on my status since beginning this project.

When I started, things looked like this, on a scale of 1 to 10:

My knowledge: 2.9
My naivete: 9.6

After one week of reading, researching, and ruminating:

My knowledge: 4.4
My naivete: 3.9 (!!!)


I wish my knowledge level was increasing as quickly as my naivete level is plummeting! :) I understand now just how challenging this project is really going to be. However, I'm not ready to give up after only one week and no lab testing.

See you next time.

-MC



Thursday, May 10, 2007

Postcard #7 - Protoypes, Breadboards, etc.

Scroll to the end of this post to see a summary.

Lately I've been looking at ways of doing prototyping without trying to create my own PCBs. Since my goal is to have a T1 connect to a USB port, I must have at least those two elements. However, I'm 99% certain that I'll need intermediate logic and circuitry, which is where the FPGA comes in. That leaves me with at least three different prototype/breadboards:
  1. USB prototype board, like the CY3682 from Cypress
  2. T1 SCT prototype board, like the DS2155DK from Maxim/Dallas Semiconductor
  3. FPGA prototype board, like the Nexys, Basys, or S3BOARD from Digilent
Here are some notes on the above items:

First, the USB prototype boards from Cypress seem to be in low supply, and they cost about 500 USD. I'm not sure what that's all about. There is a MoBL ('mobile') version but I'm not entirely certain that it is what we're looking for. An alternative might be the USB2 from Digilent. Technically it's just a communications board that allows the S3BOARD to be USB-ready, but I contacted Digilent tech support and they said that it could be jury-rigged to work with the Nexys or Basys. NOTE: messing with the USB firmware on the Nexys or USB2 will void the warranty! Digilent also has lots of other accessory boards for the mad scientist types.

Second, the DS development kit is 400 USD and it includes the DK101 low-cost motherboard that can be used with other Maxim development kits. This may be my only option other than trying to design my own PCB and having it manufactured or creating my own the old fashioned way. I will keep looking before I drop the money for this one. One thing I'll do more research on is the possibility of a small, custom breadboard by utilizing something like an SMT
adapter. I'll report back when I know more. [ UPDATE: I found some handy stuff at beldynsys.com. Specifically, I found a socket adapter for QFP100 packages.]

Third, I am REALLY impressed with the Digilent products and tech support. They answered my questions very quickly and were quite helpful. I expect that I will be ordering a Nexys board here very soon. (100 USD)

If anyone out there has experience with creating PCBs, especially in doing breadboards with SMT components then I'd be very interested in your input. Please feel free to leave a comment.

That's all for now...

-MC


Summary:
  • I'm researching development kits for USB, FPGA, and T1 SCT
  • Digilent has very cool stuff
  • USB and T1 prototyping seem more difficult (i.e. more expensive)
  • I'm doing more research into other options for SMT prototyping

Tuesday, May 8, 2007

Postcard #6 - FPGA's, PCB's, and (g)EDA

Scroll to the bottom of this post to see a summary.

Well, I'm still gEDA-challenged right now, but that's because I haven't had much time to sit down and coax it into working. In the meantime I've been doing other research...

I found some interesting sites that talk about PCB fabrication:
My goal here is to find some help for the production of the PCB's and, where possible, get some assistance w/ component layout, etc. I'm also hoping to get an idea on the prices we're looking at for a project like this. Mostly, though, I'm just trying to learn more about the process of PCB creation since I haven't touched the subject since high school.

I'm also looking into FPGA's to get an idea of what we need, what they can do, how much they cost, etc. I've also looked at some of the development kits that are available. I'm not ready to throw down much money (yet) because I'm not quite there yet, although I did see some really inexpensive FPGA learning kits on eBay. (~16 USD) I also found a very cool set of products from Digilent. They have several FPGA starter kits, ranging from 50 - 150 USD. They also have add-on boards for mad-scientist tinkering. I'm seriously considering picking one up. In the meantime I've printed out the Xilinx Spartan-3 family datasheet. It is definitely an improvement over the Spartan-2 datasheets.

That also lead me to another question: how am I going to test my circuit? The only thing I could think of is an oscilloscope. Curiously, there are open source oscilloscope projects out there, including one with a cool USB attachment that runs about 200 USD. Again, I'm not willing to part with lots of money until I at least give the 'free' options a chance to shine. I'll report back after I've had more time to digest all of this stuff.

-MC


Summary:
  • I suck at getting gEDA to work
  • There are lots of firms that produce PCB's - prices vary widely
  • I have Xilinx Spartan-2 and Spartan-3 datasheets for 'light reading'
  • Digilient has cool starter boards for learning about FPGA's
  • I'm research O-scope options for a limited budget

Monday, May 7, 2007

Postcard #5 - Digging Deeper into the T1

Scroll to the bottom of this post to see a summary.

I've started re-reading Matthew Gast's T1 - A Survival Guide. The last time I read it, I was simply looking to answer some specific questions while attempting to connect my Asterisk box to my NEC NEAX 2400IPX PBX at my work. (BTW, I was able to successfully connect my Asterisk and NEC PBX's using the quad T1 (T400P) card I have - both with 'line side' and 'trunk side' T1 cards in the NEC.) This time around I am trying to get a deeper and more complete understanding of the T1 spec. Fortunately, I've been a 'telephone guy' for about 12 years, so the telco jargon doesn't affect me anymore.

I have to give Gast two thumbs up for his book. It is shamelessly focused on American telco and history, but since I'm in California I don't mind. Besides, many of the principles apply on a broad scale, and the specifics of E1's (Europe) and J1's (Japan) can be gleaned from other sources. I have no intention of being Yankee-centric on this project - I guarantee that I will get as much help from around the world as I will domestically. (In fact, the only person to contact me so far is not from the Western Hemisphere.)

Thus far I feel comfortable with the basics of the T1:
I have also started digging into the specs of what I suspect will be the IC that is used for T1 communications: the Dallas Semiconductor DS2155. This is a single-chip transceiver (SCT) that seems to have lots of capabilities. The quad version of this chip is what drives the T400P boards that I currently use with my Asterisk boxes.

I printed out all 238 pages of the data sheet, plus a nifty application note about creating a circuit to connect to the telco and how to protect my circuit from voltage spikes, etc. The data sheet has all sorts of detailed information that I believe will be useful once the firmware and device-driver stages are being considered. I'm reading it now because I'm hoping to find any red flags and address them before I get too far into the project. If this chip is not suitable for the project then I need to know ASAP so that I can go elsewhere. If anyone has any experience at all with this or similar SCT's or T1/E1/J1 framers, by all means send me your feedback and advice.

I've learned a few interesting things about T1's so far: timing is inferred from the bit stream - an interesting concept. (Yes, there are LOTS of timing and clocking factors but I don't have time or space to list them all.) Also, the time slot for a single bit is 684ns. An entire extended superframe (ESF) has 24 8-bit frames for a total of 192 bits. That's a little over 131 microseconds for an entire frame to be read! Yeah, that's fast. It makes me wonder about how easy (or difficult) it will be to get the datastream to and from the USB controller without messing up the clocking. We'll see.

I have ordered a pair of DS2155's (free samples) from Maxim for use in my 'lab' - such as it is. By lab I mean "a cubicle at work that no one is using at the moment." Still, it's clean and quiet and the boss lady doesn't mind as long as I get all of my regular work done. When I get my units I will then start looking at the other fun stuff of this project: PCB's, FPGA's, USB Controllers, various components, etc. In the meantime I've been perusing the spec sheet of the DS2155 in an attempt to familiarize myself with its capabilities. I've also been looking at the original Zapata telephony Tormenta2 specs since it uses a similar SCT, the DS21Q352. (The T400P's that I have are very similar but they use the slightly more updated DS21Q55 - the quad version of the DS2155.) One thing I appreciate is that Jim Dixon has lots of schematics for viewing, which is cool because it helps me visualize the flow of data from the smart jack to the PCI bus and back. While this isn't totally analogous to the flow of data to/from the USB controller, it is a good jumping off point.

The next postcard will have an update on my (lack of) progress with gEDA, plus some research into the world of PCB fabrication.

-MC

Summary:
  • I'm re-reading T1 - A Survival Guide to fill in the mental gaps
  • I'm happy to report that one person so far has helped me with the project
  • I've printed out all 238 pages of the DS2155 spec sheet, plus app notes from Maxim
  • I've been looking at the original Zapata Tormenta2 specs for education, inspiration