An HFAC block-capable and module-extendable 4-channel stimulator for acute neurophysiology

Objective. This paper describes the design, testing and use of a novel multichannel block-capable stimulator for acute neurophysiology experiments to study highly selective neural interfacing techniques. This paper demonstrates the stimulator’s ability to excite and inhibit nerve activity in the rat sciatic nerve model concurrently using monophasic and biphasic nerve stimulation as well as high-frequency alternating current (HFAC). Approach. The proposed stimulator uses a Howland Current Pump circuit as the main analogue stimulator element. 4 current output channels with a common return path were implemented on printed circuit board using Commercial Off-The-Shelf components. Programmable operation is carried out by an ARM Cortex-M4 Microcontroller on the Freescale freedom development platform (K64F). Main results. This stimulator design achieves ± 10 mA of output current with ± 15 V of compliance and less than 6 µA of resolution using a quad-channel 12-bit external DAC, for four independently driven channels. This allows the stimulator to carry out both excitatory and inhibitory (HFAC block) stimulation. DC Output impedance is above 1 M Ω. Overall cost for materials i.e. PCB boards and electronic components is less than USD 450 or GBP 350 and device size is approximately 9 cm × 6 cm × 5 cm. Significance. Experimental neurophysiology often requires significant investment in bulky equipment for specific stimulation requirements, especially when using HFAC block. Different stimulators have limited means of communicating with each other, making protocols more complicated. This device provides an effective solution for multi-channel stimulation and block of nerves, enabling studies on selective neural interfacing in acute scenarios with an affordable, portable and space-saving design for the laboratory. The stimulator can be further upgraded with additional modules to extend functionality while maintaining straightforward programming and integration of functions with one controller. Additionally, all source files including all code and PCB design files are freely available to the community to use and further develop.


Introduction
Acute ex-Vivo and in-Vivo experiments are a cornerstone of research in neurophysiology as they enable a quick exploratory experimental cycle. This reduces the risk of failure when committing to lengthy chronic in-vivo experiments before an animal model is wellunderstood by the experimenter.
A large number of stimulators are available from commercial and academic sources, however these are generally designed for specific applications. Work in academia has often focused on implantable systems for awake-behaving animal neurophysiology [1][2][3] or interfacing with multi-electrode arrays (MEAs) [4,5], with few designs dedicated to acute in-vivo or ex-vivo neurophysiology [6][7][8].
In addition to conventional excitatory stimulation, there has been increasing interest in the use of HFAC block for inhibitory stimulation, resulting in a powerful and versatile toolset for neuromodulation. Notable applications are in the emerging Electroceuticals (also referred to as Bioelectronc Medicine) [9][10][11][12] and Functional Electrical Stimulation [13][14][15] fields. Work on HFAC block has been exploratory in nature, with experimental setups used to modulate waveforms or combine multiple current sources in order to achieve specific effects [16][17][18][19][20].
HFAC block requirements are orders of magnitude above those of conventional stimulation, with large output currents to reach block thresholds of up to 10 mA at high bandwidths of 50 kHz or more, though lower bandwidth 5-10 kHz waveforms are used more often [12,14,15,21]. This requires high compliance voltages of ± 10 V or more as even cuff electrodes with large contacts have impedances in the kilo-ohm range [22]. In addition to this, precise control of stimulation timing and DC leakage is required in order to prevent any damage to nerves resulting from bringing the polarization voltage of electrodes outside of the water window [23][24][25] during application of block. For stimulators that provide enough compliance voltage [2,7,26,27], other limitations can include low output DAC resolution or full-scale output current which will limit the ability of the user to carry out standard nerve function tests such as stimulation strength-duration curves, or reach block thresholds in typical targets such as the rat sciatic or vagus nerves. Many stimulators designed as single chips for implantable systems are further limited by maximum pulse width [26,28] which can limit the frequencies of block used or the method used to deliver conventional stimulation, which may rely on longer pulse widths [29]. An older design such as the Neurodyne [30] could be an excellent and affordable HFAC block stimulator due to its high output current and compliance but is limited by the dynamics of its transformer core when long low-amplitude pulses are required for conventional stimulation. As such stimulators designed for exploratory neurophysiology need to be versatile enough to provide both high current output, high voltage compliance and enable complete control of the waveform for both excitatory and inhibitory stimulation, allowing researchers to combine multiple stimulation methods such as the ones described in [31] and [32].
Commercially available stimulators such as the DS3 (Digitimer) or PlexStim (Plexon) do not generally combine high compliance, high output current, and multiple output channels without significant financial and space investment in the lab. Stimulus Isolators such as the DS5 (Digitimer), A360 (World Precision Instruments) or Model 2200 (A-M Systems) which are V-to-I converters have been successfully used for block but are generally single-channel, regularly require calibration to prevent DC leakage due to their open-loop nature, and may have limited bandwidth at HFAC block frequencies [33]. They may also present an integration and timing challenge for users who require accurate timing between different stimulation channels, are expensive and require auxiliary hardware in the form of external Arbitrary Function Generators. To the best of the authors' knowledge, no multi-channel stimulators have been designed in academia or industry with high-frequency block as an application. The resulting bulkiness and cost of equipment can be prohibitive in space or budgetconstrained laboratories, especially when taking into account the additional investment needed for life support equipment: breathing and anaesthesia apparatus for in-vivo [34], saline buffer processing and maintenance setups for ex-vivo [12,35]), and any recording equipment, filters and dataloggers [6].
Based on these observations the following list of features and constraints were used to guide the design of a stimulator meeting all requirements for acute excitatory and inhibitory stimulation: In addition to these targets, special consideration was given to flexible programming and scripting to give the user complete control over the operation of the stimulator. Additional feature extension was made possible by using the Freescale K64F microcontroller development platform, notably for the addition of a neural recording module on top of the stimulation module. This would enable complete integration between stimulation and recording, allowing closed-loop control of stimulation using external computers for processing and control, and straightforward embedding of stimulation parameters for each stimulation event in recording metadata. A photograph of the assembly with the stimulator module on top of the microcontroller development board is shown on figure 1.
The result presented in this work is a powerful and versatile multi-channel stimulator for experimental neurophysiology that is capable of using HFAC signals to block common small animal nerve models such as the rat sciatic nerve.

