2021-01-27 11:48 PM
Hi, I have a design with STM32F407ZGT6, using lots of stuff - external SRAM, USB, SDIO, USARTs for MIDI in/out, etc. Also I use VBAT to maintain RTC and device settings while it is off.
First, I had a problem with high VBAT current (about 1mA) while the unit was Off. It was already described somewhere, the reason was floating PDR_ON pin (if you don't use PDR (power down regulator), it should be tied to 3.3V). So this problem was fixed.
But the problems with VBAT did not end on this. Now I discovered that while the device is On, VBAT current jumps up to about 100 microAmps as soon as SD Card is mounted (and SDIO bus is activated accordingly). 100 microAmps drain typical CR2032 battery (200 mAh) in about 80 days, which is not good.
After fooling around with the code, I found this piece in FatFS sources.
This is basically SDIO bus initialization sequence
/*!< Power ON Sequence -----------------------------------------------------*/
/*!< Configure the SDIO peripheral */
/*!< SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) */
/*!< on STM32F4xx devices, SDIOCLK is fixed to 48MHz */
/*!< SDIO_CK for initialization should not exceed 400 KHz */
SDIO_InitStructure.SDIO_ClockDiv = SDIO_INIT_CLK_DIV;
SDIO_InitStructure.SDIO_ClockEdge = SDIO_ClockEdge_Rising;
SDIO_InitStructure.SDIO_ClockBypass = SDIO_ClockBypass_Disable;
SDIO_InitStructure.SDIO_ClockPowerSave = SDIO_ClockPowerSave_Disable;
SDIO_InitStructure.SDIO_BusWide = SDIO_BusWide_1b;
SDIO_InitStructure.SDIO_HardwareFlowControl = SDIO_HardwareFlowControl_Disable;
SDIO_Init (&SDIO_InitStructure);
After I changed SDIO_ClockPowerSave from Disable to Enable, high current problem was almost solved. Almost. When reading/writing to SD Card, VBAT current still jumps to 100 microAmps (after the operation is complete, it goes back to 0). Not a big issue for a battery life, but anyway, I guess it is not the expected behavior? AFAIK, VBAT pin should draw around 1.5 microAmps only when the device is Off (to feed RTC and backup SRAM). While On, RTC and backup SRAM should be powered from VDD.
Did anyone else have this issue? (if you use VBAT and SDIO at the same time, as I do).
I wonder if it can be fixed in the code or is it some kind of hardware flaw in the chip.
2021-01-28 03:44 AM
Show relevant parts of your schematic, How are PC13-15 configured?
2021-02-01 07:01 AM
PC13 is not connected, PC14 and 15 are connected to RTC oscillator:
SD card is connected this way
SD_CMD - PD2
SD_CLK - PC12
SD_DAT0 - PC8
SD_DET - PG11 (card present, GPIO input)
SW_WP - PG13 (write protection, GPIO input)
I'm using STM32F407ZGT6 in LQFP144 package
2021-02-01 08:48 AM
Check (physically) all ground and VDD connections, especially VDDA/VSSA, and also PDR_ON.
JW