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

cross mob
HossamAlzomor
Level 2
Level 2
First solution authored 5 replies posted 10 sign-ins

Hello,

I am using Cypress PSoC 5LP CY8C5888LT*-LP097  with PSOC 4.2

Flash used: 46204 of 262144 bytes (17.6%).

SRAM used: 60465 of 65536 bytes (92.3%). Stack: 2048 bytes. Heap: 2048 bytes.

When I enable speed optimization I get the following exception during runtime

pastedImage_0.png

I tried to Increase the Heap to 4K or 6 K but it dosn't help

How to overcome this problem?

Hossam Alzomor

0 Likes
1 Solution

Hossam Alzomor,

Nothing looks obvious however check your code for the following:

  • uint8 *rxdata points to an array of at least two bytes.  If you only have a variable with one byte the line dumping the incoming SPI data into rxdata[1] will overwrite unknown data. This unknown data could be stack or other RAM with pointer information.
  • You have a while statement that loops until at least one byte is available in the SPIM_1 Rx buffer.  You  might want to change the statement to: while(SPIM_1_GetRxBufferSize() <2);   Since the next three statements are assuming that at least two bytes are being read from the SPI, you might want to make sure at least two bytes have been received.  Your code only assumes one byte is available.

Hope this helps.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
5 Replies