Module power and data isolation
The stimulator system was designed to ensure that in experimental setups there is at most a single earth point in contact with the nerve tissue. As neural signal acquisition devices often ground the experimental setup with earth ground to reduce noise, the stimulator must be battery powered (see figure 9).
The power supply was chosen for maximum flexibility. Using 5 V as an input voltage for the system allows laptops and portable phone and tablet power banks to be used to supply power, providing long operating life which can be easily sourced. To achieve ± 15 V compliance at the stimulator output, the output voltage of the power supply was chosen as ± 18 V which allows a wide range of operational amplifiers to be used. The ADP5070 dual output switch-mode power supply provided a compact and efficient solution for this with manageable output ripple. Manufacturer recommended values were used for all power supply components and assembled using the recommended layout. High frequency noise at the output was filtered using ferrite beads, and shielded inductors were used to reduce EMI emissions that could interfere with sensitive nodes in the Howland Current Pump. For precision voltage references such as ADC references, Low drop-out (LDO) components were used to filter out noise from higher voltage supplies. The ± 18 V converter is not isolated and therefore shares the same ground as the battery. To isolate the microcontroller 5 V power domain from the 5 V battery, a NXJ2S0505MC-R7 (MURATA Power Solutions) isolated 5 V to 5 V DC-DC converter was used to power the microcontroller board.
Isolating the microcontroller and stimulator power domains enables concurrent recording and stimulation using a single computer-controlled device. In this scenario recording devices use the microcontroller power domain and the stimulator uses its own high-voltage power domain as shown figure 2. The PC used to control the device is electrically isolated from both the stimulator and microcontroller, allowing other devices to also be connected to the same computer for signal acquisition or experimental automation, or the computer itself to be connected to earth ground in the case of a desktop without interfering with the experimental setup. Such a setup prevents ground loops, interference between stimulation and recording devices and improves setup flexibility.
To allow devices on different power domains to transfer data, the microcontroller's Serial Peripheral Interface was used together with a 6-channel digital isolator as shown figure 2. Communication to the PC is carried out by passing UART peripheral signals through a similar 4-channel digital isolator and then to an FTDI USB to UART transceiver that appears as a virtual COM port on the hosting PC. Noise emissions from communication were kept to a minimum by segregating digital interface components close to one edge of the PCB while the opposite edge was used for analog input-output.

