Telephony H/W firmare with Elixir Nerves

Picked my my first BeagleBone Black on Friday. By Sunday evening, I was running 1000 line state machines running on the BBB, each registered with our Asterisk based PBX switch. Between Friday night I had to learn the BBB and the Elixir Nerves project as well as programming / porting a couple KLOC of elixir code to the BBB.

This is only the first stage of the project since I still have the drive the FPGA on our hardware card though an SPI interface.

What I have running is a:

  • supervisor capable of dynamically starting a LineSm GenFSM server
  • LineSm state machine
    • Opens a Reliable UDP socket with the PBX
    • Identifies itself (id, device type, device capabilities)
    • Updates a cache on each event with its current state
    • On a crash, recovers its last state from the cache
  • Remote console
  • Firmware update through http

I was pretty impressed with how easy it was to get up and running with Nerves. With the nerves_firmware_http package the workflow is pretty slick. I created a simple script that runs the mix firmware and updates the firmware with a curl command.

#!/bin/bash
mix firmware && curl -T _images/bbb/dms.fw "http://10.10.1.40:8988/firmware" -H "Content-Type: application/x-firmware" -H "X-Reboot: true"

Setting up remove access took a little research, but was pretty simple after getting the syntax right. Just add the following two line to rel/vm.args

-setcookie bbb
-name bbb@10.10.1.40

With that in place, connecting a shell running on the BBB is as simple as:

iex --name steve@10.10.1.100 --cookie bbb --remsh bbb@10.10.1.40

As I was developing the state machine code, I wrote tests which I ran on my mac host. After developing and testing the software on the host, I built and pushed the firmware to the BBB and it just ran!

By using Elixir for the firmware on this new card we are developing, I was able to use code that we had previously written for a server based product with minimal effort.

Next step is to get the SPI interface up and running once we have the BBB hooked up to our FPGA on our eval board.

Well done Nerves Team!

Leave a comment