8000 stm32/sdram: Add SDRAM power-down mode. · micropython/micropython@8ce2178 · GitHub
[go: up one dir, main page]

Skip to 8000 content

Commit 8ce2178

Browse files
committed
stm32/sdram: Add SDRAM power-down mode.
* Add power-down mode for maximum power saving while in standby mode. * Fix typo in comment.
1 parent 5873390 commit 8ce2178

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ports/stm32/sdram.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void sdram_init_seq(SDRAM_HandleTypeDef
259259

260260
void sdram_enter_low_power(void) {
261261
// Enter self-refresh mode.
262-
// In self-refresh mode the SDRAM retains data with external clocking.
262+
// In self-refresh mode the SDRAM retains data without external clocking.
263263
FMC_SDRAM_DEVICE->SDCMR |= (FMC_SDRAM_CMD_SELFREFRESH_MODE | // Command Mode
264264
FMC_SDRAM_CMD_TARGET_BANK | // Command Target
265265
(0 << 5U) | // Auto Refresh Number -1
@@ -276,6 +276,14 @@ void sdram_leave_low_power(void) {
276276
(0 << 9U)); // Mode Register Definition
277277
}
278278

279+
void sdram_enter_power_down(void) {
280+
// Enter power-down mode.
281+
FMC_SDRAM_DEVICE->SDCMR |= (FMC_SDRAM_CMD_POWERDOWN_MODE | // Command Mode
282+
FMC_SDRAM_CMD_TARGET_BANK | // Command Target
283+
(0 << 5U) | // Auto Refresh Number -1
284+
(0 << 9U)); // Mode Register Definition
285+
}
286+
279287
#if __GNUC__ >= 11
280288
// Prevent array bounds warnings when accessing SDRAM_START_ADDRESS as a memory pointer.
281289
#pragma GCC diagnostic push

ports/stm32/sdram.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ void *sdram_start(void);
1313
void *sdram_end(void);
1414
void sdram_enter_low_power(void);
1515
void sdram_leave_low_power(void);
16+
void sdram_enter_power_down(void);
1617
bool sdram_test(bool exhaustive);
1718
#endif // __SDRAM_H__

0 commit comments

Comments
 (0)
0