2 Replies Latest reply on Mar 7, 2017 3:11 AM by JoMe_264151

    SPI and arrays on the 5LP

      I'm doing a simple operation on the Cypress PSOC 5LP 59. It uses SPI to communicate with a Raspberry Pi which sends a bunch of letters, and the PSOC 5LP blinks a light after it receives a certain letter. The PSOC stores the entire array of letters.




      This does not work for some reason. It works if I use a buffer of 100 letters, and the A is the 95th letter or something. It works up to 400 letters or so (though it will be slightly sporadic sometimes.) But after that point, it won't work. For a buffer size of 1000, with the first A being at the 800th letter, the LED won't turn on. 




      The SAME code, works with the 4200 with a buffer of 2000. So why does it not work with the 5LP? Its max array size should definitely not be 400 or so. 

        • 1. Re: SPI and arrays on the 5LP

          As far as buffer size goes, the compiler will give you an error if your buffer is too large to fit in SRAM.


          This line might be causing you problems:


                      while(1u != SPIS_GetRxBufferSize()) // wait till byte is recived


          If you're running the SPI bus at high speeds, RxBufferSize could skip from zero to 2 before the polling loop has a chance to check that register. It would be safer to use "while (size() == 0)".

          • 2. Re: SPI and arrays on the 5LP

            Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
            Creator->File->Create Workspace Bundle (minimal)
            and attach the resulting file.


            As I see, your variable "i" is not incremented.