Andreas
2012-12-05 20:23:41 UTC
Hi All!
I'm trying to use GPIO via dev/mem on my beaglebone and the first step is
to write to the pin mux.
Code something like this: (C code)
const unsigned long GPIO_CONTROL_MODULE_REGISTER_BASE_ADDRESS = 0x44E10000;
unsigned long * control_register;
gpio_fd = open("/dev/mem", O_RDWR | O_SYNC);
control_register = (unsigned long *) mmap(NULL, 0x1FFF, PROT_READ |
PROT_WRITE, MAP_SHARED, gpio_fd, 0x44E10000);
control_register[gpio_control_table[_pin].pad_ctrl_address / 4] = 0x2F;
Reading is no problem all values set by
echo 7 > /sys/kernel/debug/omap_mux/gpmc_ad6
can be reed back with cat command or my program
name: gpmc_ad6.gpio1_6 (0x44e10818/0x818 = 0x0007), b NA, t NA
mode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7
signals: gpmc_ad6 | mmc1_dat6 | NA | NA | NA | NA | NA | gpio1_6
My program: (gpio_control_table[_pin].pad_ctrl_address / 4 is only last
16-bit)
data = m_controlModule[gpio_control_table[_pin].pad_ctrl_address / 4]; //
Read value
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
I have tested this with different values.... And no problem to read them.
But it is not possible to write a new value :(
I set the value and read it back.
When running ubuntu the value does not change after writing new value
and read-back.
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
(Set new value)
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
In Angström the value changes but not it has not changed when you
cat /sys/kernel/debug/omap_mux/gpmc_ad6
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
(Set new value)
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x2F
Ofc you can not read the pin because it is still in output mode....
Any idéas?
Best,
Andreas
--
I'm trying to use GPIO via dev/mem on my beaglebone and the first step is
to write to the pin mux.
Code something like this: (C code)
const unsigned long GPIO_CONTROL_MODULE_REGISTER_BASE_ADDRESS = 0x44E10000;
unsigned long * control_register;
gpio_fd = open("/dev/mem", O_RDWR | O_SYNC);
control_register = (unsigned long *) mmap(NULL, 0x1FFF, PROT_READ |
PROT_WRITE, MAP_SHARED, gpio_fd, 0x44E10000);
control_register[gpio_control_table[_pin].pad_ctrl_address / 4] = 0x2F;
Reading is no problem all values set by
echo 7 > /sys/kernel/debug/omap_mux/gpmc_ad6
can be reed back with cat command or my program
name: gpmc_ad6.gpio1_6 (0x44e10818/0x818 = 0x0007), b NA, t NA
mode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7
signals: gpmc_ad6 | mmc1_dat6 | NA | NA | NA | NA | NA | gpio1_6
My program: (gpio_control_table[_pin].pad_ctrl_address / 4 is only last
16-bit)
data = m_controlModule[gpio_control_table[_pin].pad_ctrl_address / 4]; //
Read value
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
I have tested this with different values.... And no problem to read them.
But it is not possible to write a new value :(
I set the value and read it back.
When running ubuntu the value does not change after writing new value
and read-back.
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
(Set new value)
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
In Angström the value changes but not it has not changed when you
cat /sys/kernel/debug/omap_mux/gpmc_ad6
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x07
(Set new value)
[GPIO] : Pin MUX for P8_3 (gpmc_ad6) @ [0x44E10818] is set to 0x2F
Ofc you can not read the pin because it is still in output mode....
Any idéas?
Best,
Andreas
--