Current source
The Howland Current Pump (see figure 3) was chosen as the stimulator's current source circuit due to it not requiring an H-bridge to provide bidirectional current sourcing and sinking, high speed and a lower number of control signals that must go through a digital isolator to drive the circuit, as only the DAC must be digitally driven during stimulation. The output current equation is as follows for this circuit: A compound amplifier solution in U1 and U2 was chosen to benefit from the low offset of U1 and  the output capability of U2, which is a current feedback amplifier. U2 can be placed in either a noninverting or inverting configuration. The inverting configuration is slightly faster at the cost of significantly higher power consumption for U1 which would source current into the feedback resistors of U2. For this reason a non-inverting configuration was chosen.
As the feedback signal depends on the current flowing into R S , any leakage beyond this point will not be compensated for and therefore U3 is used as a buffer to prevent current leakage. As the half-scale output of the DAC is 2.048 V, an offset adjustment is implemented with R6 such that when the DAC output is at half-scale the voltage on the inverting input of U1 is 0 V, leading to 0 A current output. R1, R2, R3 and R4 are closely matched resistors packaged in a single device (Vishay ACAS, 0.05% relative tolerance), and additional 50 Ω potentiometers (3224 series, Bourns, not shown) are used in series for precision matching. R6 is matched to R7 using a 5 kΩ potentiometer. Target values for components are listed in table 1.

Self diagnostics
The ability of a neural stimulator to detect out-ofcompliance conditions, correct for drift over time and temperature, and measure residual voltage across stimulation electrodes is becoming standard in commercial hardware and these features were included in the form of an acquisition chain with an instrumentation amplifier and an external ADC on the stimulator power domain, combined with a system of switches to connect current output channels and the monitoring system to electrodes, shown figure 4 and with component values detailed in table 2. As it can be useful to measure stimulation electrode voltage with respect to an electrochemical reference in the nerve bath during stimulation, the dedicated REF connector is available for this. This can be used to determine when stimulation electrodes are polarized outside of the 'water window' for example, indicating that water splitting reactions can occur and change local pH, potentially affecting the nerve tissue. A dummy electrode implemented as a resistor and capacitor in series was also included with the ability to short the capacitor through a switch, for calibration purposes.

Event and peripheral-driven stimulation
Precisely-timed stimulation is required when multiple sources of stimulation are active simultaneously, for example when current steering or combining stimulation events in multiple locations on the nerve. In order to guarantee precise timing and avoid using processor interrupts which can delay operation for other tasks such as responding to commands or processing recording input during stimulation, the SPI link to the stimulator's quad-channel DAC was driven using microcontroller peripherals only. By triggering the K64F enhanced Direct Memory Access (eDMA) peripheral using the Periodic Interrupt Timer (PIT) peripheral, it is possible to output complex waveforms through the external SPI-controlled DAC of the stimulator. eDMA channels can be used to both send new output values to the external DAC and change the value of the PIT Load Register, changing the cycle time of the triggering PIT timer as shown in figure 5. The Kinetis K64 microcontroller has 4 PIT channels and 16 eDMA channels and can therefore drive 4 stimulator channels independently and with no processor involvement during stimulation. When it is required to deliver more stimulation  Circuit schematic for the routing and diagnostic module of the stimulator. CH1-CH4 refer to the output nodes for each stimulation channel. E1-E4 refer to individual electrode connectors for each stimulation channel. REF refers to a reference electrode connector for when the monitoring circuit should measure voltage between an electrochemical reference such as silver-silver chloride and a stimulation electrode, rather than using system ground as a reference.
events than it is possible to store in memory, the eDMA peripheral's scatter-gather feature can be used to have certain eDMA channels track and change other channels' behaviour as a stimulation protocol progresses. This is useful especially when delivering neural block waveforms which due to their highfrequency nature require many stimulation cycles to be output quickly and with precise timing. Long pulses can also be output thanks to the PIT timer's 32-bit wide timer register. In this design the PIT is clocked at its maximum frequency of 60 MHz, which translates to a maximum timer period of approximately 71 seconds. This translates to the ability for the stimulator to output pulses as short as several microseconds or as long as 71 seconds with the same timing accuracy. Inter-pulse timing has the same constraints and the same maximum stimulation phase duration, such that individual stimulation pulses can be spaced more than a minute appart. Stimulation trains can be made to last several hours in this way, with the only limitation being available memory when completely custom pulse waveforms are output. The current microcontroller firmware assigns dedicated memory for 500 stimulation events to be split between stimulation pulses and inter-pulses for custom waveforms, though for repetitive waveforms such as that used in HFAC stimulation eDMA mechanics are leveraged to increase the number of possible cycles to more than 30 million, This translates to being able to stimulate at 50 kHz for more than 10 minutes at a time, with proportional increases in time for lower HFAC stimulation frequencies.

