New - I have blogged on the bring up of this design here and here.

This project is a modular four port daughter card for the Blackfin STAMP. Three printed circuit boards have been designed:

  1. 4fx: Is a card that plugs into the STAMP board. It has 4 RJ11 connectors, a Blackfin SPORT connector, and a SD card connector. There are four connectors on the board that can each accept a single port FXS or FXO module, much like the Digium TDM400. Each port has a LED next to it. The LED glows green if a FXS module is installed, or red if a FXO module is installed. The led is off with no module installed. 4fx boards are designed to be stacked to obtain multiple of 4 ports. Screen shot and schematic.

  2. fxsmod: Is the 25 x 50mm FXS module PCB, it implements a single FXS port based on the Silicon Labs Si3010/3201 chip set. Screen shot and schematic.

  3. fxomod: Is the 25 x 50mm FXO module PCB, it implements a single FXO port based on the Silicon Labs Si3050/3019 chip set. Screen shot and schematic.

Design Notes

  1. The FXS and FXO port designs are straight out of the Silicon Labs data sheets for the 3050 and 3210 parts.

  2. The Xilinx chip on the 4fx is used to decode nCS signals to the 4 modules. Unfortunately we can't use the daisy chain techniques described in the data sheets to cascade chips using one chip select as the mechanism is different for the FXO and FXS chips. As we don't know what sort of module will be plugged into each position we need to use a technique (an individual chip select) that will work for both FXO and FXS chips.

  3. The Xilinx chip also also drives the LEDs. I plan to use an initial SPI byte to drive the LEDs and/or nCS lines before sending the SPI bytes to the Si Labs chips.

  4. The Xilinx chip can also be used to handle stacking boards using a daisy-chain technique similar to that described in the Si Labs data sheets, but on a board by board basis. I am still working on that bit.

Credits

My wife Rosemary actually did a great deal of the schematic entry for the FXS module.

Jerry Zeng from Analog Devices was very helpful in checking the design and with brain storming the CPLD requirements.

Design Rule Checks

To perform a schematic DRC for the 4fx board:

[david@solomon hardware-0.3]$ gnetlist -g drc2 -o - 4fx.sch

To extract the netlist for the PCB:

[david@solomon hardware-0.3]$ gnetlist -g PCB -o 4fx-nc.net 4fx.sch
[david@solomon hardware-0.3]$ ./ncnet.pl 4fx-nc.net 4fx.net

Analog Kits Assembly and Testing

Here are the instructions for assembling and testing the 2 FXO 2 FXS Kits. These instructions assume a BF537 STAMP. Contact me if you are using a 533 STAMP - a different uImage is required but apart from that there are no major differences.

Please remember that the hardware and uCasterisk software is Beta. Please email the Blackfin uCasterisk forum if you have any questions or comments.

Before you start

  1. You need a 12-15V power supply. The standard 7V STAMP power supply is not powerful enough to run the FXS cards. If you try to use the standard 7V power supply the FXS drivers won't start.

    I use a 15V laptop power supply for my work. I needed to fit a different size connector to suit the STAMP DC socket. The STAMP runs happily with a regulated DC input between between 7V and 20V. The centre connection of the socket is positive.

    Carefully check the new power supply with a multimeter before connecting to your STAMP. Check that the centre conductor is positive and that the voltage is between 12V and 20V.

  2. You need need a recent version of u-boot installed:

    U-Boot-1.1.3-ADI-R06R2 (Sep 21 2006 - 15:10:36)

    Without a recent u-boot the test code will not boot correctly:

    • You can get a recent version of u-boot here.

    • Instructions on updating u-boot are here.

    • If you upgrade u-boot on your BF537 you will also have to reset your Ethernet MAC Address, instructions for that are here.

    • After upgrading u-boot use "setenv" to set up your serverip and ipaddr, and "saveenv" to save these u-boot variables.

    Be very careful when you update u-boot, if you lose power at the wrong time or use the wrong command it is possible to kill your STAMP (requiring a JTAG cable to bring it back to life).

  3. You need some experience in using the STAMP, for example:

    • compiling uClinux-dist

    • using u-boot (say tftp-ing a uImage, "saveenv", "setenv" commands).

    • connecting your STAMP to your LAN

    • telnet-ing to your STAMP

  4. It is recommended that you have some experience in using and configuring Asterisk on x86 systems, for example configuring dial plans, SIP extensions, configuring and installing and analog telephony hardware.

  5. Obtain the test image "uImage.537.2fxo2fxs" here and place it in your tftpboot directory on your tftp server.

  6. Do not plug a SD or MMC card into the daughter card - the current driver doesn't support Asterisk and the SD card at the same time (they interfere with each other on the SPI bus). This will be updated as the driver develops.

Assembling and Testing

