M module-bsp/board/rt1051/bellpx/CMakeLists.txt => module-bsp/board/rt1051/bellpx/CMakeLists.txt +2 -0
@@ 30,10 30,12 @@ target_sources(
irq_gpio.cpp
pin_mux.c
board.cpp
+ brownout.cpp
PUBLIC
eink-config.h
board/pin_mux.h
board/clock_config.h
board/irq_gpio.hpp
+ board/brownout.hpp
)
A module-bsp/board/rt1051/bellpx/board/brownout.hpp => module-bsp/board/rt1051/bellpx/board/brownout.hpp +8 -0
@@ 0,0 1,8 @@
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+namespace bsp
+{
+ void Brownout_init(void);
+}
A module-bsp/board/rt1051/bellpx/brownout.cpp => module-bsp/board/rt1051/bellpx/brownout.cpp +33 -0
@@ 0,0 1,33 @@
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#include <cstdint>
+#include <fsl_common.h>
+#include <fsl_pmu.h>
+
+namespace bsp
+{
+ namespace
+ {
+ constexpr std::uint32_t OutputVoltage1P1 = 0x19; // 1.275V
+ constexpr std::uint32_t OutputVoltage2P5 = 0x1F; // 2.875V
+
+ constexpr std::uint32_t OffsetVoltage1P1 = 0x05; // 5*25mv
+ constexpr std::uint32_t OffsetVoltage2P5 = 0x03; // 3*25mv
+ } // namespace
+
+ void Brownout_init()
+ {
+ // Config LDO Regulatorsand config Brownout voltage offsets
+ PMU_1P1EnableBrownout(PMU, true);
+ PMU_1P1SetRegulatorOutputVoltage(PMU, OutputVoltage1P1);
+ PMU_1P1SetBrownoutOffsetVoltage(PMU, OffsetVoltage1P1);
+ PMU_1P1EnableOutput(PMU, true);
+
+ PMU_2P5nableBrownout(PMU, true);
+ PMU_2P5SetRegulatorOutputVoltage(PMU, OutputVoltage2P5);
+ PMU_2P5SetBrownoutOffsetVoltage(PMU, OffsetVoltage2P5);
+ PMU_2P5EnableOutput(PMU, true);
+ }
+
+} // namespace bsp
M module-bsp/board/rt1051/bellpx/bsp/lpm/RT1051LPM.cpp => module-bsp/board/rt1051/bellpx/bsp/lpm/RT1051LPM.cpp +14 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "RT1051LPM.hpp"
@@ 12,4 12,17 @@ namespace bsp
void RT1051LPM::DisableDcdcPowerSaveMode()
{}
+
+ void RT1051LPM::SwitchToRegularModeLDO()
+ {
+ RT1051LPMCommon::RegularLDOMode();
+ NVIC_ClearPendingIRQ(ANATOP_EVENT0_IRQn);
+ EnableIRQ(ANATOP_EVENT0_IRQn);
+ }
+
+ void RT1051LPM::SwitchToLowPowerModeLDO()
+ {
+ DisableIRQ(ANATOP_EVENT0_IRQn);
+ RT1051LPMCommon::LowPowerLDOMode();
+ }
} // namespace bsp
M module-bsp/board/rt1051/bellpx/bsp/lpm/RT1051LPM.hpp => module-bsp/board/rt1051/bellpx/bsp/lpm/RT1051LPM.hpp +4 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 11,6 11,9 @@ namespace bsp
public:
void EnableDcdcPowerSaveMode() final;
void DisableDcdcPowerSaveMode() final;
+
+ void SwitchToRegularModeLDO() final;
+ void SwitchToLowPowerModeLDO() final;
};
} // namespace bsp
M module-bsp/board/rt1051/bellpx/irq_gpio.cpp => module-bsp/board/rt1051/bellpx/irq_gpio.cpp +24 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "board/irq_gpio.hpp"
@@ 10,6 10,7 @@
#include "fsl_common.h"
#include <fsl_qtmr.h>
#include <fsl_gpc.h>
+#include <fsl_pmu.h>
#include "board/rt1051/bsp/eink/bsp_eink.h"
#include <hal/key_input/KeyInput.hpp>
@@ 71,6 72,10 @@ namespace bsp
NVIC_ClearPendingIRQ(RTWDOG_IRQn);
EnableIRQ(RTWDOG_IRQn);
+
+ // Enable PMU brownout interrupt
+ NVIC_ClearPendingIRQ(ANATOP_EVENT0_IRQn);
+ EnableIRQ(ANATOP_EVENT0_IRQn);
}
extern "C"
@@ 194,5 199,23 @@ namespace bsp
// Way to do it is via WDOG1 built-in assertion, RTWDOG does not provide it
WDOG1->WCR &= ~WDOG_WCR_WDA_MASK;
}
+
+ // Enable PMU brownout interrupt
+ void ANATOP_EVENT0_IRQHandler(void)
+ {
+ const uint32_t status = PMU_GetStatusFlags(PMU);
+
+ // If the PMU brownout detects to low voltage
+ // immediately reset the CPU using the WDOG_B pin
+ if (status & kPMU_1P1BrownoutOnOutput) {
+ WDOG1->WCR &= ~WDOG_WCR_WDA_MASK;
+ }
+
+ if (status & kPMU_2P5BrownoutOnOutput) {
+ WDOG1->WCR &= ~WDOG_WCR_WDA_MASK;
+ }
+
+ NVIC_ClearPendingIRQ(ANATOP_EVENT0_IRQn);
+ }
}
} // namespace bsp
M module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.cpp => module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.cpp +2 -2
@@ 175,7 175,7 @@ namespace bsp
DCDC->REG1 |= DCDC_REG1_REG_RLOAD_SW_MASK;
}
- void RT1051LPMCommon::SwitchToRegularModeLDO()
+ void RT1051LPMCommon::RegularLDOMode()
{
// Enable regular 2P5 and wait it stable
PMU->REG_2P5_SET = PMU_REG_2P5_ENABLE_LINREG_MASK;
@@ 191,7 191,7 @@ namespace bsp
PMU->REG_1P1_CLR = PMU_REG_1P1_ENABLE_WEAK_LINREG_MASK;
}
- void RT1051LPMCommon::SwitchToLowPowerModeLDO()
+ void RT1051LPMCommon::LowPowerLDOMode()
{
// Enable weak 2P5 and turn off regular 2P5
PMU->REG_2P5 |= PMU_REG_2P5_ENABLE_WEAK_LINREG_MASK;
M module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.hpp => module-bsp/board/rt1051/bsp/lpm/RT1051LPMCommon.hpp +3 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 23,8 23,8 @@ namespace bsp
void DisconnectInternalLoadResistor() final;
void ConnectInternalLoadResistor() final;
- void SwitchToRegularModeLDO() final;
- void SwitchToLowPowerModeLDO() final;
+ void RegularLDOMode();
+ void LowPowerLDOMode();
private:
CpuFrequencyMHz onChangeUp(CpuFrequencyMHz freq, CpuFrequencyMHz newFrequency);
M module-bsp/board/rt1051/common/board.cpp => module-bsp/board/rt1051/common/board.cpp +2 -0
@@ 17,6 17,7 @@ extern "C"
}
#include "chip.hpp"
#include "board/irq_gpio.hpp"
+#include "board/brownout.hpp"
#include <board/debug_console.hpp>
#include <cstdint>
@@ 167,6 168,7 @@ namespace bsp
board::initDebugConsole();
+ Brownout_init();
irq_gpio_Init();
// SNVS init. is required for proper operation of the RTC when Secure Boot is used
M module-bsp/board/rt1051/puretx/CMakeLists.txt => module-bsp/board/rt1051/puretx/CMakeLists.txt +2 -0
@@ 26,12 26,14 @@ target_sources(
irq_gpio.cpp
debug_console.cpp
board.cpp
+ brownout.cpp
PUBLIC
eink-config.h
board/pin_mux.h
board/clock_config.h
board/irq_gpio.hpp
+ board/brownout.hpp
board/BoardDefinitions.hpp
)
A module-bsp/board/rt1051/puretx/board/brownout.hpp => module-bsp/board/rt1051/puretx/board/brownout.hpp +8 -0
@@ 0,0 1,8 @@
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+namespace bsp
+{
+ void Brownout_init(void);
+}
A module-bsp/board/rt1051/puretx/brownout.cpp => module-bsp/board/rt1051/puretx/brownout.cpp +8 -0
@@ 0,0 1,8 @@
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+namespace bsp
+{
+ void Brownout_init()
+ {}
+} // namespace bsp
M module-bsp/board/rt1051/puretx/bsp/lpm/RT1051LPM.cpp => module-bsp/board/rt1051/puretx/bsp/lpm/RT1051LPM.cpp +11 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "RT1051LPM.hpp"
@@ 43,4 43,14 @@ namespace bsp
gpio_2->WritePin(static_cast<uint32_t>(BoardDefinitions::DCDC_INVERTER_MODE_PIN), 1);
}
+ void RT1051LPM::SwitchToRegularModeLDO()
+ {
+ RT1051LPMCommon::RegularLDOMode();
+ }
+
+ void RT1051LPM::SwitchToLowPowerModeLDO()
+ {
+ RT1051LPMCommon::LowPowerLDOMode();
+ }
+
} // namespace bsp
M module-bsp/board/rt1051/puretx/bsp/lpm/RT1051LPM.hpp => module-bsp/board/rt1051/puretx/bsp/lpm/RT1051LPM.hpp +4 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 14,6 14,9 @@ namespace bsp
void EnableDcdcPowerSaveMode() final;
void DisableDcdcPowerSaveMode() final;
+ void SwitchToRegularModeLDO() final;
+ void SwitchToLowPowerModeLDO() final;
+
private:
std::shared_ptr<drivers::DriverGPIO> gpio_1;
std::shared_ptr<drivers::DriverGPIO> gpio_2;
M products/BellHybrid/BinaryAssetsVersions.cmake => products/BellHybrid/BinaryAssetsVersions.cmake +1 -1
@@ 1,7 1,7 @@
# This file sets versions of downloaded binaries for release packaging purposes
if( NOT DEFINED ECOBOOT_BIN_VERSION)
- set(ECOBOOT_BIN_VERSION 2.0.0 CACHE STRING "bootloader binary version to download from bootloader release page")
+ set(ECOBOOT_BIN_VERSION 2.0.2 CACHE STRING "bootloader binary version to download from bootloader release page")
endif()
if (NOT DEFINED RECOVERY_BIN_VERSION)