【问题标题】:Fintek F71869A GPIO ControlFintek F71869A GPIO 控制
【发布时间】:2014-10-21 18:29:30
【问题描述】:

我想控制 Jetway Atom PC JBC373F38 (http://www.jetwaycomputer.com/JBC373F38.html) 上的 GPIO。我发现那台 PC 上的 GPIO 是超级 IO 芯片 Fintek F71869A 的一部分(GPIO3)。我编写了一个小代码来使用 0x2E/0x2F 端口在 Linux 上控制这些 GPIO 引脚,但它不起作用。可能有人有这个问题的工作示例,或者告诉我我的代码中的错误是什么。这是我的代码:

#define AddrPort 0x2E
#define DataPort 0x2F

#define WriteByte(port, val)    outb(val, port)
#define ReadByte(port)          inb(port)

#define PORT_INDEX  0xC0
#define PORT_DATA   0xC1

    //Enable 
    WriteByte(AddrPort, 0x87);
    WriteByte(AddrPort, 0x87); //Must write twice to entering Extended mode

    //< Select Logic Device >
    WriteByte(AddrPort, 0x07); // Enter selecting mode
     WriteByte(DataPort, 0x06); // Select logic device 06h: GPIO


     //<Output Mode Selection> //Set GP30-37 to output Mode
    WriteByte(AddrPort, PORT_INDEX); // Select configuration register C0h
    WriteByte(DataPort, 0xFF);

    //<Output Value>
    WriteByte(AddrPort, PORT_DATA); // Select configuration register C1h
    WriteByte(DataPort, 0xFF); //Set all bits HIGH

【问题讨论】:

    标签: embedded-linux gpio


    【解决方案1】:

    您是通过两次写入0x87 来启用配置,但您是在完成后通过发送WriteByte(AddrPort, 0xAA); 来禁用配置模式。

    您的 AddrPort 和 DataPort 也显示不正确;它们应该是 0x4E 和 0x4F。

    参见this documentation 的第 6 节。

    它说:

    以下是使用调试启用配置和禁用配置的示例。

    -o 4e 87
    -o 4e 87 (enable configuration)
    -o 4e aa (disable configuration)
    

    【讨论】:

    • 谢谢蒂姆,你是对的,我将 AddrPort/DataPort 更改为 0x4E/0x4F,它现在运行良好。
    猜你喜欢
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多