WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Making use of GPIO pins on VIA VT1211 inside a HP T5520  (Read 2880 times)

Offline Project23D

  • Newbie
  • *
  • Posts: 24
    • Technology Research and Development
Making use of GPIO pins on VIA VT1211 inside a HP T5520
« on: July 08, 2011, 07:27:18 AM »
Greetings all,

I'm new to hardware programming. I'm looking for a few pointers and here is what I'm wanting to do in a nutshell:

Using a thin client, HP T5520, it has a VIA VT1211 SuperIO chip that I'd like to use for a couple of projects. The basic idea is to use the GPIO pins to control LEDs and relays, and receive events from switches.

The LEDs are going to be used for display purposes; to show whether a mechanical device is supposed to be running or not, show stop or run of a mechanical or software process, etc.

The switches will be part of the HMI to allow control of the relays and software functions without the need of issuing commands on the computer's console.

So, this is a series of things that much be accomplished, however, what are some pointers for programming the VT1211 to accept and perform commands as they are entered in to the CLI?

anything else?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Making use of GPIO pins on VIA VT1211 inside a HP T5520
« Reply #1 on: July 08, 2011, 11:53:27 AM »
That is what device drivers are for.
If one is not included in the kernel or as a module, you need to write one.
Try "Linux Device Drivers" published by O'Reilly

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Making use of GPIO pins on VIA VT1211 inside a HP T5520
« Reply #2 on: July 08, 2011, 01:03:22 PM »
« Last Edit: July 08, 2011, 01:05:11 PM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Tuftec

  • Full Member
  • ***
  • Posts: 111
Re: Making use of GPIO pins on VIA VT1211 inside a HP T5520
« Reply #3 on: July 08, 2011, 09:57:17 PM »
If you are not too concerned about Linux correctness and you just need to get soething going in a hurry, you can write directly to the machine hardware.

You need to have su (root) permissions.

Here are a couple of little programs that I have used to do some basic bit manipulation on i/o ports.
I was using this to test the effectiveness of the RT PREMPT patch for TC primarily.

Using the RT kernel is a little messier but it all seems to work.

If you are happy to use the standard kernel and not that concerned about running as root then the code is reasonably straightforward.

You of course need to know a little about your hardware and how to drive it.

Cheers

Peter.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11641
Re: Making use of GPIO pins on VIA VT1211 inside a HP T5520
« Reply #4 on: July 08, 2011, 11:44:08 PM »
Hi Project23D
If you wish to access the chips registers via the CLI you will need a driver that exposes them from
kernel space to user space, usually through the /proc file system. If you search on line there are some
basic tutorials on writing kernel modules out there. You will need the compiletc extension in order to
compile the driver. The driver would basically
1. Read the input register and save the contents to /proc/AT1211/file1.
2. Read the file /proc/AT1211/file2 and save the contents to the output register.
3. Sleep for 100mS.
4. GOTO 1.
The choice for the directory and file names are up to you, I just made these up for the description.
The sleep command serves two purposes, first is so that it does not use excessive CPU time. Second
is to de-bounce your switches so you don't get relay chatter. Do NOT try to de-bounce the switches by
hanging capacitors across the contacts, and make sure your pullup resistors are returned to the same
voltage the IO chip is running at. You should also take a peek at vt1211.c source code for hwmon, it
mentions that there is more than one possible address that it might be mapped to.
Once you load the driver you can access the ports using a script or the CLI by reading
/proc/AT1211/file1 and writing /proc/AT1211/file2.
One more thing, be sure to use isolation resistors between the output port and your relay drivers. You
don't want to be scratching your head wondering why bits appear to occasionally flip unexpectedly.