From 2be699c327b9cefe304f381c46b69b29b89d108f Mon Sep 17 00:00:00 2001 From: Patrick Siegl <3261314+psiegl@users.noreply.github.com> Date: Sun, 23 Feb 2025 22:10:05 +0100 Subject: [PATCH] Fix PWR issues when booting up on RPI I noticed quite often, that a RPI is dying multiple times (red LED), whenever it hits this code. It seems, that due to the fact that the PWR PIN is up, and while trying to set default values for the other PINs, this creates a lot of issues. To the extend that the RPI turns off. Thus, first turn off PWR before setting GPIO default values. --- .../RaspberryPi/c/lib/Config/DEV_Config.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/c/lib/Config/DEV_Config.c b/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/c/lib/Config/DEV_Config.c index a6f6c35b..5f04fd83 100644 --- a/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/c/lib/Config/DEV_Config.c +++ b/E-paper_Separate_Program/13.3inch_e-Paper_E/RaspberryPi/c/lib/Config/DEV_Config.c @@ -184,23 +184,25 @@ function: Initialization pin ******************************************************************************/ static void DEV_GPIOConfig(void) { - DEV_GPIO_Mode(EPD_SCK_PIN, 1); + DEV_GPIO_Mode(EPD_PWR_PIN, 1); // handle PWR pin first + DEV_Digital_Write(EPD_PWR_PIN, 0); // power off HAT+ before resetting values + + DEV_GPIO_Mode(EPD_SCK_PIN, 1); DEV_GPIO_Mode(EPD_SI0_PIN, 1); DEV_GPIO_Mode(EPD_CS_M_PIN, 1); DEV_GPIO_Mode(EPD_CS_S_PIN, 1); DEV_GPIO_Mode(EPD_DC_PIN, 1); DEV_GPIO_Mode(EPD_RST_PIN, 1); DEV_GPIO_Mode(EPD_BUSY_PIN, 0); - DEV_GPIO_Mode(EPD_PWR_PIN, 1); DEV_Digital_Write(EPD_SCK_PIN, 0); DEV_Digital_Write(EPD_SI0_PIN, 0); - DEV_Digital_Write(EPD_CS_M_PIN, 0); - DEV_Digital_Write(EPD_CS_S_PIN, 0); + DEV_Digital_Write(EPD_CS_M_PIN, 1); // CS is low active, thus high + DEV_Digital_Write(EPD_CS_S_PIN, 1); // same applies DEV_Digital_Write(EPD_DC_PIN, 0); DEV_Digital_Write(EPD_RST_PIN, 0); // DEV_Digital_Write(EPD_BUSY_PIN, 0); - DEV_Digital_Write(EPD_PWR_PIN, 1); + DEV_Digital_Write(EPD_PWR_PIN, 1); // turn power on } /******************************************************************************