BladeRF Micro Trigger

Discussions related to embedded firmware, driver, and user mode application software development
Post Reply
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

BladeRF Micro Trigger

Post by lbelella »

Hello all! I've been trying to figure out if it is possible to get the trigger working on the BladeRF Micro (A4). What I'm trying to do is trigger the RX stream when the trigger signal goes high. From looking at the schematic and the pin definitions, I can see that the trigger signal should be coming in/out on J51 pin 1. I've tried a variety of things and I can't seem to get bladerf_trigger_state to return anything that makes me feel like it's working.

So, as a test, I wanted to see if I could get a trigger signal to first come from the Blade. My current test code does the following:
  • bladerf_trigger_init as MASTER on RX0
  • bladerf_trigger_arm
  • bladerf_sync_config
  • bladerf_sync_rx
  • bladerf_trigger_fire
I've tried the init, arm, and fire calls in various places and I can't seem to get anything coming out on J51 (checking it on a scope).

I've also tried:
  • bladerf_trigger_init as SLAVE on RX0
  • bladerf_trigger_arm
  • bladerf_sync_config
  • bladerf_sync_rx with timeout set to 5000ms
But when I do this, sync_rx will simply receive samples as it does normally (I would expect it to timeout after 5 seconds because I'm not triggering it with anything yet).

So a few questions. Is trigger functionality currently supported on the micro? If so, what dumb thing am I doing to mess it all up?

I'm running the latest released firmware (2.2.0-git-3d38fac2) and FPGA (0.7.3) images and I've tried with both the 2018.08 release of the host library as well as the latest git commit (601d8fe). Any help anyone can provide would be greatly appreciated. Thanks in advance for your time!
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: BladeRF Micro Trigger

Post by rtucker »

Well, I don't think it's you :)

Everything looks okay at first glance, but it fails for me too. I've opened an issue on this: https://github.com/Nuand/bladeRF/issues/632

