Other Parts Discussed in Thread: HALCOGEN,
I am trying to use the eeprom emulation mode in bank 7. I modified the program block API to work with bank 7. Also added additional flash sectors to the flash_Sectors array so that firmware can pull it.
I try to erase address 0xF0201000 and am successful in doing so.
However when i try to write the write fails on check condition.
}
reg_ptr =(volatile uint32_t*) 0xfff87288;
*reg_ptr = 0x00000005;
*reg_ptr = 0x00040002;
*reg_ptr = 0x00000002;
status = Fapi_BlockProgram( FILE_BANK_LOCATION, write_address, (uint32_t)&file, sizeof(struct file_download_properties));
return status;
Blockprogram function looks something like this
register uint32_t src = Data_Start_Address;
register uint32_t dst = Flash_Start_Address;
register uint32_t bytes_remain = Size_In_Bytes;
uint8_t i, ucBank;
uint32_t status;
uint32_t bytes;
uint32_t Freq_In_MHz;
Freq_In_MHz = SYS_CLK_FREQ;
if (Size_In_Bytes < 16)
bytes = Size_In_Bytes;
else
bytes = 16;
for (i = 0; i < NUMBEROFSECTORS-1; i++){
if (Flash_Start_Address < (uint32_t)(flash_sector[i+1].start))
{
ucBank = flash_sector[i].bankNumber;
break;
}
}
if(( Flash_Start_Address == APP_START_ADDRESS ) || ( ucBank == 1 ) || ( Flash_Start_Address == 0 ) ||
(ucBank == 7)){
Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */
Fapi_setActiveFlashBank((Fapi_FlashBankType)ucBank);
if(Bank == 0) {
status= Fapi_enableMainBankSectors(0xFFFF); /* used for API 2.01*/
}
else {
status = Fapi_enableEepromBankSectors(0xFFFFFFFF,0xFFFFFFFF);
}
while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
while( FAPI_GET_FSM_STATUS != Fapi_Status_Success );
}
while( bytes_remain > 0)
{
Fapi_issueProgrammingCommand((uint32_t *)dst,
(uint8_t *)src,
(uint32_t) bytes,
0,
0,
Fapi_AutoEccGeneration);
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
src += bytes; //Size_In_Bytes;
dst += bytes; //Size_In_Bytes;
bytes_remain -= bytes; //Size_In_Bytes;
if ( bytes_remain < 16){
bytes = bytes_remain;
}
}
#ifdef DEBUG_MSG_L3
UART_putString(UART, "\r Programmed the flash: ");
UART_send32BitData(UART, Size_In_Bytes);
UART_putString(UART, " Bytes. \r ");
#endif
Fapi_flushPipeline();
status = Flash_Program_Check(Flash_Start_Address, Data_Start_Address, Size_In_Bytes);
return (status);
Any suggestions?