Do desktop computer motherboards have GPIO? If they do, how to read from or write to them

22

4

I've seen some pins like microcontroller's GPIO pins on the desktop computer motherboards for a couple of times, I wanted to know, first, are they really GPIOs? if yes, is it possible to read from or write to them?

Mohsen Salahshoor

Posted 2015-10-29T16:47:09.433

Reputation: 223

2They are whatever the datasheet for the motherboard says they are. Other than that, this question is just asking for speculation. – None – 2015-10-29T16:49:30.307

1@OlinLathrop okay if they are, how can I communicate with them? do operating systems have a built-in API for this purpose something? or are there any API for programming languages? – None – 2015-10-29T16:52:05.267

2"pins like microcontroller's GPIO pins" How are they "like"? All pins look the same.. – Eugene Sh. – 2015-10-29T16:52:32.810

I haven't come across GPIO pins on a desktop computer, things looking like those were most of the time some peripheral extensions (USB header, Audio header etc.) or the inputs for the switches and outputs for LEDs. If that were a common feature the internet wouldn't be littered with advice on how to use the DTR of the serial port as a GPIO or the parallel port. I'd say this question does not belong here. – None – 2015-10-29T16:56:08.813

2x86 CPU's will in general not have GPIO pins, with every pin being directed to a specific on-die peripheral without PIO multiplexing that is common on MCU's. HOWEVER, GPIO like functionality is often part of the architecture and handled by (typically memory mapped) peripheral on the motherboard, the chipset will often have some low-level buses (SPI and I2C for sensors) as well as GPIO's available, the exact nature depends on the motherboard and chipset/architecture used. – crasic – 2015-10-29T16:57:22.120

@EugeneSh. they are placed right near each other just like my arduino nano board – None – 2015-10-29T16:58:39.660

@crasic then if you say that, I think I got the answer of my question – None – 2015-10-29T16:59:17.850

And consider this: if you would use such a motherboard's GPIO and in your experiment you blow it up/destroy it. That will be expensive to replace. If you use a cheap GPIO through USB or whatever and destroy that, it will be cheap to replace. – None – 2015-10-29T16:59:32.703

@Mohsen Their placement tells virtually nothing about their function. – Eugene Sh. – 2015-10-29T17:02:11.663

@Mohsen its not really an answer as much as a general state of consumer hardware, I'm sure there are x86 devices intended for embedded applications that have on board gpio. BTW datasheets for Intel and AMD cpu's are generally available on their respective websites, you can see what peripherals are available on die. The general conclusion is that high end consumer devices like the i7 have a handful of high speed buses and standard interfaces for memory. – crasic – 2015-10-29T17:02:30.437

The linux package "lm-sensors" lets you read the devices on the I2C bus; this will usually be a set of temperature sensors, fan controllers, and identification EPROMS on you DRAM. – pjc50 – 2015-10-29T17:08:59.217

Well, I know there are embedded boards or external USB modules to be used for this purpose, but the program I'm going to develop needs resources that is included in a desktop computer(Ram, CPU,..) an embedded device is not capable of running it. – None – 2015-10-29T17:34:55.533

If you need some gpio, a i2c port expander added to one of the i2c or smbus would work in a pinch. – cde – 2015-10-29T20:01:18.590

Answers

15

Normal PCs don't have GPIO as such in the sense of "pins intended to be general purpose". The connectors on a PC motherboard (whether internal headers or external ports) were all designed for specific functions. However, some of them can be repurposed for your own ends.

The closest thing to GPIO that PCs have is probably the parallel printer port which has a number of data lines and handshake lines. These lines are somewhat like GPIO pins, though you have less flexibility in terms of their directions. http://retired.beyondlogic.org/spp/parallel.htm

The handshake lines on serial ports can also be used as general IO, though they have weird voltage levels.

Parallel and serial ports are less common than they used to be, but it's still pretty easy to find motherboards that have them if you shop around.

You may also be able to repurpose inputs and outputs intended for case LEDs, buttons etc, but I would imagine the details will be very specific to a particular system.

PCs use an I2C based bus called SMBUS for various management functions. I'm sure I've seen reports of people putting their own I2C devices on this bus through soldering wires to it before, but I can't find links right now.

There's another I2C bus on the video ports used for monitor identification. Whether you can get software access to it depends on what OS and video hardware you are using http://www.instructables.com/id/Worlds-Cheapest-I2C-I-Squared-C-Adapter/step5/Software-and-Projects/

And of course, there is USB. There are now cheap microcontrollers with USB interfaces which you can use to connect to this.

plugwash

Posted 2015-10-29T16:47:09.433

Reputation: 4 587

2

I know this is an older topic, but anyway...

Having programmed BIOS code, I can say that every motherboard has GPIO's and they are completely available in the user address space and the port address is usually very close to the parallel port. I've made custom drivers for custom motherboards using standard parallel port drivers, all I had to do was modify the address number, but I knew that number in advance.

Can you use them? Well that depends on the person that programmed the BIOS. The state of all GPIO's has to be set pre-compile, all unused GPIO's could be easily set to be disabled.

If a GPIO is unused and unset, what is its default state? Quite likely just floating (most are tri-state so good luck)..

Does a GPIO have a pullup/pulldown? Who knows if the EE added one..

Are there traces for any of the unused GPIO's? I doubt it, but hey anything is possible..

In short, you have to get lucky that an unused GPIO has been set in a manner that you can use it; much like arduino (but without real defaults), think "INPUT/OUTPUT/TRI". It has to have a usable trace on the motherboard that hopefully has a pin or pad to solder to. Then if you know the address location of the GPIO you can use a standard user space driver easily.

Ian Ide

Posted 2015-10-29T16:47:09.433

Reputation: 21

2

I think the question if motherboards have GPIO is very specific to the model and make. Some may, some don't.

E.g. on my Asus desktop board it contains a Nuvoton NCT6775 for fan control and temperature read out. This is accessible from the (vendors custom) BIOS and Windows desktop utilities. I need to run Asus' software in order for the fan control to work, which means the PWM fan control is done by software. On a Linux installation I need to set up it manually via this kernel module and pwmconfig.

If you look at the Nuvoton NCT677xF datasheet you will find generic hardware for controlling PWM, reading temperature & voltages and also GPIO via SMBus. Equipped with both gives you a decent start to make it work. In theory you could use this chipset for GPIO functions.

However I wouldn't touch it. You don't know what hardware is connected to it, unless you want to dive into a very specific model of motherboard and reverse engineer it (e.g. layout, pin allocations etc.). It is not broken out to a connector neither.

Most importantly, if your application needs to last for several years, the motherboard model should as well. If not, tying to very specific motherboard hardware is not a good idea.

Hans

Posted 2015-10-29T16:47:09.433

Reputation: 212

0

PCs generally have i2c interfaces, and you can find IO expander chips for i2c like the TI TCA9535DBR.

So indirectly you could do this depending on your speed requirements. If you're on a PC then exact timing requirements are tricky anyway.

Hans

Posted 2015-10-29T16:47:09.433

Reputation: 143