PiDV™/ThumbDV™ – AMBEServer

Setting up an AMBEServer

This is being refactored — start at https://github.com/dl5di/OpenDV/blob/master/README.md 
Build and install as part of DummyRepeater.  Running DummyRepeater is not necessary, but currently that is where AMBEserver is built.

Raspberry Pi 3 users with a PiDV — see this Wiki

By Jonathan Naylor G4KLX and John Hays K7VE

The AMBEServer is a way to put an AMBE3000™ chip on your network to provide vocoding between PCM audio and various AMBE formats.

The PiDV™ was previously designated the DV3000.

AMBEServer is not required with newer versions of DummyRepeater, but currently is recommended, which can access the PiDV™ directly as a serial device.  AMBEServer is only required if you are running DummyRepeater from a different computer and want to access the PiDV™ over the network.  Obtaining and running AMBEtest2.py is still advised, to verify communication with the PiDV™.

Note: Starting 13 July 2015 new ThumbDV™ devices are set to a baud rate of 460800 and the latest AMBEserver source implements a new parameter to support the new baud rate.  To activate the higher speed set the parameter of -n, e.g. AMBEserver -n 

Install the PiDV™ to the Raspberry Pi

  1. The PiDV™ board is pre-set to run at 230400 baud over the UART interface in “packet mode”. This is the minimum speed for successful operation.
  2. Prepare the Raspberry Pi. This consists of (a) increasing the clock to the RPi UART, (b) disabling the getty (to allow terminal login) running on the RPi serial port, and (c) disable the console on the serial port.Halt and remove power from the Raspberry Pi, fit thePiDV™ board, reconnect power, and reboot
    1. Edit the file /boot/config.txt and add the line:
      init_uart_clock=3686400
      Note:
      a higher value is needed on RPi 2 (50000000 has been suggested by VK4TUX)
    2. Edit the file /etc/inittab and replace or comment the line:
      T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
      with:
      #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
      or delete the line entirely.
    3. Edit the file /boot/cmdline.txt and replace or comment the line (these lines are wrapped in this article, they should appear as a single line in the file):
      dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
      with:
      dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwaitNote: If the value for ‘root’ is different than /dev/mmcblkop2, preserve your current root=/dev/… and simply remove ‘console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty‘ from the line. (Thanks to DL5DI)

Preinstall needed libraries and tools

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libusb-1.0-0-dev libwxgtk2.8-dev portaudio19-dev git-core
sudo apt-get install build-essential g++ python-serial

Install and build the wiringPi library from source

The wiringPi library may be pre-installed on the latest Raspbian images.  If not, then:

cd
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

Method 1 (Deprecated)
Build and Install dv3000d

See Method 2 for latest.

dv3000d is a small program which runs on a Raspberry Pi and provides access to the NWDR PiDV™ AMBE board. It makes the AMBE3000R™ chip available via the network using UDP frames. Details of the chip are beyond the scope of this document, but sufficient to say that it is capable of vocoding audio for D-Star, DMR, and P.25 Phase 2 HR and maybe more.

Obtain the current source for DummyRepeater

Source can be found at:
https://groups.yahoo.com/neo/groups/ircDDBGateway/files/Release/

You can get these by using a web browser on the Pi, or pull them down to another computer and then copy them to the Pi over the network using sftp protocol.

On the pi, unzip the files in your home directory, then

cd
cd DummyRepeater/DV3000

Test your PiDV™ for communication with Raspberry Pi

sudo python AMBEtest2.py

 The results should include:

Product ID
6100010030
Wrote: 5 bytes
a
0AMBE3000R
Version
6100010031
Wrote: 5 bytes
a11V120.E100.XXXX.C106.G514.R009.B0010411.C0020208

Build the Daemon

The dv3000d program then needs to be built and run on the Pi. From within DummyRepeater/DV3000 and assuming that you have a set of compilers on your Pi, type in the following command:

make

This should build a new file named dv3000d.

To run the program you need to use the command:

sudo ./dv3000d

which will run the program in the current window or terminal. However if you want it to run in the background use the command:

sudo ./dv3000d -d

By default dv3000d uses UDP port 2460 for communicating with programs that need its services, if this isn’t convenient then it can be changed with the -p option.

This can be seen in copies of the above commands, using port 24600 now, below:

sudo ./dv3000d -p 24600

or

sudo ./dv3000d -p 24600 -d

That is all there is to running the dv3000d program. By itself it does very little but allows other programs to access the DV3000 on your Pi from anywhere on your network, or even the Internet (if you make it available on a public IP address).

Add dv3000d to your /usr/bin

install dv3000d /usr/bin

Create a file at /etc/init.d/dv3000d

#! /bin/sh
### BEGIN INIT INFO
# Provides: dv3000d
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Provide AMBE Encode/Decode
# Description: Provide daemon for AMBE Encoding and Decoding
### END INIT INFO
PORT=2460
N=/etc/init.d/dv3000d
set -e
case "$1" in
 start)
 /usr/bin/dv3000d -p $PORT -d
 echo "Starting dv3000d" >&2
 exit 0
 ;;
 stop)
 killall dv3000d
 exit 0
 ;;
 reload|restart|force-reload|status)
 ;;
 *)
 echo "Usage: $N {start|stop}" >&2
 exit 1
 ;;
esac
exit 0

 

Make it executable with

sudo chmod +x /etc/init.d/dv3000d

After the install and the creation of this file, you can use

sudo /usr/sbin/service dv3000d start

and

sudo /usr/sbin/service dv3000d stop

to start and stop the daemon. Using chkconfig (apt-get install chkconfig) you can make the daemon automatically start on boot.

The DV3000 also integrates with the Raspberry Pi Model B+

Method 2 (Preferred)
Newer AMBEserverGPIO from Repository

(Thanks to Adrian, VK4TUX for quick and simple steps)
apt-get install git
 
cd
Cloning into ‘OpenDV’…
remote: Counting objects: 2196, done.
remote: Total 2196 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (2196/2196), 29.65 MiB | 2.05 MiB/s, done.
Resolving deltas: 100% (1444/1444), done.
Checking connectivity… done.
mv OpenDV/DummyRepeater/DV3000 DV3000
rm -rf OpenDV
cd DV3000
ls
AMBEserver.c  AMBEtest2.py  AMBEtest3.py  dv3000d-AMBEserver.pdf  dv3000d.c  init.d  Makefile  README-dv3000d.txt  README.txt

Read the README.txt

more README.txt

Test your DV3000 for communication with Raspberry Pi

sudo python AMBEtest2.py

 The results should include:

Product ID
6100010030
Wrote: 5 bytes
a
0AMBE3000R
Version
6100010031
Wrote: 5 bytes
a11V120.E100.XXXX.C106.G514.R009.B0010411.C0020208

 

Build and Install

make clean

make

sudo make install

sudo make init-install

After the install and the creation of this file, you can use

sudo /usr/sbin/service AMBEserverGPIO start

and

sudo /usr/sbin/service AMBEserverGPIO stop

to start and stop the daemon.

Using chkconfig (apt-get install chkconfig) you can make the daemon automatically start on boot.

chkconfig AMBEserverGPIO on

Important, if you previously installed dv3000d

chkconfig dv3000d off