Output impedance over output voltage and frequency
To characterise the stimulator's ability to regulate current output at different output voltages and output signal frequencies, two tests were carried out. To measure compliance, output node voltage was swept from −18 V to +18 V in 100 mV steps using a Keithley 2635B Sourcemeter at 10 mA current output from the stimulator both for sinking and sourcing cases.
Keithley received current was measured as a function of stimulator output node voltage to determine the compliance limits of the stimulator, with results on figure 7 showing voltage compliance of ± 15 V before noticeable output error.
To measure output impedance magnitude over frequency, the setup shown on figure 6 was used. The output impedance plot is shown figure 7 with a cutoff frequency of approximately 1 kHz. The DC output impedance magnitude is approximately 2 MΩ. Assuming the series resistance of the arbitrary waveform generator (AFG3102, Tektronix) is negligible compared to the 15 kΩ measurement resistance, the latter and the output impedance can be considered in parallel. The output impedance magnitude was calculated using the following equation: where U AFG is the amplitude of the AFG output sine wave and U measure is the amplitude of the sine wave measured at the terminals of the measuring resistance. A simulation of the circuit was also carried out in LTspice XVII for comparison.

Resolution and linearity
To measure system resolution and linearity, all DAC output values were swept and the resulting output current measured through a 819 Ω resistor using a 434-series Wavesurfer Oscilloscope (LeCroy). A resistor below 1 kΩ had to be used in order to improve the measurement accuracy by using lower voltage per division and analog offset settings on the oscilloscope. Data was filtered by averaging at each step.
Step size was on average −5.678 4 µA/LSB. Differential Non-Linearity (DNL) and Integral Non-Linearity (INL) are plotted on figure 8. As output displayed nonlinearity at the extremes of the range the INL plot was cropped accordingly to reflect performance in the linear range of the circuit. The output range of the circuit spans ± 10 mA as shown in figure 7.

Ethics and veterinary surgery
All animal care and procedures were performed under appropriate licences issued by the UK Home office under the Animals (Scientific Procedures) Act (1986) and were approved by the Animal Welfare and Ethical Review Board of Imperial College University.

Protocol
Sprague-Dawley rats weighing 250-450 grams were used in this study. Briefly, animals were initially anaesthetised in a box with 5% isoflurane in oxygen, then culled by cervical dislocation prior to dissection of the sciatic nerve. The entire length of the nerve from the medial side of the ankle to the cleft close to the spine was used.
The sciatic nerve was placed in iced modified Krebs-Henseleit buffer and carefully cleaned of residual connective, muscular and vascular tissue. Superficial branches were cut close to the main trunk of the nerve such that only two branches extending the complete length of the sample remained. The final sample length is approximately 5 cm.
The nerve is then placed in a perfused dual chamber nerve bath. One partition is perfused with warmed and oxygenated buffer to preserve homeostasis and tissue viability. A 1 mm diameter hole allows threading of the distal end of the nerve into the second chamber which is filled with mineral oil, as shown figure 9. Any leak between the two chambers is prevented using silicone grease applied using a large gauge syringe. A pair of silver-silver chloride electrodes spaced 2 mm apart are used in the oil partition for recording through a differential low noise amplifier (SR560, Stanford Research Systems). In the saline partition an 800 µ m inner diameter conformal nerve cuff (Cortec) and an 800 µ m inner diameter custom-made conductive elastomer nerve cuff [36] were implanted for stimulation and block of the nerve respectively. For current return a large 2 cm side square sheet of platinum is used and connected to stimulator ground.

