Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
Hi all,
I want to write my own SPI driver on CODESYS to interface with my STM32 custom board. I spend some time reading example libraries ( Adafruit_PWM, MCP23S17 ....), Here is my doubts.
1. What is _iState? "_iState := 10;, _iState := 1000;", Where are the numbers "10,1000" come from? What do they mean?, How many states does CODESYS support?
2. When will AfterReadInputs and BeforeWriteOuputs be called? Do they call in sequence?
3. What happen if I use more than 1 driver on the same SPI driver? Which driver will be called first?
4. What are the essential configs I need to do in Initialize Method?
5. Is there any official document talking clearly about writing a lib on CODESYS?
Last edit: huunghiaubot 2022-07-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your support!
Now I created a driver and add it under SPI Master.
Is it possible to use SPI out of SPI master in the root tree project? My idea is creating devices which can add like EtherCAT or profibus but using SPI protocol.
Last edit: huunghiaubot 2022-08-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I want to write my own SPI driver on CODESYS to interface with my STM32 custom board. I spend some time reading example libraries ( Adafruit_PWM, MCP23S17 ....), Here is my doubts.
1. What is _iState? "_iState := 10;, _iState := 1000;", Where are the numbers "10,1000" come from? What do they mean?, How many states does CODESYS support?
2. When will AfterReadInputs and BeforeWriteOuputs be called? Do they call in sequence?
3. What happen if I use more than 1 driver on the same SPI driver? Which driver will be called first?
4. What are the essential configs I need to do in Initialize Method?
5. Is there any official document talking clearly about writing a lib on CODESYS?
Last edit: huunghiaubot 2022-07-07
start here:
https://forge.codesys.com/drv/io-drivers/doc/Generic/
https://forge.codesys.com/drv/io-drivers/doc/SPI/
Last edit: eschwellinger 2022-07-07
Thanks for your support!
Now I created a driver and add it under SPI Master.
Is it possible to use SPI out of SPI master in the root tree project? My idea is creating devices which can add like EtherCAT or profibus but using SPI protocol.
Last edit: huunghiaubot 2022-08-04