(Also opened issues https://github.com/Nuand/bladeRF/issues/630 and https://github.com/Nuand/bladeRF/issues/631 for documentation and bladeRF-cli updates.)
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

Re: BladeRF Micro Trigger

Post by lbelella »

Thanks for the speedy reply! I'll keep my eyes peeled for some additional updates. Thanks again!
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: BladeRF Micro Trigger

Post by rtucker »

As of moments ago, master should have the fix. It's embarrassingly simple :)

https://github.com/Nuand/bladeRF/pull/6 ... 10d334cf81
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

Re: BladeRF Micro Trigger

Post by lbelella »

Doh! Thanks for the update! I'll pull it down and give it a try. Thanks again for the help!
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

Re: BladeRF Micro Trigger

Post by lbelella »

Pulled down master and it is working much better. Thanks! I'm still a bit confused on the functionality though. So, in my case, I'm not using another Blade as the master. I'm using an external device. It looks like when a trigger is set as master and armed it drives the trigger pin high, then when fired, pulls it low again. Is the gate for using the RX trigger a falling edge on the trigger line? If so, how long does the trigger line have to be held high for everything to work?

My thought is I would be able to do this:
  • Arm RX0 as a trigger slave
  • Call sync_rx with a long enough timeout
  • Have external device provide the trigger signal
  • sync_rx gives me samples
Does that sound correct? Also, from the documentation it looks like I should call sync_config after arming the trigger. Where in that whole sequence should I enable the channels?

Thanks again for all of the help!!!
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: BladeRF Micro Trigger

Post by rtucker »

I've not personally used the trigger functionality, but from looking through things...

The trigger is level-based, so the trigger_line must be high when the trigger is armed, or else it will immediately fire and disarm itself. Note also that it's a direct pin into the FPGA, so ensure the high level is no higher than 3.3 V referenced to ground (conveniently available at J51-3) and the low is ~0 V. Max V_IL is 0.8 V, min V_IH is 1.7 V, per the Cyclone V datasheet.

I don't think it matters too much what order bladerf_trigger_* and bladerf_sync_* are called (relative to each other), but definitely bladerf_enable_module should be the last thing.

Trigger hasn't changed much between bladerf1 and bladerf2, so it might also be worthwhile to search through the forum to see if other folks have done similar things. :)
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

Re: BladeRF Micro Trigger

Post by lbelella »

Right on! I'll give it a few more looks and see if I can't get the thing working. Thanks again!
lbelella
Posts: 6
Joined: Thu Sep 13, 2018 8:49 am

Re: BladeRF Micro Trigger

Post by lbelella »

OK, since I actually have 2 micros, I thought I would try the sync_trx example from the source tree. After a few tweaks to slave.txt to update it with the latest valid options it looked like it was going to work. However, it appears that someone is not honoring the timeout value set with rx config. The timeout in that file should be 60 seconds, but ~1 second after the script calls rx start I see the following output (then bladeRF-cli exits):

Code: Select all

[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd350000cd0
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359c2e010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359be2010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359bc1010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359ba0010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359b7f010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359b5e010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359b3d010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359b1c010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359afb010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359ada010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359ab9010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359a98010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359a77010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd359a56010
[ERROR @ host/libraries/libbladeRF/src/backend/usb/libusb.c:1073] Transfer timed out for buffer 0x7fd357044010
This is consistent with what I have been seeing in my own application as well (I set a timeout for 15 seconds and see the same error messages after ~1 second when the RX trigger is armed and I call sync_rx).

I've attached a verbose log file (with most of the nios_access lines removed). Any help is, as always, greatly appreciated! Thanks!
User avatar
rtucker
Posts: 77
Joined: Sun Jan 25, 2015 10:38 am

Re: BladeRF Micro Trigger

Post by rtucker »

Hmmm, yeah, I can reproduce this... this is probably a bug. I've opened an issue in the tracker at https://github.com/Nuand/bladeRF/issues/655 ... further updates on it will be available there as we look into it :)

Thanks for the report!
Rey Tucker (she/her)
Systems Engineer, Nuand LLC
Rochester, NY, USA

#WontBeErased
uceebea
Posts: 2
Joined: Mon Jun 21, 2021 12:13 pm

Re: BladeRF Micro Trigger

Post by uceebea »

I've been working on using an external source to trigger the bladeRF micro 2.0 AX4 board, with limited success.

I've made a PCB that sits on the j51 header, it's powered by an external 3.3V Vcc and connects to the SDR at j51-3 for a GND reference and to J51-1 as the trigger input pin. The PCB hosts a ultra-fast Single-Pole-Dual-Throw switch, which, I thought at the time of design, mimics the trigger signal output by the bladerf - Triggering the board by falling from high (3.3V) to low (Gnd).

I'm using the following script to setup the device ready for a trigger. I'm using bandwidths sample rates of 10MHz.

bladeRF-cli -d "*:serial=a0193abefb6f43b2aa7c24ed137ce1f5" -e '
set frequency rx '$center_freq'M;
set samplerate rx '$bw'M;
set bandwidth rx '$bw'M;
set agc off;
rx config file=/tmp/'$test_id'.sc16q11 format=bin n='$cap_samps' samples=16384 buffers=32 xfers=16 timeout=30s;
set gain rx'$rx_gain' ;

set frequency tx '$center_freq'M;
set samplerate tx '$bw'M;
set bandwidth tx '$bw'M;
set gain tx1 '$tx_gain';

tx config file=/tmp/chirp.sc16q11 format=bin samples=16384 buffers=32 repeat='$pulses' timeout=30s;

trigger j51-1 tx slave;
trigger j51-1 rx slave;

tx start;
rx start;

tx wait;
rx wait'

I've found that the bladerf will trigger correctly using a 1s trigger for for short captures of just rx, up to 1s. However, when triggering tx and rx streams of 1s+ duration the device fails to trigger and the transfer times out. Not sure if I'm missing something. I've tried longer duration trigger with no success, and found it's functionality to be quite unpredictable.

Since writing the above, i've had a more detailed look at the trigger signal created by a master bladeRF. I sampled, on an oscilloscope, the signal that is passed from the master bladeRF trigger to a slave bladeRF. I have noticed there seems to be 3 stages to the trigger signal output on j51-1.
1. First it is held at approx. +200mV whilst the device configures.
2. The pin then is forced to 3.3V for 50ms or so.
3. The pin is then grounded for a variable period, which seems to be dependent on the RX/TX duration of the device.

I'm using the following:
FPGA image version: 0.11.1
bladerf-cli version: 1.8.0
libbladerf version: 2.2.1

I now have 3 of these devices so keen to get external trigger working, as it's quite critical to a project I'm working on.

Any help or extra information on the required trigger signal would be hugely appreciated.
Last edited by uceebea on Wed Jun 23, 2021 4:04 am, edited 1 time in total.
Post Reply