HI there,
I’m currently developing a bare metal operating system in rust on the beaglebone as my final highschool project. I successfully booted the controller and also managed to read and write to the GPIO pins.
I then tried to set a pulldown behaviour for the gpio pins through the pinmuxing, which I sucessfully achieved on the pin gpio1_28. But when trying to set the same for the pins gpio1_6 and gpio1_16 which correspond to the pins gpmc_ad6 and gpmc_a0 respectively, they behave the same as before.
I also tried to ask the deepseek ai about this, and it thought that it may be a lock on the pins, which isn’t documented but was used by some things, but unfortunately I couldn’t find anything regarding to that, so that could also just be false.
Felix
const CONTROL_MODULE_BASE: u32 = 0x44E10000;
enum Offset {
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) {
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,
}
}
}