# gpio card



## antolap (May 3, 2020)

Hi
which gpio cards are compatible with FreeBSD 12 ?
I need card to check digital inputs
At the moment I'm using the parallel port of my computer but I need a lot of inputs
Which cards work without problems?


----------



## Martin Paredes (May 3, 2020)

For compatibility, consult the FreeBSD Manual Pages apropos gpio


----------



## Phishfry (May 3, 2020)

Besides the Arm boards, I have tried bytgpio, which is based on the Minnowboard Turbot and nctgpio as found on the APU12/3 boards.
You might want to read the source to see if they will work for your task.
/usr/src/sys/dev/gpio/bytgpio.c
/usr/src/sys/dev/nctgpio/nctgpio.c


----------



## ralphbsz (May 3, 2020)

The big question is: what hardware do you have? Do you have PCI slots, ISA slots, PCIe slots? How about serial and USB ports?

And what are your requirements: Latency? Drive current? Electrical isolation?

The easiest answer might be a parallel (printer) ports. You used to be able to get dual and quad ISA bus parallel cards (with ribbon cables for the extra connectors). And the cheapest solution today would probably be to fill every PCI(e) slot with a single-port printer card, those can be had for under $10.

The other big advantage of parallel printer port cards: no driver issues, they mostly use the standard lpt driver.

These days, I would do it differently, not using cards that go into the computer, but external hardware. What I have in production at home are digital and analog IO cards that connect via serial port, look on the web for "Weeder IO modules". Very convenient, because with a thin RS232 cable, you can move your wiring to a convenient place, and you can get optocoupler or relay isolation if needed. The other convenient answer is to use a Raspberry Pi: For about $10, a Pi Zero W gives you about 2 dozen GPIO pins, in a super-convenient package, and you get your data over the network.


----------



## antolap (May 3, 2020)

I have PCI and PCIe slots on the mainboard

I tried with arduino (arduino sending pin status via serial port) but I found that asking status pin via parallel card was very very very fast
the problem is that I'd like to have a lot of pin (I would need ten/twenty parallel ports) and I should have many computers with few parallel port each one

I wanted a card easy to use like a parallel port with a lot of pins and which works very well with FreeBSD kernel


----------



## ralphbsz (May 3, 2020)

10-20 pins, or 10-20 8-bit ports (meaning about a hundred bits)? The former is easier; the standard LPT gets you 12 pins or so (if you don't care that some are output only). Two printer cards per computer might just do it. This is clearly the cheapest, and the easiest for driver support.

Do you actually need something that is that fast? I've measured that using python on a raspberry pi, reading or setting a single bit GPIO takes about 50 microseconds. Sure, that's fast, but in most cases that's also way faster than needed. In contrast, doing the same with a serial port (with my Weeder-brand IO boards) takes 6-8 milliseconds, but that is still more than fast enough, given that I only read the GPIO once every second or every 10 seconds.

From a wiring standpoint (convenience), using WiFi to something like a Raspberry Pi or BeagleBone might be more convenient.

Driver support in the kernel? Martin Paredes listed the man pages, and I think that's it.


----------



## antolap (May 3, 2020)

how many parallel ports can a motherboard support? and the kernel?
I'd like to have more than at least 4-5 parallel ports or a gpio card with lot of input pins


----------



## Phishfry (May 3, 2020)

I have been considering buying one of these for GPIO








						Brainboxes Ethernet to 8 Digital IO Lines - Ed-008 for sale online | eBay
					

Find many great new & used options and get the best deals for Brainboxes Ethernet to 8 Digital IO Lines - Ed-008 at the best online prices at eBay! Free shipping for many products!



					www.ebay.com
				



I like that it is OS independant and accessible by ethernet.
Many of the GPIO boards (Arm/APU/Minnowboard) come with no terminal block and you must rig up something to access the pins.





						Ethernet to 8 Digital IO Lines - ED-008 - Brainboxes - Ethernet, IO, & Serial Cards
					

Brainboxes Ethernet to 8 Digital IO Lines - ED-008 Ethernet to DIO device: 8 digital input/output channels. Powerful ARM 80 MHz, 32 Bit CPU. Offers robust and intelligent 'control side' devices that provide the interface to systems on the 24V factory floor environment, commonly referred to as...




					us.brainboxes.com


----------



## ralphbsz (May 4, 2020)

antolap said:


> how many parallel ports can a motherboard support?


How many PCI(e) slots do you have? How many can you free up? Can you find 2- or 4-port printer port cards?



> and the kernel?


I have no idea. The man page doesn't explicitly say so. You probably have to read the source code of the drivers to see the address assignment, and how far it goes.


----------

