BSP5 iMX8 SPI native chip-select

Hello,

I’m testing the HW interfaces of iMX8 after flashing the Yocto linux image with BSP5
I noticed in the device tree that the current SPI interfaces use GPIO chip-select instead of the native cs

By modifying it to use the native chip-select to avoid the delays that comes with GPIO cs, I got the following:

The chip select’s behaviour seem like the clock instead of being stable 0 during the transfer period.
does the native chip-select work properly in the current SPI driver of BSP5?

Best regards, Majd

HI @majd.m

Thanks for writing to the Toradex Community!

I noticed in the device tree that the current SPI interfaces use GPIO chip-select instead of the native cs

Yes, that’s true. If native chip select is used, then it will toggle after transfer of each byte, which is not good for the most spi chips, because it means end of the transfer. That’s why we use GPIO chip-select.

The chip select’s behaviour seem like the clock instead of being stable 0 during the transfer period

Are you sure you measuring the chipselect and not data out?

Does the native chip-select work properly in the current SPI driver of BSP5?

Yes, it works as described above.

Best regards,
Jaski

Hi @jaski.tx

Thank you for your answer. I made today SPI tests again, and noticed that SPI2 works properly when spi native chip select is used (in the test before there was a short between cs and clk as shown in picture above, sorry for that)
The new test:
[upload|LeNm8QYetOrB4LIRVe7EhGpiFZw=]

(yellow: SPI2_CS, blue: SPI2_CLK)

However the native chipselect for SPI1 toggles at each byte, although the device tree nodes for both SPIs are the same
and here is how it looks like:

[upload|m8URvFCLcoTbMFBU7LyhxvClm0Y=]

(red: SPI1_CS, green: SPI1_CLK)

is there anyway to make the cs in SPI1 like in SPI2 other than using GPIO cs?
(PS: with the default device tree the CS doesnt work automatically in both SPIs, where gpio cs is defined.
the only way to use gpio cs is to let a gpio manually go low and high in the program in every spi transfer)

HI @majd.m

You are welcome.

However the native chipselect for SPI1 toggles at each byte, although the device tree nodes for both SPIs are the same and here is how it looks like:

This is the usual behaviour defined by NXP when DMA on SPI is used.

is there anyway to make the cs in SPI1 like in SPI2 other than using GPIO cs?

Not that I know.

the only way to use gpio cs is to let a gpio manually go low and high in the program in every spi transfer)

Are you sure about this? The GPIO chipselect should work out of box.
Could you share your device-tree where it was not working?

Thanks and best regards,
Jaski

Are you sure about this? The GPIO chipselect should work out of box. Could you share your device-tree where it was not working?

Here is the device tree (the default one)
imx8qm-apalis-v1.1.dtsi

You are welcome. Is the issue now solved for you?

Best regards,
Jaski

yup thanks.

Hi @jaski.tx,

thanks for your answer. I added to spi nodes in the device tree the following:

dma-names=“no”,“no”;

then it worked that the chipselect stay always low during the spi transfer. Thanks for the hint regarding the DMA.

Best regards, Majd

Thanks for the feedback.