LPC804 not leaving while loop

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC804 not leaving while loop

Jump to solution
564 Views
lennartpt
Contributor I

So I'm using an LPC804 with a slightly adjusted version of the SBL as of AN12378. The SBL executes correctly and switches to another Program. This program is basically used for IAP via SPI. 

However the slave never leaves the loop waiting for the finish of the Data Transfer. ALTHOUGH the loop condition is FALSE after the transmission finishes. I have actually no idea why the chip is behaving like this...

variable false.png

0 Kudos
1 Solution
547 Views
carstengroen
Senior Contributor II

The variable, slaveActive, I assume that is being set by an interrupt routine ?

Make sure that slaveActive is defined as being "volatile", otherwise the while loop will not read it from actual memory (but rather keep it in a register...)

 

View solution in original post

0 Kudos
2 Replies
548 Views
carstengroen
Senior Contributor II

The variable, slaveActive, I assume that is being set by an interrupt routine ?

Make sure that slaveActive is defined as being "volatile", otherwise the while loop will not read it from actual memory (but rather keep it in a register...)

 

0 Kudos
543 Views
lennartpt
Contributor I

Wow, I had many different problems besides this one, also tried using volatile before, but obviously not in the same constellation... and then such a simple change fixes all of my problems at once..

Thanks..

0 Kudos