merlin 发表于 2016-12-15 14:07:16

imx6dl 复用IO配置为通用IO

请教个很基本的问题: 我想把ENET_RXD0当做通用IO GPIO1_IO27使用
配置IOMUXC_SW_MUX_CTL_PAD_ENET_RX_DATA0 为(101 ALT5 — Select signal GPIO1)通用IO 然后GPIO_GDIR, GPIO_DR为1但是这个角并没有输出高电平

帖子不能发数据截图,故复制之
37.4.122 Pad Mux Register
(IOMUXC_SW_MUX_CTL_PAD_ENET_RX_DATA0)
Address: 20E_0000h base + 1F8h offset = 20E_01F8h



MUX_MODE MUX Mode Select Field.
Select 1 of 4 iomux modes to be used for pad: ENET_RXD0.
NOTE: Pad ENET_RXD0 is involved in Daisy Chain.
001 ALT1 — Select signal ENET_RX_DATA0.
- Configure register IOMUXC_ENET_MAC0_RX_DATA0_SELECT_INPUT for mode ALT1.
010 ALT2 — Select signal ESAI_TX_HF_CLK.
- Configure register IOMUXC_ESAI_TX_HF_CLK_SELECT_INPUT for mode ALT2.
011 ALT3 — Select signal SPDIF_OUT.
101 ALT5 — Select signal GPIO1_IO27

代码如下:
//IOMUXC_SW_MUX_CTL_PAD_ENET_RX_DATA0
reg = (unsigned int *)ioremap(0x020E01F8, 4);
*reg = 0x0D;      //配置为ALT5 GPIO1_IO27通用IO功能

//GPIO1_IO27: GPIO direction register (GPIO1_GDIR)
/*
0 INPUT — GPIO is configured as input.
1 OUTPUT — GPIO is configured as output.
*/
reg = (unsigned int *)ioremap(0x0209C004, 4);
*reg |= 1 << 17;   //配置输出

//GPIO1_IO27: GPIO data register (GPIO1_DR)
reg = (unsigned int *)ioremap(0x0209C000, 4);
*reg |= (unsigned int)(1) << 17;//输出高电平
但是测量并没有高电平输出,是还有寄存器没有配置到吗?谢谢

飞凌-chongzi 发表于 2016-12-15 14:59:24

您可以先看看您的GPIO口是否完成了初始化,看看是否被其他地方所占用了
页: [1]
查看完整版本: imx6dl 复用IO配置为通用IO