BeagleLogic Primer : Getting Started

Kumar Abhishek edited this page Dec 1, 2015 · 9 revisions

If you're an end user, recommend that you use a prebundled image which you can read about and get from here. If you're a developer, read on.

Please note: The HDMI Cape needs to be disabled as the logic analyzer inputs are the same as the inputs to the HDMI Framer: P8_39-P8_46, P8_27-P8_30. If you need 2 extra channels P8_20 and P8_21 , you need to disable the onboard eMMC as well.

To disable the HDMI cape, you need to edit uEnv.txt in the boot partition, which also shows up when you connect your BeagleBone to the computer as Mass Storage, or at /boot/uboot/uEnv.txt . Find and uncomment the line below the one that says "Disable HDMI". A similar procedure has to be followed for disabling the eMMC if so required.

Make sure you are running kernel version 3.8.13-bone60 and above [use uname -r]. If not, update your kernel to the latest 3.8.13 version available (3.8.13-bone71 at the time of writing). BeagleLogic is not compatible with kernel versions 3.14 and 4.x yet but will be ported to 4.x kernels in the future.

Install the PRU firmware files "beaglelogic-pru0" and "beaglelogic-pru1" from this link if you don't already have them installed in the /lib/firmware directory.

Load the BeagleLogic device tree overlay using:

echo BB-BEAGLELOGIC > /sys/devices/bone_capemgr.*/slots

Load BeagleLogic using (if it had been compiled into the kernel, you can skip this and check the logs):

modprobe beaglelogic

Examine the kernel logs to confirm that BeagleLogic module has indeed been loaded using dmesg | tail -10
You should see something like:

[  385.063026] BeagleLogic loaded and initializing
[  385.063725] misc beaglelogic: BeagleLogic PRU Firmware version: 0.2
[  385.063817] misc beaglelogic: Device supports max 128 vector transfers
[  385.063904] misc beaglelogic: Valid PRU capture context structure found at offset 0000
[  385.063976] misc beaglelogic: Default sample rate=50000000 Hz, sampleunit=1, triggerflags=0. Buffer in units of 4194304 bytes each

This means that the PRUs will be configured to capture logic data at 50 MHz, 1 byte (8 bits per sample) and one-shot capture.

At this point BeagleLogic cannot be run as it has no memory allocated to it. Allocate memory by writing the size in bytes to this sysfs attribute

echo 33554432 > /sys/devices/virtual/misc/beaglelogic/memalloc

A log message like this means the allocation was successful [We requested for 32 MB of buffer space and it was fulfilled]. It is unlikely that allocation will fail unless very large amounts of space is requested. I have personally tested this till 320 MB

[  385.115241] misc beaglelogic: Successfully allocated 33554432 bytes of memory.

Now, to capture data from the analyzer a simple "dd" will do ;) :

root@beaglebone:~# dd if=/dev/beaglelogic of=testfile.bin bs=1M count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 0.775558 s, 43.3 MB/s

And dmesg will show:

[  968.362729] misc beaglelogic: capture started with sample rate=50000000 Hz, sampleunit=1, triggerflags=0
[  969.127516] misc beaglelogic: capture session ended

Congratulations! You've just captured your first set of 32M Logic samples with BeagleLogic.

Also, install the sigrok binaries with BeagleLogic support by downloading "deploy.tar.gz" here and merging the contents of /deploy inside it with the /usr directory of the file system of your BeagleBone Black. As of June 2015, compilation of libsigrok on Debian Wheezy is broken due to outdated version of libglib2.0, this will be fixed in an upcoming Debian Jessie Image for BeagleLogic already released

Next Read: Capturing and processing data