SPI communication in Raspberry Pi using CoDeSys

deeksha
2023-02-16
2023-02-17
  • deeksha - 2023-02-16

    Hi,

    I am using Raspberry pi in CoDeSys. I have connected Adruino to Raspberry pi through SPI pins where Adruino is sending data and Raspberry pi needs to receive that data which I am not able to get.
    Can someone please help me in understanding how to receive data over Raspberry pi in CoDeSys?
    I tried to use function:
    spiMaster.transfer(TXBUFF, RXBUFF, Len, Delay, Freq) but didn't work. I don't understand what the issue could be.
    I didn't find any description for the input arguments provided to above function. So, I declared these variables and used as input arguments.

    I am using Raspberry pi 4.
    I have used pins on Raspberry pi for SPI connections:
    MISO: GPIO 9
    MOSI: GPIO 10
    CLK: GPIO 11
    Chip enable CE1: GPIO 7
    Ground is common for both Raspberry pi and Adruino.

    I checked on Raspberry pi SPI pins too using oscilloscope, but it looks that Raspberry pi is not sending any data.
    So, I suspect that the function I am using is not correct.
    Anyone has any suggestion?

     
  • DavidBo - 2023-02-17

    Have you enabled SPI in Pi using raspi-config

     
    • deeksha - 2023-02-17

      Yes

       
  • eschwellinger

    eschwellinger - 2023-02-17

    reduce SPI Maxspeed in the CODESYS config.

     

Log in to post a comment.