Skip to content
Highly configurable Beaglebone PRU-based DDS
C OpenEdge ABL Perl Makefile Perl 6
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENCE
Makefile
NOTES
README
TODO
am.p
config.pl
dds.p
dsb.p
genfile.pl
getamp.c
getfreq.c
haltpru.c
modstream.c
phasetrack.p
psk.p
pskstream.c
sam.p
setamp.c
setfreq.c
startam.c
startdds.c
startdsb.c
startphasetrack.c
startsam.c
startwobbulator.c
sweep.c
timestream.c
util.c
util.h
wavetable.c
wobble.pl
wobbulator.p

README

This project is a Direct Digital Synthesizer signal generator for 
the Beaglebone Black PRU (it may also work on other AM33xx boards 
such as the Beaglebone White, but I haven't tested this).  You can
load its wavetable with various waveshapes, and you can have it run
at all sorts of different frequencies with surprising resolution
(at 3KHz, it has about 1/100 Hz resolution).  

Possible uses for this software include:
 * signal generator (it can generate sine, square, ramp, and 
   triangle waves up to 5MHz in the default configuration, 
   faster with configuration changes in config.pl, though the
   faster you go the more everything will start to look sinusoidal)
 * an LO or IF for a transmitter (so far, amplitude modulation is
   included, other modulations will be available soon),
 * A transmitter (just add an amplifier, for the AM broadcast band
   or the 160m amateur band an op-amp gives you a nice low-power
   signal, check your local regulations before use, I am not
   responsible for what you do with this, I do not certify that
   its output meets any legal requirement!)
 * a tone generator (hook to an op-amp to drive a speaker)
 * a dog annoyer (drive an ultrasonic transducer)
... among other things.

Be aware, PRU fast GPIO is incompatible with the HDMI, so firstly
you can't use them together, and secondly, you'll have to disable
the HDMI by doing the following (this is, of course, totally
reversable!):

# mount /dev/mmcblk0p1 /mnt/card
You should find the file "/mnt/card/uEnv.txt", which should have a
single line of text in it, to which you should append the following:
 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
So for example if the file contains 
 optargs=quiet
You should change it to contain
 optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
Having done this, save the file and reboot.

Also, if you are having trouble cloning this project from git, look 
into the following URL:
http://derekmolloy.ie/fixing-git-and-curl-certificates-problem-on-beaglebone-blac/
and while you're at it, fix your clock:
http://derekmolloy.ie/automatically-setting-the-beaglebone-black-time-using-ntp/

You can start up the DDS by simply typing "make test" (without the quotes)
in the pru-dds directory.  Doing "make test" loads the DTBO, runs startdds
to load the DDS code into the PRU, runs wavetable sine to load a sine table,
then setfreq 10000 to set frequency to 10KHz.  You can change frequency with
the setfreq program.  You can change waveshape with the wavetable program.
You can try outputting a swept carrier with the sweep program.  All of these
applications provide usage cues if you specify no command line arguments.

If you want to, for example, output AM-modulated RF, try putting an mp3 in
the source directory, say somefile.mp3, then type "make somefile.raw" (without
quotes), then "./startdds", "./setfreq 1000000", "./startam", and finally
"./modstream somefile.raw" (replacing "somefile" with the actual file name).

Perhaps you want to output BPSK31-modulated RF.  "./startdds",
"./setfreq 1839000", "./startdsb", and finally "./pskstream".  Then
type things!

Perhaps you want to syncronize your radio-controlled "atomic" clock with
your beaglebone, which ostensibly is running NTP.  "./startdds", 
"./setfreq 60000", "./startam", and finally "./timestream".

Playing with things is recommended, because I'm not done organising enough
to document properly yet.

Look for output on P8 45,46,43,44,41,42,39,40 (LSB to MSB) ready to
feed into an R-2R or other DAC.  If you modify config.pl to use PRU0
instead of PRU1, look for output on P9 31,29,30,28,42,27,41,25.

Please note - I'm specifying the pins in LSB-to-MSB order!  This is 
because if you choose to configure for less pins, the LSB stays on the 
same pin, while the MSB ends up on a different pin.  For example a four-pin
configuration on PRU1 would be P8 pins 45,46,43, and 44.

Also be aware that since in my experience uninstalling a dtbo requires a
reboot anyway, I make all variants of my dtbo have the same name (which
is probably very very bad practice.  I'll deal with that if someone finds a
legitimate reason to complain about it.



===Below this point in the readme is the readme from another project of mine,
cut and pasted.  It tells a lot of what's necessary to run this project on
a beaglebone with a newer software load.  The makefile will be clever enough
to help you a bit with this ... soonish.

## Initial Setup

1. Install the latest firmware, as of this writing that is 2017-10-10.
   (That's https://debian.beagleboard.org/images/bone-debian-9.2-iot-armhf-2017-10-10-4gb.img.xz from https://beagleboard.org/latest-images)
2. Edit /boot/uEnv.txt such that the section on "###PRUSS OPTIONS" loads the `uio` dtbo rather than the `rproc` one, reboot.  Note `uio_pruss` now shows up in lsmod output.
   ```
   ###PRUSS OPTIONS
   ###pru_rproc (4.4.x-ti kernel)
   uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
   ###pru_uio (4.4.x-ti & mainline/bone kernel)
   # uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
   ```
   should be changed to:
   ```
   ###PRUSS OPTIONS
   ###pru_rproc (4.4.x-ti kernel)
   # uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
   ###pru_uio (4.4.x-ti & mainline/bone kernel)
   uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
   ```

3. Install the pasm assembler and the libpruss library from https://github.com/beagleboard/am335x_pru_package.  The preinstalled clpru compiler/assembler will not work for this as they produce ELF binaries, which we can't use with UIO.
4. Create a file in /etc/profile.d/usr-local/lib.sh containing the following:
    ```
    if [ "x${LD_LIBRARY_PATH}x" == 'xx' ]; then
      export LD_LIBRARY_PATH=/usr/local/lib
    else
      export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
    fi
    ```
5. You now have a complete development environment for assembling and running PRU programs and their supporting ARM-side applications directly on the beaglebone.


You can’t perform that action at this time.