-
Notifications
You must be signed in to change notification settings - Fork 2
Experiment Architecture (sbRIO)
We have several mouse boxes placed on a Weill rack. The individual joystick is connected to a control board on the box itself that handles sensor inputs so that only a single DB15 cable is required to link a joystick box to the data acquisition system.
Each joystick unit is connected by a DB15 cable to an sbRIO rack mounted inside the server cart. Each of these sbRIO units is a U rack containing an sbRIO 9626/9636 with mounted ports for connecting to the joystick boxes. We are currently using two models, the sbRIO 9636 which can handle up to 4 boxes, and the sbRIO 9626, which can handle up to 8 boxes.
Each of these sbRIO units sends information via a network stream to a computing node, which stores the information as .dat files in the appropriate directory (See Post Processing Analysis for more information). Currently each sbRIO unit is assigned 1 node, but multiple sbRIO units can be linked to a single computing node.
##FPGA Code The FPGA code has three main tasks.
- It must acquire the Hall sensor's analog data and digital data from the touch sensors and IR beam (nose poke) sensor via the sbRIO.
- It must run contingency detection on the data. At a high level, this looks at the data streaming in at 1 kHz, and decides when to deliver a pellet. There is acquisition and contingency detection code for each mouse box.
- The FPGA code must also package and route data to the real-time processor, which then routes it to the host PC. All of the Boolean data, (Nose poke, touch 1, touch 2, Dispense, Laser, Lick) are packaged into a single fixed-point number. The x and y values are fixed point as well. Each joystick generates 3 fixed-point numbers per time step, which are sent to the RT code via direct memory access (DMA).
These three tasks run in the main loop of the FPGA code. Each box has its own pellet-dispensing loop. Dispensing a pellet requires sending a 100 ms TTL pulse through a digital output of the sbRIO. We do this in a separate loop so that this pulse can be generated in parallel. We don't want to stall data acquisition or contingency detection.
The FPGA code's front panel displays the incoming sensor data and the outgoing pellet dispenser data for each mouse box. It also contains controls for setting the contingencies, calibrating the joysticks, and automated pellet dispensing, through which pellets can be dispensed randomly, according to a Poisson distribution. It's important to note that the FPGA cannot generate random numbers itself, so we get them from the RT code via DMA.
Here are some screenshots of the code (with explanation):