3 Replies Latest reply on May 6, 2019 11:19 PM by emho_296241

    Need help with PSOC 5LP SPI code please

    DaHu_285096

      I am having trouble with SPI routine in my code. This code was ported over from a STM32 to PSOC and is almost running but I am having trouble with the SPI (which is integral to the project). The 5LP connects to a Radio module and sends/receives data and commands via spi.

       

      It first sets spi to low rate to configure a couple of registers and then high rate. I have used DMA to get rid of inter-digit delays.

       

      There is a little routine called "TestSPI()" in main that I call from various points in the code to check the SPI is working correctly. It works perfectly fine and gives expected results until line 100 (A while loop reading status register).

       

      If I call TestSpi before this line it is fine, call it after line 100 and I get rubbish returned in TestSpi.

       

      If I put a 100ms delay after the while statement then I get correct results, but of course I am not able to delay the code here when the application is running.

       

      Thank you