Other Parts Discussed in Thread: HALCOGEN
Hello,
Here is exactly same problem without solution
https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/323571?tisearch=e2e-quicksearch&keymatch=PGV
So I get same PGV & CSTAT bits as mark of an error.
Erase to bank 7 looks to work (does not return error, cannot say anything else since bank is already erased so data does not change).
Bank0 & 1 erase & write works so flashAPI usage logic should be ok.
According to SPNU501G.pdf chapter 5.3 the only difference in bank7 should be using the different "enable bank function".
But then I looked how FEE driver has done it, and was surprised that for write command the FlashAPI is not used, FlashAPI is used only for Erase operation... Why it would not use FlashAPI since for other operations it uses it?
About EWAIT: tried also that FlashAPI macro, same results (also no register changes), and system.c sets correct EWAIT value (3) (using halcogen generated files) so there should not be any reason to call that macro if understood correctly...
Also tried 'Fapi_DataOnly' and also tried to write 0xFF, 0xFF data and all these fails.
I am trying to write 0xF0200000 address, (verified this from R0 register inside ram-function) so that should be valid EEPROM address (sector 0)
=========== CODE ================
#define USED_EEPROM_SECTORS 0x1 // TRIED ALSO 0xFFFF
FAPI_RET_ON_ERROR( Fapi_initializeFlashBanks( HAL_u32SystemClockMHz() ) ); /* used for API Rev2.01 */
FAPI_RET_ON_ERROR( Fapi_enableEepromBankSectors( USED_EEPROM_SECTORS, 0U ) );
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
FSM_STATUS_RET_ON_ERROR( FAPI_GET_FSM_STATUS );
// this is in RAM
FAPI_RET_ON_ERROR( tFapi_Program( (uint32*)u32Dst, (uint8*)u32Src, (uint32)u32Bytes) );
where tFapi_Program-function is:
// This code needs to be in RAM
#pragma location = "RAMCODE"
static Fapi_StatusType tFapi_Program( uint32* pu32dst, uint8* pu8src, uint32 u32bytes )
{
FAPI_RET_ON_ERROR( Fapi_issueProgrammingCommand( pu32dst, pu8src, u32bytes, 0, 0, Fapi_AutoEccGeneration) );
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
FSM_STATUS_RET_ON_ERROR( FAPI_GET_FSM_STATUS ); ////// CODE GOES THIS FAR so API interface returns OK
return Fapi_Status_Success;
}
========= END OF CODE ==========
Also generic question about Fapi_issueProgrammingCommand(), if it used as Fap_AutoEccGeneration, can only say 5 bytes to be given to API and inside api that will be 'filled' to 8 bytes or do I need give 8/16/32 byte array into where I copy 5 byte payload (leave other fields any data I want say 0xFF) and give length as 8/16/32? Understood from 3.3.1 that most likely the autofill' is performed inside API (or least whole 8 bytes is automatically used in ECC calculation so only that 5 bytes can given to API meaning simultaneously that this residual data cannot be tried to write again since ECC has been already calculated over it.