cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 SD card rcvr_datablock time

IlConte
Associate III

I have a application with STM32F429ZI and SD card withour RTOS.

I have a llong time for write in a SD card.

The rcvr_datablock routine is loong about 3 ms between set and reset LED !!!

It is possible to reduce this time using rot_rdq without use a RTOS ?

Thanks

/*-----------------------------------------------------------------------*/

/* Receive a data packet from the MMC                                   */

/*-----------------------------------------------------------------------*/

static

int rcvr_datablock (   /* 1:OK, 0:Error */

   BYTE *buff,         /* Data buffer */

   UINT btr         /* Data block length (byte) */

)

{

   BYTE token;

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);   // debugga LED AUX1

   SPI_Timer_On(200);

   do {                     /* Wait for DataStart token in timeout of 200ms */

      token = xchg_spi(0xFF);

      /* This loop will take a time. Insert rot_rdq() here for multitask envilonment. */

   } while ((token == 0xFF) && SPI_Timer_Status());

   if(token != 0xFE) return 0;      /* Function fails if invalid DataStart token or timeout */

   rcvr_spi_multi(buff, btr);      /* Store trailing data to the buffer */

   xchg_spi(0xFF); xchg_spi(0xFF);         /* Discard CRC */

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);   // debugga LED AUX1

   return 1;                  /* Function succeeded */

}

0 REPLIES 0