* UPDATE *
here is what i found. Whenever I had this function, it would not actually block the code. what to actually do is make the RTC I2C read function very slow to execute, but the code will work fine, but I had to wait a very long time to go through every time I read RTC. therefore, as a result, an alarm interrupt for RTC occurred, and this caused other I2C interactions inside the ISR, so it looks like he was trying to make two i2c connections at the same time, which slows down the process. I removed the features in the ISR, and now I'm working on continuing the investigation.
I am having this problem when programming the STM32F103 chip using IAR 5.40. I have this feature. If I try to print a local variable, it will cause the code to freeze at another point before it even gets into this function.
What could be the reason for this?
this is a function
u8 GSM_Telit_ReadSms( u8 bSmsIndex )
{
char bTmpSms[3] = { 0 };
itoa( bSmsIndex, bTmpSms, 10 );
printf("index = %s\n", bTmpSms);
GSM_Telit_RequestModem( "AT+CMGR=""1", 10, "CMGR", 5, 0 );
return 1;
}
I tried this too and it does not cause the lock I experienced
u8 GSM_Telit_ReadSms( u8 bSmsIndex )
{
char bTmpSms[3] = { 0 };
itoa( bSmsIndex, bTmpSms, 10 );
printf("index = 2\n");
GSM_Telit_RequestModem( "AT+CMGR=""1", 10, "CMGR", 5, 0 );
return 1;
}
There is no optimization, and the code gets stuck when trying to read a byte from my I2C ITC code, but as soon as I remove this printf("index = %s\n", bTmpSms);or use it instead printf("index = 2\n");, then everything will be happy. Any ideas ???
Edit: bSmsIndex will never be more than 30 in fact, and even then the lock happens wayyyy before calling this function.