| 86 | == Ethernet Triggers == |
| 87 | |
| 88 | An Ethernet Trigger is a specially formatted WARPLab Ethernet message in which the [wiki:WARPLab/Reference/Architecture/WireFormat#UnicastTransportHeader WARPLab Transport Header] packet type is of type "TRIGGER" and the data directly after the transport header is the ID of the Ethernet trigger. In WARPLab, only broadcast transports (i.e. [source:ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Reference/classes/wl_transport_eth_udp_java_bcast.m Java] and [source:ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Reference/classes/wl_transport_eth_udp_mex_bcast.m MEX] broadcast transports) support "TRIGGER" messages. |
| 89 | |
| 90 | The [source:ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Reference/classes/wl_trigger_eth_udp_broadcast.m Broadcast Ethernet Trigger] is a class that is used to send an Ethernet Trigger to multiple boards using a broadcast Ethernet packet (i.e. it will send the Trigger to all nodes "simultaneously"; NOTE: There can be jitter between when Ethernet triggers are received even with WARP nodes on the same switch. To synchronize the triggering between nodes, it is best to use [wiki:WARPLab/Examples/nodeSync external triggers]). To create a Broadcast Ethernet Trigger, one must be instantiated: |
| 91 | {{{ |
| 92 | % Create a UDP broadcast trigger |
| 93 | eth_trig = wl_trigger_eth_udp_broadcast; |
| 94 | }}} |
| 95 | This will create a Broadcast Ethernet Trigger with a unique ID. A maximum of 32 Broadcast Ethernet Triggers can be created in order to guarantee that the Ethernet Trigger IDs are unique. |
| 96 | |
| 97 | Once an Broadcast Ethernet Trigger has been created, then the Trigger Manager must be used to "sensitize" the node to that Ethernet Trigger ID: |
| 98 | {{{ |
| 99 | % Tell each node to be ready for an Ethernet Triger that has the given ID |
| 100 | wl_triggerManagerCmd(nodes, 'add_ethernet_trigger', [eth_trig]); |
| 101 | }}} |
| 102 | |
| 103 | Once a node has been "sensitized" to the given Ethernet Trigger, we can use the {{{send()}}} command to send the broadcast Ethernet packet containing the Ethernet Trigger: |
| 104 | {{{ |
| 105 | % Send the Ethernet Trigger to all nodes |
| 106 | eth_trig.send(); |
| 107 | }}} |
| 108 | |
| 109 | To "de-sensitize" a node to an Ethernet Trigger, the given Ethernet Trigger can be deleted or all Ethernet Triggers can be removed |
| 110 | {{{ |
| 111 | % Tell each node to not trigger on an Ethernet Triger that has the given ID |
| 112 | wl_triggerManagerCmd(nodes, 'delete_ethernet_trigger', [eth_trig]); |
| 113 | |
| 114 | % Tell each node to remove all Ethernet Triggers |
| 115 | wl_triggerManagerCmd(nodes, 'clear_ethernet_triggers'); |
| 116 | }}} |
| 117 | |