I.MX8MN Cortex M7 SPI problem

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

I.MX8MN Cortex M7 SPI problem

跳至解决方案
628 次查看
Joffrey
Contributor I

Hello,

I'm trying to control a SPI slave with the cortex m7 of the IMX8M Nano, but i can't get correct data from slave.
when i monitor MISO pin without slave connected  i see some signals and if i connect the MISO pin of  the slave the signal is under 1V.

SPI init:

ECSPI_MasterGetDefaultConfig(&masterConfig);
    masterConfig.baudRate_Bps = TRANSFER_BAUDRATE;
    masterConfig.rxFifoThreshold = 1;
    masterConfig.channelConfig.phase = kECSPI_ClockPhaseSecondEdge;
    masterConfig.channelConfig.channelMode = kECSPI_Master;

    ECSPI_MasterInit(ECSPI_MASTER_BASEADDR, &masterConfig, ECSPI_MASTER_CLK_FREQ);

 

Pin_mux:

    IOMUXC_SetPinMux(IOMUXC_ECSPI1_MISO_ECSPI1_MISO, 0U);
    IOMUXC_SetPinConfig(IOMUXC_ECSPI1_MISO_ECSPI1_MISO,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_HYS_MASK);
    IOMUXC_SetPinMux(IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI, 0U);
    IOMUXC_SetPinConfig(IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_HYS_MASK);
    IOMUXC_SetPinMux(IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK, 0U);
    IOMUXC_SetPinConfig(IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_HYS_MASK |
                        IOMUXC_SW_PAD_CTL_PAD_PE_MASK);
    IOMUXC_SetPinMux(IOMUXC_ECSPI1_SS0_ECSPI1_SS0, 0U);
    IOMUXC_SetPinConfig(IOMUXC_ECSPI1_SS0_ECSPI1_SS0,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_PUE_MASK |
                        IOMUXC_SW_PAD_CTL_PAD_HYS_MASK |
                        IOMUXC_SW_PAD_CTL_PAD_PE_MASK);
    IOMUXC_SetPinMux(IOMUXC_UART3_RXD_UART3_RX, 0U);
    IOMUXC_SetPinConfig(IOMUXC_UART3_RXD_UART3_RX,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_FSEL(2U));
    IOMUXC_SetPinMux(IOMUXC_UART3_TXD_UART3_TX, 0U);
    IOMUXC_SetPinConfig(IOMUXC_UART3_TXD_UART3_TX,
                        IOMUXC_SW_PAD_CTL_PAD_DSE(6U) |
                        IOMUXC_SW_PAD_CTL_PAD_FSEL(2U));

 

SPI transfer:

    ecspi_transfer_t masterXfer;
    masterXfer.txData   = txd;
    masterXfer.rxData   = rxd;
    masterXfer.dataSize = 6;
    masterXfer.channel  = kECSPI_Channel0;

    status_t error = ECSPI_MasterTransferBlocking(master_base_addr, &masterXfer);

 

Thanks

Regards

 

Joffrey

0 项奖励
回复
1 解答
616 次查看
Joffrey
Contributor I

Hello,

Yes i have tried the examples.

I have found 2 problems:

IN the imx8m nano from variscite, some slave are integrated to the som, i have put all chip select from other device (like touch screen and can) to VCC.
And when i put the chip select directly to the ground the communication is ok but when i use the chip select pin the slave doesn't work -> bad ground with prototype cable, after replacement of ground connection the transmission work.

Thanks

Regards,

Joffrey.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
617 次查看
Joffrey
Contributor I

Hello,

Yes i have tried the examples.

I have found 2 problems:

IN the imx8m nano from variscite, some slave are integrated to the som, i have put all chip select from other device (like touch screen and can) to VCC.
And when i put the chip select directly to the ground the communication is ok but when i use the chip select pin the slave doesn't work -> bad ground with prototype cable, after replacement of ground connection the transmission work.

Thanks

Regards,

Joffrey.

0 项奖励
回复
621 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Have you tried one of the ECSPI examples available in the i.MX SDK?
Also, from the description it seems that the slave is having some issue. Do you have any other SPI slaves to try with?

Best regards,
Aldo.

0 项奖励
回复