AnsweredAssumed Answered

STM32Cube bug with FatFS

Question asked by Osto on Sep 18, 2015
Latest reply on Sep 22, 2015 by 68516
Hi ST,

When configuring  the FatFS in Platform settings, I can configure the pin for card detect function. When using this config, following code in generated:
uint8_t BSP_SD_IsDetected(void)
{
  __IO uint8_t status = SD_PRESENT;

  /* Check SD card detect pin */
  if (HAL_GPIO_ReadPin(SD_PORT,SD_PIN) == GPIO_PIN_RESET) {
    status = SD_NOT_PRESENT;
  }
  return status;
}


but this code is wrong because of wrong polarity. The CD pin of the socket (all I know) make a short to GND when card is inserted. So the function returns oposite status of the real situation.
Either the polarity have to be adjustable or the code snipet have to be reversed.

Thanks,
Osto

Outcomes