Burst on ECSPI2 on i.MX8M Mini EVK

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

Burst on ECSPI2 on i.MX8M Mini EVK

995 Views
frk
Contributor III

Hello,

I'm trying to use ecspi2 on the i.MX8M Mini EVK using spidev.

I've followed the hint of the following topic to set spidev :

https://community.nxp.com/thread/502230

My main question is the following one :

Why the chip select toggle between each byte sent whereas I send 255 byte each time?

I use the following simple code :

static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
{
    int ret;
    struct spi_ioc_transfer tr = {
        .tx_buf = (unsigned long)tx,
        .rx_buf = (unsigned long)rx,
        .len = len,
        .delay_usecs = delay,
        .speed_hz = speed,
        .bits_per_word = bits,
    };

    ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
    if (ret < 1)
        pabort("can't send spi message");
}

...

uint8_t default_tx[255] ;
uint8_t default_rx[ARRAY_SIZE(default_tx)] = { 0, };

for (i = 0; i < SIZESPI; i++)
            default_tx[i] = i;
transfer(fd, default_tx, default_rx, sizeof(default_tx));

Using a scope, I see that the chip select timing is pretty strict but its value change 255 times.

Best regards,

Frederic

Labels (1)
Tags (2)
0 Kudos
3 Replies

794 Views
igorpadykov
NXP Employee
NXP Employee

Hi Frederic

one can check parameter BURST_LENGTH in ECSPIx_CONREG register

described in sect.10.1.5.3 Control Register (ECSPIx_CONREG)

i.MX 8M Mini Applications Processor Reference Manual

Also one can find ecspi examples with burst=8 in SDK_EVK-MIMX8M Mini

available on Welcome | MCUXpresso SDK Builder 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

794 Views
frk
Contributor III

Thanks for this quick reply.

Do you know where the ECSPIx_CONREG register can be found in Linux kernel?

Best regards,

Frederic.

0 Kudos

794 Views
igorpadykov
NXP Employee
NXP Employee

ecspi registers can be found in Chapter 2 Memory Map  Reference Manual

memtool can be used for reading registers

memtool\test - imx-test - i.MX Driver Test Application Software 

Best regards
igor

0 Kudos