-- EnkhboldOchirsuren - 14 Aug 2019

How-To: Burst generation

this functionality is under development and not available in any release

A simple solution for generating bursts is implemented in the bel_projects project. The implementation is mainly based on a firmware for the LM32 core, which controls other built-in Wishbone modules to generate bursts.

1. Background

Timing receivers (TR) are capable to produce actions on reception of timing messages (with incoming events). For example TRs can drive digital signal at their IO ports when particular timing message is receiverd. Such event-driven actions are produced by a TR Wishbone module called the event-condition-action (ECA) unit. Rules that define the translation of the incoming events to output actions are programmed in a condition table of ECA. The ECA unit contains one event input and several output channels. The output channels output event-driven actions at the designated time.

Generally, a burst signal can be generated by using the ECA unit:
  • the event-driven actions are output to the IO channel according to the preset rules in the condition table
  • these IO actions drive the digital signal at the IO ports
However, because of the limited size of the ECA condition table, only single or short bursts are possible.

2. Software solution

In order to overcome the hardware limitation a simple method, which can be implemented in software, is suggested. The idea is to define a basic block of a desired burst, store it in the ECA condition table as conditions/rules, and then feed the ECA event input internally with corresponding io events after receiving control messages, where:
  • io events are timing messages used to produce the IO actions for driving the output signal at the IO ports
  • control messages are timing messages used to start/stop the injection of the io events

The software implementation is made up of following utilities and binary: command-line utility (saft-burst-ctl), saftlib daemon (saftd) and firmware (burst generator).

The saft-burst-ctl utility is a derivative of saft-io-ctl and responsible to:
  • provide command-line options required for the burst generation
  • translate the burst information (input by an user) to the ECA conditions/rules and
  • configure the ECA unit of the target timing receiver

The saftd daemon is extended to:
  • allow remote control to the burst generator

The lm32 firmware, burst generator, is responsible to:
  • keep burst information (input by an user)
  • generate bursts by injecting the io events

A diagram in the Figure.1 depicts how Wishbone modules in a timing receiver interact each other to generate bursts.

bg interaction wb modules.png

Figure.1. Interaction of the Wishbone modules in generating bursts.

3. Limitations

Please consider the characteristics given below:
  • maximum number of bursts: 16
  • minimum burst period: 200 us (dependent from the maximum number of bursts)
  • internal delay: 200 us (from control message to burst production)

Any user interaction during the burst production will disturb the burst generator operation and cause burst failure!

4. Deployment

4.1. FPGA image for a timing receiver

A target timing receiver must be flashed with an FPGA image from the current Enigma release. Follow these instructions to flash the target timing receiver. A release version starting from Enigma-v5.0.1 can be used.

4.2. Run-time system of a timing receiver

There are two options to deploy the burst generator:
  • use a timing RTE with the burst generator (recommended)
  • or build the burst generator binary and the saftlib utility, and deploy them manually

4.2.1. Timing RTE with the burst generator

A timing RTE, which provides both the burst generator and saftlib utility, is available for testing on ASL.

Log in to your favorite asl cluster. Choose the timing-rte-tg-enigma-v5.0.1-burst-generator script (from /common/export/nfsinit/global/) to set a symbolic link for a target timing receiver.
20_timing-rte -> ../global/timing-rte-tg-enigma-v5.0.1-burst-generator   # in /common/export/nfsinit/<target_TR>/

Reboot your timing receiver. Log in to your timing receiver and check its burst generator id by invoking:
saft-burst-ctl tr0 -f                                                    # it must return "Got firmware id: 0xb2b2b2b2"

4.2.2. Manual deployment of the burst generator binary and the saftlib utility

4.2.2.1. Build and deploy the lm32 firmware (burstgen.bin)

Download the bel_projects project from the github repo and check out a branch "enigma_burst_generator". The firmware source code is available in the "bel_projects/modules/burst_generator" directory. Build the firmware binary and install it on a target TR with the Etherbone ulitilies.

On host:

make                                  # build binary burstgen.bin
scp burstgen.bin <target_TR>          # copy the firmware binary to the target TR

4.2.2.2. Build saftlib utilities (saft-burst-ctl, saftd)

The saftlib project is available in "bel_projects/ip_cores/saftlib" directory. Check out a branch "burst-ctl" and build them. On host:

make -j8 && sudo make install

4.2.2.3. Deploy

On target TR:

Halt the LM32 core and load the firmware binary.

eb-reset dev/wbm0 cpuhalt 0xff
eb-fwload dev/wbm0 u 0 burstgen.bin

On host:

Start the saftd daemon and attach the target TR, check the burst generator id.

saftd tr0:tcp/<target_TR>
saft-burst-ctl tr0 -f               # it must return "Got firmware id: 0xb2b2b2b2"

Now, the burst generator is ready.

Optional: in case of failure one can look at the syslog messages to find out failure reason.

grep "saftd" /var/log/syslog | tail -15

Here are example log messages (some parts are removed for readability) that inform missing firmware.

...
saftd[8354]: TimingReceiver: registered irq 0x10870
saftd[8354]: BurstGenerator: detecting the burst generator
saftd[8354]: TimingReceiver: BurstGenerator: could not detect the burst generator.
saftd[8354]: TimingReceiver: no BurstGenerator firmware found
saftd[8354]: started

5. Examples

5.1. Single burst driven by a timing message

Let's generate a run-once, single burst at the IO port "B2":
  • burst parameter: signal width = 100 us, signal period = 200 us (5KHz), period = 1 ms
  • event id of timing message to start the burst: 0xfffe000000000001

All steps are done on the user host.

