2016-11-25 07:20 AM
1.My code behaves in a strange way when using debugger. (CooCox IDE)(STM32F030C8)
If I step to each function , after stepping EE_Init() function the code seems to be stucked in a loop ;in disassembly view it executes the same instruction without going to the next one (ldr r3, [pc, #116]). Now if I put a breakpoint at another line after theEE_Init() function and run the code from the beginning up to that breakpoint without stepping through each function , the code reaches that breakpoint and it seems to run normally. It is strange for me because I have used Flash EEprom emulation before and I did not came across this. The code is more complex but due to strange behaviour I eliminated from it until I found what seems to be error source.
int
main(
void
)
{
__enable_irq();
u8 i=0;
adc_config();
FLASH_Unlock();
//Unlock the Flash Program Erase controller
EE_Init();
//FLASH_Lock();
#ifdef DEBUG072
DAC_Setup();
#endif
intern_ee_set_u16(UminThresholdAddress,16);
u16 temp=0;
temp=intern_ee_get_u16(UminThresholdAddress);
intern_ee_set_u16(UminThresholdAddress,4);
temp=intern_ee_get_u16(UminThresholdAddress);
temp=0;
while
(1)
{
if
(SW1Status==DISABLE)
{
SW2Status=3;
}
temp=intern_ee_get_u16(UminThresholdAddress);
if
(temp==4)
{
SW3Status=ENABLE;
}
else
{
SW3Status=DISABLE;
}
temp=0;
}
}