主题中讨论的其他器件:AM625
工具/软件:
你(们)好
我们想在 uboot-10.01.10\arch\arm\mach-k3\am625_init.c void board_init_f (ulong dummy)中控制 GPIO1_28、但失败
同样的代码控制 GPIO1_28 (在 uboot-10.01.10\board\ti\am62x\evm.c 内置 board_lay_init (void))、这对我们来说很有用。
在 am625_init.c 中使用 GPIO1_28之前、我们应该做 些什么?
我们注意到每次首次上电都会失败、如果我们在 uboot 下使用 cmd "reset"、两个代码都将起作用。
#define BUZZFREQ_GPIO_PIN 120 /*EHRPWM2_A=GPIO1_28 92+28*/ gpio_request(BUZZFREQ_GPIO_PIN, "buzz_sound_freq"); long int i = 0; for(i=0; i<240;i++) { gpio_direction_output(BUZZFREQ_GPIO_PIN, 1); udelay(208); gpio_direction_output(BUZZFREQ_GPIO_PIN, 0); udelay(208); } gpio_free(BUZZFREQ_GPIO_PIN);
我们还仔细检查了 GPIO 寄存器
===>>> init gpio state ===>>> read 0x00601018 GPIO_SET_DATA01=0x00000000 ===>>> read 0x0060101C GPIO_CLR_DATA01=0x00000000 ===>>> read 0x00601010 GPIO_DIR01=0xffffffff ===>>> read 0x00601014 GPIO_OUT_DATA01=0x00000000 ===>>> set gpio ON ===>>> read 0x00601018 GPIO_SET_DATA01=0x10000000 ===>>> read 0x0060101C GPIO_CLR_DATA01=0x10000000 ===>>> read 0x00601010 GPIO_DIR01=0xefffffff ===>>> read 0x00601014 GPIO_OUT_DATA01=0x10000000 ===>>> set gpio OFF ===>>> read 0x00601018 GPIO_SET_DATA01=0x00000000 ===>>> read 0x0060101C GPIO_CLR_DATA01=0x00000000 ===>>> read 0x00601010 GPIO_DIR01=0xefffffff ===>>> read 0x00601014 GPIO_OUT_DATA01=0x00000000
此致、
Scott