Hello all,
I am trying to initiate SPI communication with a LS3667R buffer board (https://lsicsi.com/datasheets/LS7366R.pdf). Following suggestions for my previous post (https://forge.codesys.com/forge/talk/Runtime/thread/80ca780e26/?limit=25#7ed3/bb06), I decided to execute SPI communication directly in my PLC_PRG with a call to a "read" and "write" method; these methods in turn (ideally) start SPI communication using
(SPI is enabled on the RPi)
I took a look at that link and gave it a try, creating a class that extended SPI.
It seems that CODESYS wants BeforeWriteOutputs, AfterReadInputs, and Initialize to be overloaded with a call to SUPER. Wouldn't that mean I'd also have to write the .xml file? Is there any way to get around this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
check this example here:
c:\Users\yourWindowsUsername\CODESYS Control for Raspberry PI\4.1.0.0\Examples\PiFace_FB.project
this example should show how TO use a SPI device from your project without having a library.
Do not forget to reduce SPI diMaxSpeed,
this leads sometimes to problems.
Hello all,
I am trying to initiate SPI communication with a LS3667R buffer board (https://lsicsi.com/datasheets/LS7366R.pdf). Following suggestions for my previous post (https://forge.codesys.com/forge/talk/Runtime/thread/80ca780e26/?limit=25#7ed3/bb06), I decided to execute SPI communication directly in my PLC_PRG with a call to a "read" and "write" method; these methods in turn (ideally) start SPI communication using
SPI_master.transferExt(pabyTxBuffer, pabyRxBuffer, udiLen, uiDelayus, udiSpeedHz)
Putting a scope on the RPi4's MOSI and SCLK lines shows nothing. Am I way off in my approach?
maybe this topic provides you some extra help?
https://forge.codesys.com/forge/talk/Runtime/thread/81d88db728/#8322
plus don't forget to enable SPI interface via sudo raspi-config but you have probably done this ;-)
Last edit: hermsen 2021-08-24
(SPI is enabled on the RPi)
I took a look at that link and gave it a try, creating a class that extended SPI.
It seems that CODESYS wants BeforeWriteOutputs, AfterReadInputs, and Initialize to be overloaded with a call to SUPER. Wouldn't that mean I'd also have to write the .xml file? Is there any way to get around this?
Hi,
check this example here:
c:\Users\yourWindowsUsername\CODESYS Control for Raspberry PI\4.1.0.0\Examples\PiFace_FB.project
this example should show how TO use a SPI device from your project without having a library.
Do not forget to reduce SPI diMaxSpeed,
this leads sometimes to problems.
Last edit: eschwellinger 2021-08-26
I'd like to ask about that last part. Why do we specify speed in the SPI_master options when we have to specify it anyway when we call .transferExt?