Stimulation capability
The ability of the stimulator to evoked compound action potentials (CAPs) in the A and C-type fibres  of the rat sciatic nerve was evaluated using the aforementioned setup. In an example experiment, activation of A fibre and C fibres, or A fibres only, was possible by changing stimulation amplitude as shown figure 10. Stimulation was carried out by using a cathodic-phase-first biphasic symmetric pulse of either 1000 µA or 3000 µA amplitude and 300 µs duration with a 20 µs interphase. The distance between the stimulation and recording electrodes was approximately 3-4 cm. By calculating the speed of propagation based on the time between the end of stimulation and the start of either of the two neural signals, the speeds of the first and second neural signals are 30-40 and 0.6-0.8 m.s −1 respectively, corresponding well to expected speeds of 50-60 and 0.5-2 m.s −1 for A and C fibers respectively.

Block capability
Blocking performance for the stimulator was evaluated in the rat sciatic nerve model using the setup described in figure 9. A and C fibre recruitment and nerve viability baseline was first measured by stimulating the sciatic nerve with 3× 2500 µA amplitude, cathodic first, biphasic symmetric, current controlled pulses. After three pulses were delivered HFAC block was applied at the stimulation electrode between the stimulating and recording electrodes, corresponding to stimulator channel 2 on figure 9. Block was applied as a current-controlled square wave at 10 kHz and  6 mA amplitude while stimulation continued using the same parameters at the rate of 1 Hz during block, as shown on figure 11. Block was then terminated after 15 seconds and stimulation continued for seven additional pulses to evaluate nerve recovery from block. C fibres appear to recover more slowly from block than A fibres as can be seen during the recovery phase, despite the fact that they are only partially blocked at this block amplitude and frequency in this trial. It was not possible to obtain complete block of C fibres during the stimulator test.

