I am working on developing code for products which will be using the SM470R1B1M-HT and I am using the TMS-FET470A256 development kit to get started with my code. The environment I am using is the IAR Embedded Workbench for ARM 6.10 Kickstart and I have downloaded the Flash API, "Flash API Modules: Version 0.36" and included its header files into my project. In order to use the functions such as, "Flash_Compact_B" outlined in the document F05a_api which was included in the "Flash API Modules: Version 0.36" download I inserted them into a source file in my project.
The problem I am having is that I can not seem to get any of the Flash API functions to work (or at least verify that they work). For instance, I am trying to use the "Flash_Compact_B" function and verify with its return value that using it was succesful. But when I try to run my program it will call the "Flash_Compact_B" function and it will start executing the code in that function. The "Flash_Compact_B" function at one point calls the "init_state_machine" function and it appears to execute at that code fine and then returns to the "Flash_Compact_B" function. A few more lines are executed and then the "Flash_Compact_B" function calls the "Flash_Track_Pulses_V" function. In the "Flash_Track_Pulses_V" function is where the program hangs. The program gets stuck in the "do-while" loop that checks the value of the variable, "state". The variable "state" being the value stored the the location cntl[WSMREG]. The problem is that cntl[WSMREG] never seems to be equal to CMPCT_PULSE_ACTIVE (or ERASE_PULSE_ACTIVE for that matter) and is so the code always forces the condition "state=0xffffffff". I have read the value of at different point throughout the codes execution and cntl[WSMREG] never seems to change. I have looked through the various header files and I can not find any indication as to what might cause the value at cntl[WSMREG] to change. So I'm stuck. Any ideas as to what my problem might be? Any help would be greatly appreciated. Below is the code which I think would be pertinent to this conversation.
In order to access the flash and use the Flash API functions I have done the following;
// Set the bits for the address of the flash (0x00008000)
MFBALR0 |= ( 1 << BIT15 );
// Set memory block size to 1K
MFBALR0 |= ( 1 << BIT4);
// Documentation says "You must clear this bit to 0."
MFBALR0 &= ~( 1 << BIT3);
// Enable memory map select
MFBALR0 |= ( 1 << BIT8) ;
// Defining the inputs for the Flash_Compact_B function
volatile UINT32 fregbase = 0xffe88000;
volatile UINT32 *fcntl = &fregbase;
unsigned int fdelay = 7;
UINT32 fbase = 0x8000;
UINT32 *fstart = &fbase;
FLASH_STATUS_ST *fstat;
// Executing the Flash_Compact_B function and printing a character "Y" or "N" to determine if compaction was successful.
temp = Flash_Compact_B(fstart,
FLASH_CORE0,
FLASH_SECT0,
fdelay,
fcntl,
fstat
);
if (temp == 1)
{
PrintChar('Y');
}
else
{
PrintChar(N);
}
Thanks,
William