PATA as external I/O controller

Discussion in 'Modding and Customization' started by JM2009, Mar 29, 2009.

  1. JM2009

    JM2009

    Joined:
    Mar 29, 2009
    Messages:
    2
    Likes Received:
    0
    Updates: ROBOT 2 April 1,2009

    *****************************************************************************************************************
    ROBOT 1 - PATA as external I/O controller

    This modification provides the Acer Aspire One (or any other PC) with I/O control to external devices. In my case, this is for controlling a robot.

    I was previously making use of the parallel printer port to do the same, but since its disappearance from new PC I have been looking for other ways to control external devices. I though of using USB ports but this is more complicated then expected; unless I buy expensive USB control boards. Fortunately, I came across an article http://wiki.osdev.org/ATA_PIO_Mode that describes the hard drive PATA interface, more interestingly the PIO mode.

    I bought the One with the PATA 8G SSD version, however I decided to install a 250G SATA hard drive because of the slowness of the SSD. This freed up the PATA interface with a handy 40 pin ZIF connector on the board.

    To make this PATA as an external interface, I used the ZIF cable and made it accessible from the compartment for the 3G modem under the One. I procured a 40 pin ZIF to 50 pin 1.8” IDE adapter from Deal Extreme. http://www.dealextreme.com/details.dx/sku.10887 . I removed the 50 pin connector and soldered a 40 pin IDE hard drive cable.
    [​IMG]
    [​IMG]
    Note: I made a notch so I can close the door of the 3G modem compartment.

    Programming
    Under Linux, this interface is recognized as a SCSI PATA at 0x0170 with ctrl at 0x0376 and IRQ 15. For programming under Linus, see article http://www.faqs.org/docs/Linux-mini/IO- ... mming.html. Make sure you do the following:
    use ioperm in program to make the ports available (see article above)
    gcc -O2 -o program program.c //compiling with optimization required;
    chown root program // as root
    chmod u+s program //as root to make the program executable with user privileges.

    //////////////////////////////////////////////////////////////////////////////////////////////////
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/io.h>
    #define BASEPORT 0x0170

    int main()
    {
    if (ioperm(BASEPORT,8,1)) {printf("ERROR/n"); return 1;}
    int value = inb(BASEPORT);
    printf("PIO 0x0%x has value = 0x%x\n", BASEPORT, value);
    return 0;
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////

    Next article will be on building the control interface board for the robot.

    ***************************************************************************************************************
    ROBOT 2- Controller circuit testing

    I have design the controller circuit: 64 OUT and 64 IN controlled PINs.
    Here is schematic: http://www.flickr.com/photos/[email protected] ... 5/sizes/l/

    I have tested the circuit and it is working well.

    [​IMG]

    My next step is to make the printed circuit board.
     
    JM2009, Mar 29, 2009
    #1
    1. Advertisements

  2. JM2009

    fridtear

    Joined:
    Feb 4, 2009
    Messages:
    72
    Likes Received:
    0
    Really interesting!

    Can't wait to read the next chapter!
     
    fridtear, Mar 30, 2009
    #2
    1. Advertisements

  3. JM2009

    tim292stro

    Joined:
    Mar 24, 2009
    Messages:
    44
    Likes Received:
    0
    [Deleted]
     
    tim292stro, Apr 6, 2009
    #3
  4. JM2009

    JM2009

    Joined:
    Mar 29, 2009
    Messages:
    2
    Likes Received:
    0
    I am not sure if we can address directly the IDE IO ports when using it through USB interface. My understanding is that these devices come with drivers that emulate the IDE interface. If you know how we can address the IDE IO ports directly when using these USB interface, please let me know.

    This issue is the same for the USB to printer parallel interface, I do not think I can address directly but I have not tried. So anybody that have succeeded to do this, please let me know.

    For now, I will concentrate on my robot and write my software for Linux where accessing IO ports is well documented. I do not intend to write the access program under Windows.... right now.

    I have drawn the schematic and the PCB layout using software under Linux and I will publish on this site soon. My next chapter.
     
    JM2009, Apr 6, 2009
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.