Discussion
Achieved specifications for the stimulator with respect to other designs are shown table 3, however on their own they do not completely describe its strengths and weaknesses.
The key strengths of the proposed stimulator design are: components.
(2) Cheap to source and assemble (less than GBP 350 or USD 450 cost of components and boards per prototype). (3) Flexible powering options, including the controlling computer through a dedicated 5 W USB port. (4) Complete control of output waveform, scripted using any program that can interface with the FTDI Virtual COM Port driver. (5) High current output combined with high resolution and voltage compliance. (6) Multiple independent channels that are driven with accurate timing. (7) Feature extendability using additional PCB modules, such as for recording, that can be driven by the microcontroller processor.
While the device allows concurrent currentcontrolled multi-channel stimulation, this is only possible when stimulation is delivered in a monopolar configuration with a common return electrode connected to stimulator ground, which must be placed away from the nerve in the bath to Figure 9. Drawing of the experimental setup for stimulating and recording CAPs from dissected nerve tissue ex-vivo. The CED Micro 1401 which digitises the analog signal and the stimulator itself are controlled by an external computer, not shown. The stimulator TRG signal is used to trigger both the oscilloscope and CED Micro 1401 acquisition hardware to timestamp stimulation events. A simple siphon is used to provide fresh buffer to the bath, while a peristaltic pump is used to drain the bath to avoid irregularity when using gravitational drainage. Two stimulation electrodes are used in tests where HFAC block is applied, and one when only conventional stimulation is required. The platinum sheet electrode is a common return path for current sourced through every channel of the stimulator.   prevent interference during stimulation. If multiple electrically isolated bipolar stimulation channels are required, two approaches are possible to achieve this: One method is to use multiple stimulator devices, all controlled using USB ports on the same computer and powered by isolated USB power sources such as power banks. In this instance only one channel from each stimulator can be used in bipolar mode.
If there are not enough USB ports available, an alternative method would require a substantial modification of the design such that multiple bipolar channels are controlled by one microcontroller. Following the block diagram in figure 2, the stimulator block would have to be replicated with one channel per block, with the following components: Implementing each module separately would significantly increase the part number, complexity and cost of the overall device as well as require a rewrite of the microcontroller and computer code to take into account hardware changes. As it was possible to demonstrate concurrent block and stimulation using only monopolar channels this was not attempted with the design proposed in this work.
The cutoff frequency for output impedance which is shown figure 7 is low at only 1 kHz and can be attributed to the wide output swing required for U1 as a result of U2 being in a non-inverting configuration. However for the purposes of stimulation using cuff electrodes the output impedance is still much higher than the kilo-ohm range at all frequencies of interest, for example the impedance magnitude at 10 kHz is near 40 kΩ, leading to less than 3% error in current output for electrodes having 1 kΩ impedance at that frequency. It is however possible to shift the cutoff frequency to the right by adjusting the design, trading power by using an inverting configuration for U2 for example. The simulated and measured curves show general agreement yet differences suggest that careful optimisation could improve the AC performance of the stimulator incrementally, potentially gaining an order of magnitude of output impedance at the highest frequencies. Output compliance could be nudged upwards by the use of a rail-to-rail amplifier for U2, however there could be possible tradeoffs in output impedance at high frequencies since U2 was chosen specifically for its high current output and high slew rate.
The relationship between the frequency of the output waveform and the stimulator output impedance determines which electrodes are acceptable for use with specific stimulation waveforms. For example, if the use case requires high frequencies such as 10 kHz or an equivalent pulse width of 100 µs, then only low-impedance electrodes should be used as the output impedance of the device will be too low to use high-impedance electrodes without substantial error between desired and actual output current. If the stimulation pulse width is longer then electrodes with higher impedances can be used as determined by the output impedance of the stimulator at the dominant frequency of the stimulation waveform. Analog output impedance over frequency is the determining factor here as the digital components are capable outputting much higher frequency waveforms, however the analog components would be unable to comply. With a peripheral clock speed of 60 MHz and an SPI word length of 16 bits, stimulate at frequencies upwards of 1 Mhz accounting for overheads, with pulse widths of 1 µs for example. However the output DAC and Howland Current Pump would be unable to follow such a waveform accurately. The settling time of the Howland Current pump was measured for full-scale steps using a 10%-90% measuring method. In the worst case scenario the settling time was 1.5 µs, therefore any stimulation pulse width shorter than this time is likely to be significantly distorted. As such the recommended minimum pulse width for the device is 10 µs, as in the case when using 50 kHz HFAC block stimulation.
The compliance voltage of ± 15 V allows a wide range of extraneural cuffs to be used and, when only small currents are required for stimulation, inter and intra-fascicular stimulation electrodes. Increasing the voltage compliance, while desirable, is quite difficult here due to the constraints on the components: operational amplifiers compatible with power supplies beyond 36 V generally do not have the dynamic and precision performance of those with lower power supplies. As each op-amp used within the Howland Current Pump needs to comply with the high stimulator power supply, improving the performance of the primary op-amp as is the case here would not be possible with high-voltage op-amps. With added complexity it could be possible to circumvent this problem however -the stimulator could use high-voltage transistors to regulate output current instead of using an op-amp directly, along with a set of switches to reverse current direction, however this design may have lower bandwidth. Another possibility is using a design similar to the Neurodyne mentioned earlier in this work, however in this case the tradeoff is the inability of the device to output long pulses, restricting available bandwidth.
The Howland current pump is here used to circumvent issues from using driven transistor current sources combined with h-bridges, which require higher voltage at the power rails to prevent leakage when the polarity of the current is inverted during stimulation, as the stimulation electrode behaves partially like a capacitor and therefore operates similarly to a capacitive charge pump. In that scenario a fully charged electrode capacitance will present voltages outside of the power rails to the stimulator outputs, which in the case of standard components will cause the ESD protection diodes to leak current. However, the Howland Current Pump may be less suitable for human use as driven transistor current sources have an innate means to prevent leakage by driving the transistor gate to the base voltage, preventing any current from passing through. This is not possible using the Howland Current Pump and external switches must be used to completely prevent current from being sourced as small output offsets are practically unavoidable. For this reason this stimulator is designed only for experimental neurophysiology.
Currently power consumption is quite high at approximately 4 W measured using a DC Power Analyzer (N6705B, Agilent Technologies) compared to similar stimulators in the literature, though optimization of power was not a priority in this design due to the inherent power demand of high frequency block. Currently, using 5 V USB-chargeable battery packs for power ensures both long operating time on one charge and straightforward access to charging. However there is room to optimize for power consumption both on the stimulator module itself by providing ways for the microcontroller to turn off stimulator channels that are not connected to electrodes, and also by optimizing the power consumption of the microcontroller itself. The former is possible by daisy-chaining additional switches to the SPI channel used for channel output routing, and the latter could benefit from a slower core clock, however this would affect timing performance. Idle power could be further reduced by gating the clock to select peripherals only when they are needed.
The device uses the FTDI chip to enable communication with the host PC using serial commands send to a virtual COM PORT, and received by the microcontroller using the UART peripheral, even though the K64F development board has a dedicated USB port. This was done for three reasons: • Implementing a decision tree using the UART peripheral interrupt is simpler than using a USB software stack on the microcontroller, leaving more time to develop stimulator features. • Using a COM Port interface enables the use of simple serial commands within MATLAB for example, and of other third-party programs interfacing with COM Ports to control the stimulator. Operation would not be as flexible if a specific USB driver had to be used. • To isolate the PC and microcontroller board power domains with a direct USB connection would have required the use of a USB isolator. These can also supply 5/,V isolated power but would not have been able to power the stimulator as the stimulator power supply has to be isolated from the microcontroller power supply, therefore an external power supply for the stimulator is required regardless.
In terms of performance during electrophysiology experiments, both A and C fibres were able to be stimulated in the ex-vivo rat sciatic nerve model. While A fibre block was achieved C fibre block was only partial as can be seen figure 10. There are several possible reasons for this including nonidealities in the design of the nerve cuffs used as well as possibly insufficient voltage compliance or insufficient current output to reach the high block thresholds of C fibres, which are higher than those of A fibres. Work is ongoing to identify the root causes of this observation. The stimulator also does not have a DC-filter to prevent DC leakage, which may have affected the block thresholds of C fibres. Leakage can be calibrated to be less than 5 µA and was verified to remain constant over the course of several hours. In future experiments to determine the block threshold of C fibres, an external DC filter can be used such as the one described in [24].