4fx spacers
  1. First attach the two threaded nylon spacers (included in the kit) to the daughter card using the supplied bolts. See the picture above.

    • The longer bolt goes through the hole in the corner of the daughter card.

    • The shorter bolt goes through the large hole near the text "Port 1". To fit the shorter bolt you need to remove the Port 1 module.

    When mounted on the STAMP, the longer bolt fits through a hole on the BF537 STAMP board and helps secure the daughter card. The shorter bolt and spacer prevents the daughter board from touching the SPORT0 connector. Tighten the spacers firmly with your fingers. Don't tighten too hard to prevent damaging the board.

    Tip DO NOT attach the daughter board to the STAMP without these spacers - a short circuit will damage both boards! I speak from experience :-)
  2. Once the spacers are attached, plug the daughter board assembly into the STAMP SPORT1 connector. The tip of the long bolt should fit neatly through the hole in the corner of the STAMP.

  3. Check that the bottom on the daughter card is not touching any of the SPORT0 pins, there should be several mm clearance.

  4. Plug in the power supply (at least 12V as described above). Check that the STAMP boots normally.

  5. Disconnect the power. Plug an analog telephone into Port 4 (the port next to the SD card).

  6. Connect the power again to re-start the STAMP. Immediately press a key on the serial console to enter u-boot.

    At the u-boot prompt tftp the uImage, then boot the uImage:

    bf537> tftp 0x1000000 uImage.537.2fxo2fxs
    
    <snip>
             #################################################
             #################################################
    done
    Bytes transferred = 5964432 (5b0290 hex)
    
    bf537> bootm 0x1000000

    After about a minute of "Uncompressing Kernel Image…" the system should boot. If all is well the LEDs will light like this:

    success

    If everything is OK the serial console won't respond (the uImage version of uCasterisk disables the console while running). This will be the final few lines on the console:

    Module 3: Installed -- MANUAL FXS
    Found: Blackfin STAMP (8 modules)
    wcfxs_init_ok = 1
    Registered tone zone 0 (United States / North America)
    No entry for terminal type "dumb";
    using dumb terminal settings.

    If the LEDS don't light or you get a root prompt at the console see the Trouble Shooting section below.

    Lift the handset and you should get dial tone. Dial 2000 to get the Asterisk demo. Port 3 is extension 2001, port 4 is extension 2004. Incoming calls on the FXO ports 1 & 2 get sent to the Asterisk demo.

    If booting is successful then the serial console won't respond. You can however telnet into the STAMP (the IP is obtained via dhcp when the uImage boots) to start/stop Asterisk or change the configuration, "asterisk -r" will connect you to the running Asterisk server.

  7. To get the STAMP to boot this uImage on reset every time, try this from the u-boot prompt:

    bf537> setnenv ramboot 'tftp 0x1000000 uImage.537.2fxo2fxs; tftp 0x1000000'
    bf537> setenv bootcmd 'run ramboot'
    bf537> saveenv
  8. For testing I connect Port 3 (FXS) to Port 1 (FXO) or Port 2 (FXO). Then, on a phone connected to Port 4 (FXS), I dial 2001, which is answered after a few rings by the FXO port. The FXO Ports are configured to run the Asterisk demo when answering a call.

Trouble Shooting

If the boot process is not successful, then you will probably get a root prompt on the serial console. There will be lots of text on the screen showing what happened during the boot process.

  1. If you see something like:

    ProSLIC on module 3 failed to powerup within 520 ms (0 mV only)
    
     -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??

    This may mean your power supply voltage is too low. Do you have a 12V to 15V power supply connected as described above?

  2. If the STAMP hangs when booting uImage.537.2fxo2fxs, but boots from flash OK you may have the wrong u-boot version. Check your u-boot version as described above.

  3. If some of the LEDs did not light, this indicates that the STAMP couldn't auto detect the modules.

    • One possibility is that the module contacts became loose during shipping. Try carefully removing and replacing each module. You can also try cleaning the module contacts with a little solvent.

    • Make sure no SD-card is plugged in (as described above).

  4. Try compiling and downloading unittest/spi/tspi_4fx.ko, this module can be used to determine if the basic operation of the daughter card is OK. See the C source file for insmod options.

Building uCasterisk for the Analog Kits

The procedure is very similar to here.

  1. To build uImage.537.2fxs.2fxo I used a CVS checkout of uClinux-dist to build uCasterisk and the latest toolchain (2006R2 RC2).

  2. uCasterisk-0.1.6.tar.gz was used, download from here. This version has up to date drivers for the hardware. Note that although it is very similar to the Asterisk version in uClinux-dist, it is not the same. In the near future we hope to merge the uClinux-dist version of Asterisk for the Blackfin with uCasterisk.

  3. Make sure you have compiled uClinux-dist first - the zaptel drivers depend on several files that are generated by the uClinux-dist make process.

  4. Once Asterisk and the zaptel drivers have been built, use this to install and configure:

    ./scripts/install_all `hostname`
    ./scripts/config_2fxo2fxs `hostname`

    The last step installs config files to support the 2 FXO 2 FXS hardware configuration. During the last step check dmesg on the STAMP to ensure that "ztcfg" ran OK. If you don't see this:

    Registered tone zone 0 (United States / North America)
    Registered tone zone 0 (United States / North America)

    (it should appear twice) try typing:

    /var/tmp/ztcfg
  5. Then start Asterisk:

    /var/tmp/asterisk -vc
  6. At the CLI

    blackfin*CLI> zap show channels
       Chan Extension  Context         Language   MusicOnHold
    
     pseudo            internal
    
          1            incoming
          2            incoming
          3            internal
          4            internal
  7. To make your own uImage try:

    make bin

    This will create a bootable image in "images". The configuration files (for example defining the SIP settings or the dial plan) are copied from package/asterisk/files and controlled by the "bin:" target in package/asterisk/Makefile.

SD card Interface

There are two known issues with the The SD-card (MMC card) interface:

  1. The drivers used for this version of uCasterisk are currently not integrated with the uClinux "SPI framework" which is used for the SD card. This means that at present it is not possible to use the SD card at the same time as uCasterisk. The fix for this is to port the drivers used for uCasterisk to the SPI framework. Jerry Zeng at Analog Devices is doing some work in this area.

  2. When tested by itself, the MMC drivers are not reliable on the daughter card hardware. This could be a hardware and/or driver issue (it is not clear at this stage). Sometimes the drivers work perfectly (i.e. files can be copied to and from the SD card). Other times installing the driver causes a kernel panic or there are error messages when data is written to the card. More work is required to track down the cause of this problem.