Question
firmware transfer problem in nfc st25dv with ftm protocol
Hi,
we have drive the st25dv64,it work fine,but when we use it transfer otafile to mcu use the st ftm protocol, it transefer ok in app,but we found that the FTM_FlushToFlash just call once in one segment(just write 512bytes in one segment transfer with 4951 bytes).
void FTM_FlushToFlash(uint8_t isLast)
{
uint8_t page_buffer[512];
uint32_t read_length = sizeof(page_buffer);
uint32_t write_length = read_length;
uint32_t flash_index;
if((current_command == FTM_FW_UPGRADE)
|| (current_command == FTM_SEND_PICTURE)
|| (current_command == FTM_SEND_DATA))
{
/* Get the offset of read data */
flash_index = ST25FTM_GetReadBufferOffset();
if(flash_index == 0)
{
/* If this is the first frame, removes command bytes */
uint8_t cmd;
ST25FTM_ReadBuffer(&cmd,1);
flash_index = ST25FTM_GetReadBufferOffset();
}
while(ST25FTM_ReadBuffer(page_buffer,read_length) == 0)
{
/* Flush as many data as possible */
APP_PRINTF("(ST25FTM_ReadBuffer(page_buffer,read_length) == 0)==\r\n");
Command_WriteBufferToFlash( 0, flash_index-1, page_buffer, write_length );
flash_index = ST25FTM_GetReadBufferOffset();
}
/* write the last incomplete page if the command ended */
if(isLast)
{
read_length = ST25FTM_GetAvailableDataLength();
write_length = read_length + ( (read_length % 8) ? 8 - (read_length % 8) : 0 );
memset(page_buffer, 0xFF, write_length);
ST25FTM_ReadBuffer(page_buffer,read_length);
Command_WriteBufferToFlash( 0, flash_index-1, page_buffer, write_length );
}
}
}
could you help on it.
the log is attached
