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?
plus don't forget to enable SPI interface via sudo raspi-config but you have probably done this ;-)
(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?
check this example here:
c:\Users\yourWindowsUsername\CODESYS Control for Raspberry PI\184.108.40.206\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.
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?
Log in to post a comment.