<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Zdravim,<div class="">byl jsem okolnostmi donucen zacit delat s STM32L a mam problem se STOP modem. Za zadnou cenu nemohu dosahnout deklarovane spotreby v tomto modu. Ve STANDBY modu je spotreba spravna okolo nekolika uA, ale v STOP modu o mnoho vyssi nez by mela - okolo 200uA. Zkousim na NUCLEO L152RE. Odstranil jsem i externi pull-up z modreho tlacitka. Jiny tam snad uz neni (uz si nejsem nicim jisty). Mam aktivni pouze UART2 a PC0-OUT bez pul-up/down. Vse ostatni v analogovem modu. Zkousel jsem i nastavit hodiny pouze na MSI a ostanti hodiny vypnout, ale pod 200uA se stejne nedostanu. Zkousel jsem i vypnout hodiny pro vsechny GPIO (<span style="font-family: 'Courier New'; font-size: 10px;" class="">__GPIOD_CLK_DISABLE()</span>) ale take bez uspechu.</div><div class=""><br class=""></div><div class="">Dokumentace je prachbidna nebo nevim kde hledat. Podle toho co jsem nasel v datasheetu, specifikaci HALu a apnotes ci v par dostupnych poznamkach na netu by melo byt vse spravne, ale nekde delam zrejme chybu. </div><div class=""><br class=""></div><div class="">Za kazde nakopnuti spravnym smerem budu neskonale vdecny jelikoz se s tim trapim uz vice nez tyden do hlubokych noci az ran a zatim bez zadneho uspechu. Proste se uz tocim jen dokola.</div><div class=""><br class=""></div><div class="">Zde je priklad meho prechodu do stop modu:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">...</b></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><div style="margin: 0px; line-height: normal;" class=""><b class="">HAL_RTCEx_SetWakeUpTimer_IT</b>(&hrtc, stopTime, RTC_WAKEUPCLOCK_RTCCLK_DIV16);</div></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_SuspendTick</b><span style="color: #000000" class="">();</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class=""><span style="color: #793d93" class=""><b class="">HAL_PWR_EnterSTOPMode</b></span>(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">SystemClock_Config();</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_ResumeTick</b><span style="color: #000000" class="">();</span></div></div><div class="">...</div><div class=""><br class=""></div><div class="">Jedna z konfiguraci hodin:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class=""><span style="color: #006141" class="">RCC_OscInitTypeDef</span> RCC_OscInitStruct;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class=""><span style="color: #006141" class="">RCC_ClkInitTypeDef</span> RCC_ClkInitStruct;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(0, 97, 65);" class="">RCC_PeriphCLKInitTypeDef<span style="color: #000000" class=""> PeriphClkInit;</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(78, 144, 114);" class="">/* Enable <span style="text-decoration: underline" class="">Ultra</span> low power mode */</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_PWREx_EnableUltraLowPower</b><span style="color: #000000" class="">();</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(78, 144, 114);" class="">/* Enable the fast wake up from <span style="text-decoration: underline" class="">Ultra</span> low power mode */</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(78, 144, 114);" class="">//HAL_PWREx_EnableFastWakeUp();</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">__PWR_CLK_ENABLE();</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">OscillatorType</span> = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">LSEState</span> = RCC_LSE_ON;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">HSIState</span> = RCC_HSI_ON;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">HSICalibrationValue</span> = 16;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">LSIState</span> = RCC_LSI_ON;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">PLL</span>.<span style="color: #0326cc" class="">PLLState</span> = RCC_PLL_ON;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">PLL</span>.<span style="color: #0326cc" class="">PLLSource</span> = RCC_PLLSOURCE_HSI;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">PLL</span>.<span style="color: #0326cc" class="">PLLMUL</span> = RCC_PLL_MUL3;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_OscInitStruct.<span style="color: #0326cc" class="">PLL</span>.<span style="color: #0326cc" class="">PLLDIV</span> = RCC_PLL_DIV4;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class=""><span style="color: #793d93" class=""><b class="">HAL_RCC_OscConfig</b></span>(&RCC_OscInitStruct);</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_ClkInitStruct.<span style="color: #0326cc" class="">ClockType</span> = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_ClkInitStruct.<span style="color: #0326cc" class="">SYSCLKSource</span> = RCC_SYSCLKSOURCE_PLLCLK;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_ClkInitStruct.<span style="color: #0326cc" class="">AHBCLKDivider</span> = RCC_SYSCLK_DIV4;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_ClkInitStruct.<span style="color: #0326cc" class="">APB1CLKDivider</span> = RCC_HCLK_DIV1;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">RCC_ClkInitStruct.<span style="color: #0326cc" class="">APB2CLKDivider</span> = RCC_HCLK_DIV1;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class=""><span style="color: #793d93" class=""><b class="">HAL_RCC_ClockConfig</b></span>(&RCC_ClkInitStruct, FLASH_LATENCY_0);</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">PeriphClkInit.<span style="color: #0326cc" class="">PeriphClockSelection</span> = RCC_PERIPHCLK_RTC;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New';" class="">PeriphClkInit.<span style="color: #0326cc" class="">RTCClockSelection</span> = RCC_RTCCLKSOURCE_LSE;</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_RCCEx_PeriphCLKConfig</b><span style="color: #000000" class="">(&PeriphClkInit);</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(78, 144, 114);" class="">//HAL_RCCEx_EnableLSECSS();</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_SYSTICK_Config</b><span style="color: #000000" class="">(</span><b class="">HAL_RCC_GetHCLKFreq</b><span style="color: #000000" class="">() / 1000);</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_SYSTICK_CLKSourceConfig</b><span style="color: #000000" class="">(SYSTICK_CLKSOURCE_HCLK);</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(78, 144, 114);" class="">/* SysTick_IRQn interrupt configuration */</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: 'Courier New'; color: rgb(121, 61, 147);" class=""><b class="">HAL_NVIC_SetPriority</b><span style="color: #000000" class="">(</span><span style="color: #0326cc" class=""><i class="">SysTick_IRQn</i></span><span style="color: #000000" class="">, 0, 0);</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Turby</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>