2017-12-11 12:32 AM
Posted on December 11, 2017 at 09:32
Im using SP1ML with the original firmware in standby mode. the unit is going in and out of standby mode using a Timer 7 (4s awake) and RTC (4s asleep)
I am getting the following current readings when toggling in and out of standby. Every now and again the unit draws 0.22mA as if a clock or IO did disable correctly. i.e toggling every 4s:
<0.01mA (standby), 13.9mA (awake), <0.01mA, 13.9mA, <0.01mA, 13.9mA, 0.19mA, 13.9mA, 0.2mA, 13.9mA, <0.01mA, 13.9mA, <0.01mA, 13.9mA,
0.2mA, 13.9mA, <0.01mA, 13.9mA,<0.01mA, 13.9mA,<0.01mA, 13.9mA,<0.01mA, 13.9mA, 0.2mA,<0.01mA, 13.9mA,<0.01mA, 13.9mA, etc etc
I disable all the clocks and peripherals I enabled.
then call
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
Any Ideas why it would have this irregular current events every few random seconds?
2017-12-11 04:29 AM
It would appear to have something to do with the I2C clocks and GPIO pins that is not disabling correctly. I have read somewhere the I2C does take some time to startup hence I have a small delay. Im wondering if the same applies for shutting it down. I have added the following code to the
void app_process_shutdown(void) function (original standby function firmware of ST for SP1ML)
RCC_APB1PeriphClockCmd(I2Cx_CLK, DISABLE); //I2C Periph clock enable
RCC_AHBPeriphClockCmd(I2Cx_SDA_GPIO_CLK, DISABLE); // SDA GPIO clock enable
RCC_AHBPeriphClockCmd(I2Cx_SCL_GPIO_CLK, DISABLE); //SCL GPIO clock enable
gpio_config(GPIOB, GPIO_Pin_6, GPIO_AN | GPIO_2MHZ); // I2C_SCL (NC)
gpio_config(GPIOB, GPIO_Pin_7, GPIO_AN | GPIO_2MHZ); // I2C_SDA (NC)
Is there anything else I need to force to shutdown on the I2C?