Alternate function woes...

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Alternate function woes...

跳至解决方案
1,075 次查看
nxp16
Contributor III

So, I took an example project, lpi2c_polling_b2b_master and built and flashed it.  If I connect a logic analyzer on the LPI2C1 SDA/SCL lines, I see proper signals/data coming out.  However, if I change out LPI2C1 for LPI2C3 on GPIO_SD_B0_00/01, I get  SCL always high, and SDA always low (and in case you're wondering, I tried this on two different boards, the EVK using an SD card breakout to access the pins, and a board from Embedded Artists using their test points for these pins).  I've been wrangling with this for 2 days now trying to figure out the proper pin mux settings (and also found that the config tool doesn't set DAISY at all nor SION properly based on all the googling I've done and docs I've read).  Here are the changes I made:

lpi2c_polling_b2b_master.c:

#define EXAMPLE_I2C_MASTER_BASE (LPI2C3_BASE)

pin_mux.c:

IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B0_01_LPI2C3_SDA,        /* GPIO_AD_B1_00 is configured as LPI2C1_SCL */
      1U);                                    /* Software Input On Field: Force input path of pad GPIO_AD_B1_00 */
IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B0_01_LPI2C3_SDA,        /* GPIO_AD_B1_01 is configured as LPI2C1_SDA */
      1U);                                    /* Software Input On Field: Force input path of pad GPIO_AD_B1_01 */

IOMUXC->SELECT_INPUT[kIOMUXC_LPI2C3_SDA_SELECT_INPUT] = 0b01; // see refman
IOMUXC->SELECT_INPUT[kIOMUXC_LPI2C3_SCL_SELECT_INPUT] = 0b01; // see refman

IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B0_00_LPI2C3_SCL,        /* GPIO_AD_B1_00 PAD functional properties : */ // d8b0
      0xd8b0);
IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B0_00_LPI2C3_SCL,        /* GPIO_AD_B1_01 PAD functional properties : */ // d8b0
      0xd8b0);

These are the only changes I made (and the only places I could find any reference to LPI2C in the example code).  What am I doing wrong?

Thanks,

-m

标签 (1)
0 项奖励
1 解答
961 次查看
mjbcswitzerland
Specialist V

Hi

You are only configuring the MUX setting for SDA and only configuring the PAD characteristics for SCL.

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

在原帖中查看解决方案

0 项奖励
4 回复数
962 次查看
mjbcswitzerland
Specialist V

Hi

You are only configuring the MUX setting for SDA and only configuring the PAD characteristics for SCL.

Regards

Mark

[uTasker project developer for Kinetis and i.MX RT]

0 项奖励
961 次查看
nxp16
Contributor III

Thanks, talk about a bad cut and paste job.  :-(

0 项奖励
961 次查看
nxp16
Contributor III

However, it still doesn't work even like this:

  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B0_00_LPI2C3_SCL,        /* GPIO_AD_B1_00 is configured as LPI2C1_SCL */
      1U);                                    /* Software Input On Field: Force input path of pad GPIO_AD_B1_00 */
  IOMUXC_SetPinMux(
      IOMUXC_GPIO_SD_B0_01_LPI2C3_SDA,        /* GPIO_AD_B1_01 is configured as LPI2C1_SDA */
      1U);                                    /* Software Input On Field: Force input path of pad GPIO_AD_B1_01 */

  IOMUXC->SELECT_INPUT[kIOMUXC_LPI2C3_SDA_SELECT_INPUT] = 0b01; // see refman
  IOMUXC->SELECT_INPUT[kIOMUXC_LPI2C3_SCL_SELECT_INPUT] = 0b01; // see refman

  IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B0_00_LPI2C3_SCL,        /* GPIO_AD_B1_00 PAD functional properties : */ // d8b0
      0xd8b0);
  IOMUXC_SetPinConfig(
      IOMUXC_GPIO_SD_B0_01_LPI2C3_SDA,        /* GPIO_AD_B1_01 PAD functional properties : */ // d8b0
      0xd8b0);
0 项奖励
961 次查看
nxp16
Contributor III

Actually, after so many permutations, I got it working with the above AND external pull-ups.  Now to see if I can get SPI working.

0 项奖励