Burst on ECSPI2 on i.MX8M Mini EVK

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

Burst on ECSPI2 on i.MX8M Mini EVK

1,025 次查看
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

标签 (1)
标记 (2)
0 项奖励
3 回复数

824 次查看
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 项奖励

824 次查看
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 项奖励

824 次查看
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 项奖励