cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407VET6 MicroSD initialization issue

jayanth0625
Associate

I am using STM32F407VE Black Board. It contains the STM32F407VET6 chip. It has a microSD slot but the slot's CD pin is not connected. Due to this f_mount() is always returning faults. I don't know if this hardware miss connection is the primary problem why f_mount() returns faults or there are more problems. Please help me out with this. I am stuck since 2-3 days. I tried modifying the dist_status and dist_initialize functions to bypass this hardware check but when I upload the code, the board does nothing for 20-30sec and f_mount again returns error. I have attached my code changes

DSTATUS disk_status (
	BYTE pdrv		/* Physical drive number to identify the drive */
)
{
//  DSTATUS stat;
//
//  stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]);
//  return stat;
	return 0x04;
}
// Inside diskio.h:
/* Disk Status Bits (DSTATUS) */

#define STA_NOINIT		0x01	/* Drive not initialized */
#define STA_NODISK		0x02	/* No medium in the drive */
#define STA_PROTECT		0x04	/* Write protected */

0x04 indicates write protected.  

DSTATUS disk_initialize (
	BYTE pdrv				/* Physical drive nmuber to identify the drive */
)
{
  DSTATUS stat = RES_OK;

  if(disk.is_initialized[pdrv] == 0)
  {
    stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);
    if(stat == RES_OK)
    {
      disk.is_initialized[pdrv] = 1;
    }
  }
  stat = 0x04;
  return stat;
//	return 0;
}

 

1 REPLY 1
AScha.3
Super User

What is the "slot's CD pin " ?   micro SD , see ->

AScha3_0-1749405252981.png

...and this is connection on F407VET black board :

AScha3_0-1749405991851.png

 

If you feel a post has answered your question, please click "Accept as Solution".