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.

[参考译文] PROCESSOR-SDK-AM62X:SPL uboot 控制 GPIO 失败

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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1522654/processor-sdk-am62x-spl-uboot-control-gpio-failed

器件型号:PROCESSOR-SDK-AM62X
主题中讨论的其他器件: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