hello,
i'm working with msp430f5438A,
ccs 5.3 compiler version: 4.1
implement spi in UCB0.
my question is relating the spi.
i write to fram via spi communication.
For some unknown reason , in the following function , although that I reset the rx flag ( UCRXIFG) . the flag is not reset in the code (non-stop running), and the code reach the function :FramWrSingle() , when the RxFlag is still set.
But if I run the code step by step ( with debugger) or mount breakpoint before and after the while loop that reset the flag .
then the code work correct and the Rx flag is reset.
maybe it compiler problem, i'm not sure..
Is anyone have an idea what is the problem?
Thanks.
Asher.
-----the code
volatile Uint8 fakedata;
volatile Uint32 PcRegister;
#define CLEAR_SPI_RX_FLAGS() UCB0IFG &=~UCRXIFG;
Flag_t FrmFillData (FramAdrss_t StartAddress, Uint32 size, Uint8 Data)
{
unsigned long tmp = size;
Flag_t res = TRUE;
CLEAR_SPI_RX_FLAGS();
FramWrSingle(FRAM_WRITE);
FrmSetAddress ( (FramAdrss_t)StartAddress);// write setting: address & opcode
//FramWrBlock (&SrcBuff[0], TransSize ); // write block of data.
__delay_cycles(100);
while (tmp--)
{
while ((UCB0IFG&=UCRXIFG)!=0)
{
UCB0IFG = 0;
fakedata = UCB0RXBUF;
CLEAR_SPI_RX_FLAGS();
}
res = FramWrSingle( Data);
if (res == FALSE)
{
break;
}
}
return res;
}
Summary of flags set:
Compiler
-vmspx --abi=eabi --code_model=small --data_model=small -Ooff -g --include_path="C:/ti/ccsv5/ccs_base/msp430/include" --include_path="C:/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --include_path="../hal" --include_path="../hdr" --advice:power="all" --define=__MSP430F5438A__ --define=PD_EV_BRD --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40
Linker:
-vmspx --abi=eabi --code_model=small --data_model=small -Ooff -g --advice:power="all" --define=__MSP430F5438A__ --define=PD_EV_BRD --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 -z --stack_size=400 -m"BlkAtp.map" --heap_size=400 --use_hw_mpy=F5 -i"C:/ti/ccsv5/ccs_base/msp430/include" -i"C:/ti/ccsv5/tools/compiler/msp430_4.1.2/lib" -i"C:/ti/ccsv5/tools/compiler/msp430_4.1.2/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --rom_model