cancel
Showing results for 
Search instead for 
Did you mean: 

firmware transfer problem in nfc st25dv with ftm protocol

testtest
Associate

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

 

1 REPLY 1
Cedric Dalban
ST Employee

Hello testtest,

some few first comments.

At first sight in your traces, your driver receives indeed all packets (~248 bytes each) and tries to flush the completed segment (4951bytes) in flash, but only the first packet is processed.

The FTM driver you are currently using seems a bit old. A new version embedding bug fixes and easing the porting in an application has been introduced in the newest version of ST25DV002 package (https://www.st.com/en/embedded-software/stsw-st25dv002.html). Could you please try this newest version and provide the related traces.

Could you please provide the callback being used by your driver when a new Segment is received ?

Could you please specify on which board you are running the test ? Is it and DV-Disco or your own board ? 

In your message it is not clear which device (ST25DV04K, DV16K, DV04KC, DV16KC, ...), you are currently using, could you please provide the ICRef of the tag ?

BR,

Cedric