I.MX8MN Cortex M7 SPI problem

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

I.MX8MN Cortex M7 SPI problem

Jump to solution
733 Views
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 Kudos
Reply
1 Solution
721 Views
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.

View solution in original post

0 Kudos
Reply
2 Replies
722 Views
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 Kudos
Reply
726 Views
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 Kudos
Reply