LPC804 not leaving while loop

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC804 not leaving while loop

跳至解决方案
588 次查看
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 项奖励
1 解答
571 次查看
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 项奖励
2 回复数
572 次查看
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 项奖励
567 次查看
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 项奖励