Ongoing and future work
Although the hardware is present for the stimulator to monitor electrode voltage during stimulation, software is still currently being developed. Work is ongoing to develop software to detect overcompliance during stimulation and measure the impedance of electrodes for characterization and diagnostics, for example. As a result the device was manually calibrated for experiments to minimise current output offset and output drift over time was measured as shown figure 12. Experiments using the device have to take the warmup period of approximately one hour into account in the protocol to give time for the output to stabilize.
On the PC side the current programming model is script-based using MATLAB, and work is ongoing to develop a GUI which will streamline the use of the device for concurrent stimulation and recording, and allow marking of stimulation events along with corresponding stimulation settings for each event, for example.

Conclusions
A stimulator design is proposed that aims to fulfill requirements for a versatile and powerful acute exvivo and in-vivo neurophysiology platform. The stimulator is suitable for both conventional and blocking stimulation of peripheral nerves, and was designed with versatility and affordability in mind. It was shown to be able to excite A and C fibre populations which represent both ends of the nerve fibre diameter spectrum in the rat sciatic nerve, and can be assumed suitable for other peripheral nerves such as the vagus. Complete control of the output waveform is given to the user combined with accurate timing using event and peripheral-driven stimulation. Stimulation can be carried out using multiple channels concurrently for monopolar electrodes. Power is provided by USBchargeable batteries to prevent interference of stimulation with recording.
The overall goal is to provide an affordable tool for neurophysiology experiments with a quick turnaround time to de-risk more involved chronic in-vivo studies, in light of interest in using HFAC block combined with conventional stimulation for therapeutic applications. In order to make this tool available to the community the design and source code files have been published on github under a GNU license at https://github.com/rapeauxa/HFAC_Stimulator_4ch, along with documentation explaining how to set up and use the device, as well as how to modify the source code.