I hope all goes well for you.
We intend to use SPI 1 and SPI 2, both as masters, in the future, and as you know, if we use SPI2 we cannot use UART2 and UART 2 should change features, so I was wondering how to change the feature of UART to SPI. Is it listed in the device tree and do I need to change it there? Is there a tutorial you can recommend?
Thank you so much for your help.
Your intuition is correct that this is something that needs to be modified in the device tree.
In the lower level device tree there is a definition for
ecspi1: imx8mm.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
This definition is defined but unused in our device trees since as you noted we use the pins for UART2 instead by default.
You’ll need to extend this node to further enable and define this SPI interface. As a reference you can more or less copy what is used for SPI 1, which is defined by the node
ecspi2 here: imx8mm-verdin.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
One thing you’ll need to change of course is the pins. You’ll need to create a new pin group with the needed pins for this SPI interface. Again as a reference you can see how the pin control group for SPI 1 is defined: imx8mm-verdin.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
Finally you’ll of course need to disable UART 2 so the pins are not in conflict and only used for SPI 2. Just to clarify in the device tree Verdin UART 2 is defined by the node
uart3: imx8mm-verdin.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
Thank you so much for your help, I was really worried about it before and thanks for your time.
Is there any tutorial on how to use the SPI interface?
With Visual Studio, I plan to connect the DAC7760 to the Verdin board via SPI? Are there any resources available for SPI with VS?
Hi @Mehrdad, how are you?
You can find these sites useful:
For how to use and test SPI on TorizonCore How to use SPI on Torizon | Toradex Developer Center
For a general overview of the topic - SPI (Linux) | Toradex Developer Center
We also asked our team to update the page you link with a redirection to
How to use SPI on the table you posted here.
Hi @gclaudino.tx ,
With the tutorial for C# I can see the LED on the Verdin board is blinking with an easier GPIO and blink LED, I started with the easy one.
I appreciate you sharing that, and I was wondering how I could do it in C.
The tutorial below is super fast and I don’t know how he copied past gpiod.h
Any help you can give me would be greatly appreciated.
Hello @Mehrdad .
As this topic (change form UART to SPI) seems to be solved and your last question is about another topic (GPIO), could you please open a new thread with your question?
Sure, thank you so much, @josep.tx