5.1.1. Burst configuration
saft-burst-ctl tr0 -l 0                                # show available bursts
saft-burst-ctl tr0 -r <burst_id>                       # clear burst by id
saft-burst-ctl tr0 -x                                  # clear existing conditions
saft-burst-ctl tr0 -n B2 -b 1 -s 0xfffe000000000001 0xffffffffffffffff     # create a burst with ID 1 that will be started by a timing message with event id 0xfffe000000000001
saft-burst-ctl tr0 -b 1 -p 100000 200000 1000000 0 0   # define signal parameter of the burst 1
saft-burst-ctl tr0 -e 1 1                              # enable the burst 1

5.1.2. Burst production
saft-ctl -p tr0 inject 0xfffe000000000001 0 0          # inject a timing message

A burst with 5 pulses is generated at the B2 output.

A sequence diagram in the attached image, bg_sequence_host_burst_generator.png, shows communication between the command-line utility and the burst generator.

Once the burst is output it won't be generated again (remember that it's run-once burst)! In order to re-generate the burst, its cycle count must be set again. It can be done by invoking:

saft-burst-ctl tr0 -i 0x3 <burst_id> <cycle_h32> <cycle_l32>

5.2. Single burst driven by an external signal transition

A single burst can be produced if an external signal at a specific IO port changes. Let's generate the same run-once, single burst at the IO port "B2" when an external signal at the IO port "B1" gets active (swicth to the high level).

5.2.1. Burst configuration

Configure ECA so that it produces a timing event on transition of external signal at the IO port "B1".

saft-io-ctl tr0 -b 0xaaaa000000000000 -n B1     # enable B1 input as event source and set its event id prefix
saft-io-ctl tr0 -y                              # check event table, disable other event sources if necessary

Repeat steps given in 3.4.1 to configure the burst. Use new value for the event id in the control message (i.e., 0xaaaa000000000001)

5.2.2. Burst production
saft-io-ctl tr0 -n B1 -o 1 -d 0        # enable output at B1, drive the output signal to the inactive level
saft-io-ctl tr0 -n B1 -d 1             # drive the output signal to the active level to produce a timing event with the id of 0xaaaa000000000001

A burst with 5 pulses is generated at the B2 output.

5.3. Continuous burst

Recommendation: The start and stop timing messages are required to produce a continuous burst.

If the burst period equals to zero, then the burst generator produces a continuous burst. Let's generate a continuous, single burst at the IO port "B2":
  • burst parameter: signal width = 10 ms, signal period = 15 ms
  • event ids of timing messages to start and stop the burst: 0xfffe000000000001, 0xfffe000000000000

5.3.1. Burst configuration
saft-burst-ctl tr0 -l 0
saft-burst-ctl tr0 -r <burst_id>
saft-burst-ctl tr0 -n B2 -b 1 -s 0xfffe000000000001 0xffffffffffffffff -t 0xfffe000000000000 0xffffffffffffffff
saft-burst-ctl tr0 -b 1 -p 10000000 15000000 0 0 0
saft-burst-ctl tr0 -e 1 1

5.3.2. Burst production

Either inject the timing messages by using the saft-ctl utility or use an IO input port.

5.4. Generating a burst train

Run-once bursts can be used to to generate a train of bursts at the given IO port.

Let's generate a burst train consisting of 3 bursts at the IO port "B2":
  • event ids of timing messages to start and stop the burst: 0xfffe000000000001, 0xfffe000000000000
  • burst 1 parameter: signal width = 10 ms, signal period = 15 ms, burst period = 45 ms (3 pulses)
  • burst 2 parameter: signal width = 20 ms, signal period = 40 ms, burst period = 160 ms (4 pulses)
  • burst 3 parameter: signal width = 30 ms, signal period = 40 ms, burst period = 200 ms (5 pulses)

5.4.1. Burst configuration
saft-burst-ctl tr0 -l 0
saft-burst-ctl tr0 -r <burst_id>                                       # remove existing bursts
saft-burst-ctl tr0 -n B2 -b 1 -s 0xfffe000000000001 0xffffffffffffffff -t 0xfffe000000000000 0xffffffffffffffff
saft-burst-ctl tr0 -b 1 -p 10000000 15000000 45000000 0 0
saft-burst-ctl tr0 -n B2 -b 2 -s 0xfffe000000000001 0xffffffffffffffff -t 0xfffe000000000000 0xffffffffffffffff 
saft-burst-ctl tr0 -b 2 -p 20000000 40000000 160000000 45000000 0      # add 45ms delay to treat the period of burst 1
saft-burst-ctl tr0 -n B2 -b 3 -s 0xfffe000000000001 0xffffffffffffffff -t 0xfffe000000000000 0xffffffffffffffff 
saft-burst-ctl tr0 -b 3 -p 30000000 40000000 200000000 205000000 0     # add 205ms delay to treat the period of bursts 1 and 2
saft-burst-ctl tr0 -e 1 1
saft-burst-ctl tr0 -e 2 1
saft-burst-ctl tr0 -e 3 1

5.4.2. Burst production

Either inject the timing messages by using the saft-ctl utility or use an IO input port.

I Attachment Action Size Date Who Comment
bg_interaction_wb_modules.pngpng bg_interaction_wb_modules.png manage 175 K 15 Aug 2019 - 14:33 EnkhboldOchirsuren Interaction of the Wishbone modules in generating bursts
bg_sequence_host_burst_generator.pngpng bg_sequence_host_burst_generator.png manage 127 K 22 Aug 2019 - 09:42 EnkhboldOchirsuren Communication between a command-line tool and the burst generator
This topic: Timing > WebHome > TimingSystemDocumentation > TimingSystemHowTo > TimingSystemHowGenerateBursts
Topic revision: 20 Sep 2019, EnkhboldOchirsuren
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback