GPIO_SD_B1_04和GPIO_SD_B1_05配置为LPI2C1时无法运行初始化

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO_SD_B1_04和GPIO_SD_B1_05配置为LPI2C1时无法运行初始化

3,387 Views
milo_bai
Contributor II

我的项目使用MIMXRT1052CVJ5B,QSPI做XIP,当程序运行到LPI2C1初始化引脚时,程序跑飞。我的代码如下:具体运行到IOMUXC_SetPinMux(
IOMUXC_GPIO_SD_B1_05_LPI2C1_SDA, /* GPIO_SD_B1_05 is configured as LPI2C1_SDA */
1U);

这一句时,程序就跑飞。请问这是怎么回事?

IOMUXC_SetPinMux(
IOMUXC_GPIO_SD_B1_04_LPI2C1_SCL, /* GPIO_SD_B1_04 is configured as LPI2C1_SCL */
1U); /* Software Input On Field: Force input path of pad GPIO_SD_B1_04 */
IOMUXC_SetPinMux(
IOMUXC_GPIO_SD_B1_05_LPI2C1_SDA, /* GPIO_SD_B1_05 is configured as LPI2C1_SDA */
1U); /* Software Input On Field: Force input path of pad GPIO_SD_B1_05 */
IOMUXC_SetPinConfig(
IOMUXC_GPIO_SD_B1_04_LPI2C1_SCL, /* GPIO_SD_B1_04 PAD functional properties : */
0xD8B0U); /* Slew Rate Field: Slow Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Enabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 22K Ohm Pull Up
Hyst. Enable Field: Hysteresis Disabled */
IOMUXC_SetPinConfig(
IOMUXC_GPIO_SD_B1_05_LPI2C1_SDA, /* GPIO_SD_B1_05 PAD functional properties : */
0xD8B0U); /* Slew Rate Field: Slow Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Enabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 22K Ohm Pull Up

之后使用MIMXRT1050-EVK做了同样的实验,结果同样失败。

Labels (1)
0 Kudos
7 Replies

3,351 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Milo Bai

非常感谢使用NXP产品,很高兴为你提供技术支持!
首先,我想先了解一下你的项目电路板是如何连接外部QSPI flash的,是跟MIMXRT1050-EVK完全一样吗?方便的话,请分享一下这部分的电路图。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,351 Views
milo_bai
Contributor II

pastedImage_1.png

pastedImage_2.png

原理图如上,qspiflash的连接与GPIO_SD_B1_04(05)有关系吗?我看evk上是hyperflash用做dqs信号,可是在用qspiflash时用不到这个信号啊?那么在1052启动时应如何配置这个管脚?

0 Kudos

3,351 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Milo Bai

感谢回复。
在SDK library中, FlexSPI Configuration Block中的readSampleClkSrc被设置为3,而为了使得FlexSPI的运行时钟支持高频,需要保留并悬空FLEXSPI_A_DQS引脚,不然FlexSPI模块运行会出错。

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,339 Views
milo_bai
Contributor II

非常感谢你的回复。

我将I2C修改为GPIO_AD_B1_00和GPIO_AD_B1_01后可以初始化了,但是程序在flash中运行时发生无法写数据到eeprom的问题。读数据正常。写操作时序图如下图:在发送了从机地址后开始写数据时突然中断了。但是读操作时正常的。另外我用官方的EVK做了实验,可以对eeprom进行正常的读写操作,使用xip在hyperflash中运行代码。

微信图片_20200901160644.png

使用我自己的板卡,将代码放到ram中运行,则可以正常的读和写。

我不明白程序在QSPIFlash中运行,对I2C的读写操作有什么影响?

我的qspiflash设置如下:

const flexspi_nor_config_t qspiflash_config = {
    .memConfig =
        {
            .tag = FLEXSPI_CFG_BLK_TAG,
            .version = FLEXSPI_CFG_BLK_VERSION,
            .readSampleClksrc=kFlexSPIReadSampleClk_LoopbackFromDqsPad,
            .csHoldTime = 3u,
            .csSetupTime = 3u,
            // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock
			.deviceType = kFlexSpiDeviceType_SerialNOR,
            .sflashPadType = kSerialFlash_4Pads,
            .serialClkFreq = kFlexSpiSerialClk_100MHz,
            .sflashA1Size = 8u * 1024u * 1024u,
            .lookupTable =
                {
                    // Read LUTs
                    FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
                    FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
                 },
        },
    .pageSize = 256u,
    .sectorSize = 4u * 1024u,
    .blockSize = 256u * 1024u,
    .isUniformBlockSize = false,
};

 

0 Kudos

3,309 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Milo Bai

感谢回复。
我的建议使用逻辑分析仪抓取在QSPI和RAM中运行时,读写EEPROM的波形并比较两者有何不同,这样才可以对号入座找出问题所在。

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

3,238 Views
milo_bai
Contributor II

这是在QSPI中运行后,发送数据突然中断了,在ram中运行同样的代码则可以正常发送数据。无法理解

milo_bai_0-1603519972183.jpeg

 

0 Kudos

3,224 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
这现象比较奇怪,那在QSPI运行其他程序是否是正常?在debug在QSPI中运行的工程时,有出现代码卡在某个地方吗?
还有这个现象有在多块板子上复现吗?
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos