Kicad-to-HAL: Mesa Electronics 5I25 FPGA Card

The Mesa Electronics 5I25 FPGA card can implement a vast number of hardware I/O controllers, but I’ve only set up the few Kicad symbols required for my simple Sherline mill. The LinuxCNC hostmot2 doc gives the details.

The hm2_5i25.0 component (upper right) carries the pins and functions pertaining to the card itself:

Servo Thread Hookup schematic
Servo Thread Hookup schematic

If you have two such cards, you’ll also have an hm2_5i25.1 component. Kicad will annotate both with a zero, which Kicad-to-HAL then strips off before attaching the pin names.

The read and write functions must attach to the first and last positions of the servo-thread component, respectively, to make the thing work correctly.

The read_gpio and write_gpio functions are normally not connected; the * prefix suppresses a Kicad-to-HAL message about unconnected named pins. The code will strip the asterisk before connecting the pins, but that part is … lightly tested.

Similarly, the schematic shows the watchdog output connected to one of the on-card LEDs. I’m not sure how to test that and wouldn’t see it inside the PC case; it might work as described.

A hm2_5i25.0.gpio.000 Kicad symbol (middle) collects all of the HAL pins related to a single 5I25 GPIO pin; edit the three-digit pin identifier to match the hardware pin. Although the out and in names look backwards, they indicate the hardware direction: you write to the out pin and read from the in pin.

The Sherline uses four stepgen blocks, so that’s the only other Kicad symbol on offer:

X Axis Joint PID Stepgen schematic
X Axis Joint PID Stepgen schematic

The nets connecting those three components come directly from the LinuxCNC pncconf configuration utility. Fancier machines surely require more attention to the coefficient details.

Connecting a true parameter to the step.invert_output and direction.invert_output pins flips the polarity of those signals. The pins are aliases of the corresponding GPIO invert_output pin, with the key advantage of not requiring you to figure out which GPIO pin corresponds to the FPGA’s output pin for each axis.

The 5I25 card requires a pair of loadrt components to load the drivers and configure the FPGA:

Kicad-to-HAL Demo Schematic
Kicad-to-HAL Demo Schematic

The one-page demo schematic uses the same 5I25 configuration as the Sherline, with the LEDs driven by gamepad buttons to provide something to look at:

Mesa 5I25 card - LED activity
Mesa 5I25 card – LED activity

I should force-fit an LED into the Sherline driver box just to have something easier to see.

One thought on “Kicad-to-HAL: Mesa Electronics 5I25 FPGA Card

Spam comments get trashed, so don't bother. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s