Archive for the 'uClinux' Category

Embedded RTP under µClinux on Nios2

I’m working on an application with PJMEDIA under uClinux on Nios2 environment. I have a stream audio with codec L16 48000 stereo and mono.This works good.

[pjsip] Resampling module add

It’s good to hear pjsip and pjmedia being ported on different embedded systems. The quote above relates to Nios II from Altera. Nowadays, running a media stacks such as RTP is very important for embedded processors such as Nios2.

If you have any other experience in using our protocol stacks on other embedded devices, please feel free to share it!

Easy Setup of the Blackfin BF537-STAMP Development Board

The setup of a Blackfin BF537-STAMP board involves plugging in the AD1836A audio board, AC Adapter, network cable, serial cable, and using Hyperterminal to monitor boot-up sequence of the BF537 board.

This post builds on previous posts on porting pjsip to Blackfin and assembling components for embedded systems programming.

I will start with hardware setup as it is the easiest, so hopefully success at this will motivate you for the software setup, which can be, to use a technical term, fiddly.

Hardware setup

  1. Unpack the BF537 board and audio daughterboard.
  2. Plug the audio daughterboard to the mainboard, using the SPORT 0 connector. Match up pin 1 on both boards. You will end up with a dangling audio board, put some support under the audio board so it doesn’t strain the SPORT connector.
  3. Connect the BF537 board to the development PC using the serial and ethernet cable.
  4. Using HyperTerminal, connect to the serial port where the connecting cable is plugged in. As advised by the Blackfin uClinux docs website, use these setting:
  5. HyperTerminal Settings

  6. Plugin the AC adapter to the BF537 board. You should see lights turning on the board itself, and uClinux should be booting on your HyperTerminal console. You will end up in the uClinux prompt.
  7. Congratulations, you’ve successfully setup an embedded system! (Well, an embedded development environment really)

Software setup

The main steps in setting the tools needed are:

  1. Setup coLinux from Blackfin uClinux. Includes setting up networking so coLinux and BF537 board can see each other.
  2. Replace old toolchain in coLinux.
  3. In coLinux, download the uClinux distribution and U-Boot that matches the toolchain version.
  4. Replace U-Boot bootloader on BF537 board.
  5. Setup U-Boot to boot the uClinux downloaded in step 3.
  6. Use tftp server on coLinux so we can transfer file from host PC to BF537 board.

Steps in greater detail (with links to documentation as appropriate):

  1. Setup coLinux. I used the one available on Blackfin uClinux site and followed instructions from the documentation site.
  2. If your installation is successful you should be able to login to coLinux.
  3. Replacing the tool chain involves deleting the old one using apt-get remove and installing the new one using alien.
  4. Releases in Blackfin uClinux are named in the format of 2006R2, 2007R1 etc. It is important to know this because you need to have the same release of these software
    1. Toolchain
    2. uClinux
    3. U-Boot
  5. Upgrade the shipped U-Boot on the BF537 board with the latest one.
  6. Boot uClinux by downloading the image to BF 537 board.
  7. Now you can try the Hello World application.
  8. When you can compile and run the Hello World application, you are all set to begin real development!

Any questions or problems, just leave a comment.

How to start embedded SIP development on Blackfin uClinux

In the process of porting pjsip to Blackfin, you will need an appropriate embedded development board, software tools, and development host.

Embedded development board

  • There’s some choice of development boards, but for simplicity I suggest using the STAMP boards with its audio card.
  • You will need:
    • BF537-STAMP (available at Digi-Key)
    • AD1836A Audio Daughter Board (available at Digi-Key)
      • Again for simplicity, just order both the board and audio card from Digi-Key, even though technically you can contact your local distributor for Analog Devices. Certainly for people living in USA, it’s a no-brainer. I tried several places listed in the local distributor for UK, none have stock and certainly the audio card was hard to find. So I ordered from Digi-Key anyway, it was shipped within 24 hours. But I made the mistake of choosing Global Express Mail, it’s slooow and in the UK handled by ParcelForce. Enough said.
      • Be aware of customs, taxes, and the cost of collecting such taxes. For the UK, HMRC demanded about £55, and ParcelForce added £13.50 collection fee.
    • A straight-thru serial cable that ends in DB9 (9-pin) male. 180px-9_pin_d-sub_connector_male_closeup.jpg The other end depends on the serial port you have on your development host PC, usually you will need a 9-pin female plug. So look for a straight-thru (not null modem) 9-pin male to 9-pin female. In the UK I can recommend CableStar. Clear and fair pricing with fast delivery.
    • A network patch cable:
      • If you connect your Blackfin STAMP board directly to your development PC then you need a cross-over cable. Here’s one example on CableStar.
      • If you connect the board to a hub, then just a normal patch cable.

Software tools

  • All related embedded development tools can be downloaded from Blackfin Linux.
  • You will need:
    • A set of compilers, linkers called the Toolchain.
    • uClinux distribution
    • U-boot bootloader
  • I will detail the experience of setting up the development host with the tools above in another post.
  • Since I use Windows, I will also need coLinux as a host.

Development host

  • PC running Windows with coLinux. The docs/forum seems to suggest there is a Windows port of the tools, but the releases pages of the tools seems to be Linux only.
  • Available serial port. Modern PCs does not have this, so you may have to buy a USB-to-Serial adapter/dongle. Any make will do, I bought mine from eBay.
  • Available Ethernet LAN port if you want to connect the development board directly to your PC, which I recommend as it makes things a bit easier.

That’s all for now. In the next post I will connect them altogether, and hopefully have a running system.

Until then, if you have any suggestions or questions, just leave a comment!

Porting pjsip to embedded Linux on Blackfin DSP

Over the next few posts, I will do a walkthrough on porting pjsip to embedded Linux (specifically uClinux) on the Blackfin Digital Signal Processing (DSP) processors from Analog Devices. Along the way, I hope to give a few insight into programming embedded systems in general.

Blackfin (r) Logo

Why Blackfin Processors?

  • Popular. It can run uClinux as an embedded operating system.
    • uClinux ™ Logo
    • There is already the Linphone Blackfin port, so I know SIP and media works.
    • Recently Global IP Solutions (GIPS) has ported and optimized its VoiceEngine Embedded software to Blackfin processors as well.
  • Well documented. The Blackfin on uClinux site has tons of free software and documentation. Most importantly GCC toolchain (compiler, linkers, debuggers) is available and supported.
  • Somewhat exotic. Although probably not as exotic as pure DSP processors such as the TMS320 series from Texas Instruments, but still it is an embedded systems processor. In contrast processors based on x86 are more like small PCs, therefore expensive in terms of cost and power usage.
  • Affordable development board readily available. Relatively speaking, of course.
    • I was able to buy the BF537 STAMP and audio card for a total of £276 from Digi-Key, that includes shipping (to UK), customs, and taxes. I will detail what you need exactly in another post.
    • Here’s a tip if ordering from the UK: Don’t choose the Global Express Mail option. Although it saves about £20, it takes way too long (almost 2 weeks) and the ParcelForce handling here, well… can be improved.

Initial Approach

For this exercise, I have chosen Windows as my development machine. Although using Linux is more straight forward, I am using this porting effort as an excuse to try out new stuff like coLinux. Other than that , I will try to stick as much as possible to the suggested tools.

What next?

I will describe in more detail about getting the goods and preparing your development PC. After that we should be well on our way to start development.

If you have any thoughts on how this should be structured, or any other additional information you’d like to see covered, just leave a comment and I can try to fit it in.