diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/out/TLSR_OpenEPaperLink.elf b/ARM_Tag_FW/OpenEPaperLink_TLSR/out/TLSR_OpenEPaperLink.elf new file mode 100644 index 00000000..2f093974 Binary files /dev/null and b/ARM_Tag_FW/OpenEPaperLink_TLSR/out/TLSR_OpenEPaperLink.elf differ diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/app_cfg.h b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/app_cfg.h index 91bf13dd..3a308913 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/app_cfg.h +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/app_cfg.h @@ -117,6 +117,33 @@ extern "C" EV_POLL_MAX, } ev_poll_e; +#define PA7_FUNC AS_GPIO +#define PD2_FUNC AS_GPIO +#define PD3_FUNC AS_GPIO + +#define PA0_FUNC AS_GPIO +#define PB1_FUNC AS_GPIO + +#define PD4_FUNC AS_GPIO +#define PD7_FUNC AS_GPIO +#define PA1_FUNC AS_GPIO +#define PB4_FUNC AS_GPIO +#define PB5_FUNC AS_GPIO +#define PB6_FUNC AS_GPIO +#define PC5_FUNC AS_GPIO + +#define PC0_FUNC AS_GPIO +#define PC1_FUNC AS_GPIO +#define PC6_FUNC AS_GPIO +#define PC4_FUNC AS_GPIO + +#define PULL_WAKEUP_SRC_PD4 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PD7 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PA1 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PB4 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PB5 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PB6 PM_PIN_PULLUP_1M +#define PULL_WAKEUP_SRC_PC5 PM_PIN_PULLUP_1M enum{ CLOCK_SYS_CLOCK_1S = CLOCK_SYS_CLOCK_HZ, CLOCK_SYS_CLOCK_1MS = (CLOCK_SYS_CLOCK_1S / 1000), diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/epd.c b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/epd.c index 95b59f97..964fceec 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/epd.c +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/epd.c @@ -28,8 +28,8 @@ const char *BLE_conn_string[] = {"", "B"}; RAM uint8_t epd_temperature_is_read = 0; RAM uint8_t epd_temperature = 0; -uint8_t epd_buffer[epd_buffer_size]; -uint8_t epd_temp[epd_buffer_size]; // for OneBitDisplay to draw into +uint8_t *epd_buffer = (uint8_t *)0x84C000; +uint8_t *epd_temp = (uint8_t *)(0x84C000 + epd_buffer_size); OBDISP obd; // virtual display structure // With this we can force a display if it wasnt detected correctly diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/main.c b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/main.c index 71e39619..795b3aec 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/main.c +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/main.c @@ -87,66 +87,71 @@ int main(void) { startup_state_e state = drv_platform_init(); u8 isRetention = (state == SYSTEM_DEEP_RETENTION) ? 1 : 0; - isRetention = 0; // keep the compiler happy - noApShown = false; drv_enable_irq(); init_led(); init_uart(); init_nfc(); - printf("\r\n\r\n\r\nSTARTING\r\n\r\n\r\n\r\n"); - - u32 flash_mid = 0; - u8 flash_uid[16] = {0}; - printf("Reading UID"); - int flag = flash_read_mid_uid_with_check(&flash_mid, flash_uid); - if (flag) - { - for (int i = 0; i < 16; i++) - { - printf(" %02X", flash_uid[i]); - } - printf("\r\n"); - for (int i = 0; i < 8; i++) - { - mSelfMac[i] = flash_uid[i + 8]; - } - } - else - { - printf(" - Failed!\r\n"); - } - - sprintf(ownMacString, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); - - batteryVoltage = get_battery_mv(); - - printf("Battery mv: %d Millis: %d\r\n", batteryVoltage, getMillis()); - - // epd_display("Boot", batteryVoltage, ownMacString, 1); - - initializeProto(); - - currentChannel = showChannelSelect(); + printf("\r\n\r\n\r\nSTARTING %02X\r\n\r\n\r\n\r\n", isRetention); wdt10s(); - - if (currentChannel) + if (isRetention == 0) { - our_ch = currentChannel; - printf("AP Found\r\n"); - epd_display("AP Found", batteryVoltage, ownMacString, 1); - initPowerSaving(INTERVAL_BASE); - doSleep(5000UL); + u32 flash_mid = 0; + u8 flash_uid[16] = {0}; + printf("Reading UID"); + int flag = flash_read_mid_uid_with_check(&flash_mid, flash_uid); + if (flag) + { + for (int i = 0; i < 16; i++) + { + printf(" %02X", flash_uid[i]); + } + printf("\r\n"); + for (int i = 0; i < 8; i++) + { + mSelfMac[i] = flash_uid[i + 8]; + } + } + else + { + printf(" - Failed!\r\n"); + } + + sprintf(ownMacString, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + + batteryVoltage = get_battery_mv(); + + printf("Battery mv: %d Millis: %d\r\n", batteryVoltage, getMillis()); + + // epd_display("Boot", batteryVoltage, ownMacString, 1); + + initializeProto(); + + currentChannel = showChannelSelect(); + + if (currentChannel) + { + our_ch = currentChannel; + printf("AP Found\r\n"); + epd_display("AP Found", batteryVoltage, ownMacString, 1); + initPowerSaving(INTERVAL_BASE); + doSleep(5000UL); + } + else + { + printf("No AP found\r\n"); + epd_display("No AP Found", batteryVoltage, ownMacString, 1); + initPowerSaving(INTERVAL_AT_MAX_ATTEMPTS); + noApShown = true; + doSleep(120000UL); + } } else { - printf("No AP found\r\n"); - epd_display("No AP Found", batteryVoltage, ownMacString, 1); - initPowerSaving(INTERVAL_AT_MAX_ATTEMPTS); - noApShown = true; - doSleep(120000UL); + printf("Saved Mac after reboot: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\r\n", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); } + while (1) { batteryVoltage = get_battery_mv(); diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/powermgt.c b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/powermgt.c index b738f790..9572627b 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/powermgt.c +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/powermgt.c @@ -53,9 +53,9 @@ void doSleepGpio(uint32_t t, GPIO_PinTypeDef pin) // WaitMs(2000); // return; uint32_t r = drv_disable_irq(); - pm_wakeup_pad_cfg(pin, !drv_gpio_read(pin), 1); + //pm_wakeup_pad_cfg(pin, !drv_gpio_read(pin), 1); drv_pm_longSleep(PM_SLEEP_MODE_SUSPEND, PM_WAKEUP_SRC_TIMER | PM_WAKEUP_SRC_PAD, t); - pm_wakeup_pad_cfg(pin, !drv_gpio_read(pin), 0); + //pm_wakeup_pad_cfg(pin, !drv_gpio_read(pin), 0); drv_restore_irq(r); uart_ndma_clear_tx_index(); // UART will be garbled otherwise } @@ -70,7 +70,7 @@ void doSleep(uint32_t t) // return; uint32_t r = drv_disable_irq(); pm_wakeup_pad_cfg(NFC_IRQ, PM_WAKEUP_LEVEL_LOW, 1); - drv_pm_longSleep(PM_SLEEP_MODE_SUSPEND, PM_WAKEUP_SRC_TIMER | PM_WAKEUP_SRC_PAD, t); + drv_pm_longSleep(PM_SLEEP_MODE_DEEP_WITH_RETENTION, PM_WAKEUP_SRC_TIMER | PM_WAKEUP_SRC_PAD, t); pm_wakeup_pad_cfg(NFC_IRQ, PM_WAKEUP_LEVEL_LOW, 0); drv_restore_irq(r); uart_ndma_clear_tx_index(); // UART will be garbled otherwise diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/uart.c b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/uart.c index 7674561e..7536ceb4 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/src/uart.c +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/src/uart.c @@ -22,6 +22,7 @@ void init_uart(void) dma_chn_irq_enable(0, 0); uart_irq_enable(0, 0); uart_ndma_irq_triglevel(0, 0); + uart_ndma_clear_tx_index(); // UART will be garbled otherwise } void puts(const char *str) diff --git a/ARM_Tag_FW/OpenEPaperLink_TLSR/tl_zigbee_sdk/platform/boot/8258/boot_8258.link b/ARM_Tag_FW/OpenEPaperLink_TLSR/tl_zigbee_sdk/platform/boot/8258/boot_8258.link index fd89300e..da78025a 100644 --- a/ARM_Tag_FW/OpenEPaperLink_TLSR/tl_zigbee_sdk/platform/boot/8258/boot_8258.link +++ b/ARM_Tag_FW/OpenEPaperLink_TLSR/tl_zigbee_sdk/platform/boot/8258/boot_8258.link @@ -94,7 +94,7 @@ SECTIONS } PROVIDE(_end_bss_ = .); - /* ASSERT((_end_bss_ < 0x848000), "RETENTION OVERFOLWN!!!!!") */ + ASSERT((_end_bss_ < 0x848000), "RETENTION OVERFOLWN!!!!!") . = (((. + 3) / 4)*4); PROVIDE(_custom_stored_ = _dstored_ + _end_data_ - _start_data_); diff --git a/binaries/Tag/TLSR_Gicisky_BWR_213_ALPHA.bin b/binaries/Tag/TLSR_Gicisky_BWR_213_ALPHA.bin index 4a52ef49..8d6920a5 100644 Binary files a/binaries/Tag/TLSR_Gicisky_BWR_213_ALPHA.bin and b/binaries/Tag/TLSR_Gicisky_BWR_213_ALPHA.bin differ diff --git a/binaries/Tag/TLSR_HS_BWR_266_ALPHA.bin b/binaries/Tag/TLSR_HS_BWR_266_ALPHA.bin index dd836cd2..d4dfa115 100644 Binary files a/binaries/Tag/TLSR_HS_BWR_266_ALPHA.bin and b/binaries/Tag/TLSR_HS_BWR_266_ALPHA.bin differ diff --git a/binaries/Tag/TLSR_HS_BWY_35_ALPHA.bin b/binaries/Tag/TLSR_HS_BWY_35_ALPHA.bin index a1ab0bf8..297ea657 100644 Binary files a/binaries/Tag/TLSR_HS_BWY_35_ALPHA.bin and b/binaries/Tag/TLSR_HS_BWY_35_ALPHA.bin differ diff --git a/binaries/Tag/TLSR_HS_BW_213_ALPHA.bin b/binaries/Tag/TLSR_HS_BW_213_ALPHA.bin index 653a9096..9d75cd07 100644 Binary files a/binaries/Tag/TLSR_HS_BW_213_ALPHA.bin and b/binaries/Tag/TLSR_HS_BW_213_ALPHA.bin differ