SPI and arrays on the 5LP

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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. 

0 Likes
2 Replies
Anonymous
Not applicable

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)".

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

Bob

0 Likes