The FIT flash module (for RX64M) produces the following output when trying to write a very large object in one go. (However, no error occurs when the writing is split into 64 byte blocks): Error: Memory @ 39c Error: Memory @ 39d Error: Memory @ 39e ... Even worse: It reports FLASH_SUCCESS even if it was unsuccessful. The test routine is as follows: #define MEM_BEGIN ((const uint8_t *)0x100000) #define MEM_SIZE 0x10000 #define FLASH_Erase(a, n) R_FLASH_Erase((flash_block_address_t)(a), (n)) #define FLASH_Write(src, dest, n) R_FLASH_Write((uint32_t)(src), (uint32_t)(dest), (n)) void FramTest(void) { /* Initialize FRAM */ static int block[64]; FLASH_Erase(MEM_BEGIN, 1024); memset(block, '\xAA', 64); for (unsigned i = 0; i 1024; i++) { FLASH_Write(block, MEM_BEGIN + i * 64, 64); } /* Fill FRAM with 0x55 0x55 ... 0x55 */ static uint8_t src[MEM_SIZE]; memset(src, '\x55', MEM_SIZE); FLASH_Erase(MEM_BEGIN, 1024); #if 1 if (FLASH_Write(src, MEM_BEGIN, MEM_SIZE) != FLASH_SUCCESS) { DBG_PRINTF0("Cannot write to memory!"); } #else for (unsigned i = 0; i 1024; i++) { if (FLASH_Write(src + i * 64, MEM_BEGIN + i * 64, 64) != FLASH_SUCCESS) { DBG_PRINTF0("Cannot write to memory!"); break; } } #endif /* Search for 0x55 0x55 ... 0x55 pattern */ for (int i = 0; i MEM_SIZE; i++) { if (MEM_BEGIN[i] != '\x55') { DBG_PRINTF1("Error: Memory @ %x", i); } } }
↧