This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] BEAGL-BONE-BLACK:GPIO 引脚多路复用器上的下拉电阻器不工作

Guru**** 2473260 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1465568/beagl-bone-black-pulldown-on-gpio-pinmux-not-working

器件型号:BEAGL-BONE-BLACK

工具与软件:

你(们)好、

我目前正在 Rust on the BeagleBone 开发裸机操作系统作为我的最后一个高中项目。 我成功启动了控制器、还设法对 GPIO 引脚进行了读取和写入。

然后、我尝试通过引脚多路复用为 GPIO 引脚设置下拉行为、我在引脚 GPIO1_28上成功实现了这一操作。 但在尝试为分别对应于引脚 GPMC_ad6和 GPMC_a0的引脚 GPIO1_6和 GPIO1_16设置相同的配置时、它们的行为与之前相同。

我也试着问 deepseek ai,它认为它可能是一个锁销,这没有记录,但被一些东西使用,但不幸的是,我找不到关于这一点的任何东西,所以这也可能是错误的。

Felix

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    const CONTROL_MODULE_BASE: u32 = 0x44E10000;
    
    enum Offset {
        Lock = 0x20C,
        GpmcBen1 = 0x878, // GPIO1_28
        GpmcAd6 = 0x818,  // GPIO1_6
        GpmcA0 = 0x840,   // GPIO1_16
    }
    
    pub fn configure() {
        set_pin_mode(Offset::GpmcBen1, 7, true, PullResistor::PullUp);
        set_pin_mode(Offset::GpmcAd6, 7, true, PullResistor::PullDown);
        set_pin_mode(Offset::GpmcA0, 7, true, PullResistor::PullDown);
    }
    
    fn set_pin_mode(offset: Offset, mode: u32, input_enable: bool, pull_resistor: PullResistor) {
        write_addr(CONTROL_MODULE_BASE + Offset::Lock as u32, 0xAAAA);
        let control_module = CONTROL_MODULE_BASE + offset as u32;
    
        write_addr(
            control_module,
            (mode & 7) | pull_resistor.to_mask() | ((input_enable as u32) << 5),
        );
    }
    
    pub enum PullResistor {
        None,
        PullDown,
        PullUp,
    }
    
    impl PullResistor {
        pub fn to_mask(self) -> u32 {
            match self {
                PullResistor::PullDown => 0b00 << 3,
                PullResistor::PullUp => 0b10 << 3,
                PullResistor::None => 0b01 << 3,
            }
        }
    }
    
    这是用于设置控制模块的代码。 虽然它是生锈的,许多人不会太熟悉,我希望可以理解的代码

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    请与 Beagle 社区联系: https://www.ourbeagleworld.com/forums/

    此致、
    Krunal