From 55b254fdeca559622acf9610c50a4fbfee8ac259 Mon Sep 17 00:00:00 2001 From: jjwbruijn Date: Sat, 1 Apr 2023 17:06:26 +0200 Subject: [PATCH] basic improvements, XOR'D 0x55 before xmit --- zbs243_Tag_FW/syncedproto.c | 8 ++++---- zbs243_shared/soc/zbs243/uart.c | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) mode change 100644 => 100755 zbs243_Tag_FW/syncedproto.c diff --git a/zbs243_Tag_FW/syncedproto.c b/zbs243_Tag_FW/syncedproto.c old mode 100644 new mode 100755 index d6fb7cb0..b8056096 --- a/zbs243_Tag_FW/syncedproto.c +++ b/zbs243_Tag_FW/syncedproto.c @@ -569,7 +569,7 @@ static bool getDataBlock(const uint16_t blockSize) { pr("failed getting block\n"); return false; } - +uint16_t __xdata dataRequestSize = 0; static bool downloadFWUpdate(const struct AvailDataInfo *__xdata avail) { // check if we already started the transfer of this information & haven't completed it if (xMemEqual((const void *__xdata) & avail->dataVer, (const void *__xdata) & curDataInfo.dataVer, 8) && curDataInfo.dataSize) { @@ -585,7 +585,6 @@ static bool downloadFWUpdate(const struct AvailDataInfo *__xdata avail) { while (curDataInfo.dataSize) { wdt10s(); - static uint16_t __xdata dataRequestSize; if (curDataInfo.dataSize > BLOCK_DATA_SIZE) { // more than one block remaining dataRequestSize = BLOCK_DATA_SIZE; @@ -608,8 +607,10 @@ static bool downloadFWUpdate(const struct AvailDataInfo *__xdata avail) { // no more data, download complete return true; } + +uint16_t __xdata imageSize = 0; static bool downloadImageDataToEEPROM(const struct AvailDataInfo *__xdata avail) { - static uint16_t __xdata imageSize = 0; + // check if we already started the transfer of this information & haven't completed it if (xMemEqual((const void *__xdata) & avail->dataVer, (const void *__xdata) & curDataInfo.dataVer, 8) && curDataInfo.dataSize) { // looks like we did. We'll carry on where we left off. @@ -646,7 +647,6 @@ static bool downloadImageDataToEEPROM(const struct AvailDataInfo *__xdata avail) while (curDataInfo.dataSize) { wdt10s(); - static uint16_t __xdata dataRequestSize; if (curDataInfo.dataSize > BLOCK_DATA_SIZE) { // more than one block remaining dataRequestSize = BLOCK_DATA_SIZE; diff --git a/zbs243_shared/soc/zbs243/uart.c b/zbs243_shared/soc/zbs243/uart.c index 95ad84ee..0996566b 100755 --- a/zbs243_shared/soc/zbs243/uart.c +++ b/zbs243_shared/soc/zbs243/uart.c @@ -1,4 +1,5 @@ #include "uart.h" + #include "cpu.h" #ifdef AP_FW @@ -12,9 +13,10 @@ void uartInit(void) { // configure baud rate UARTBRGH = 0x00; #ifdef AP_FW - //UARTBRGL = 69; // nice. 230400 baud - UARTBRGL = 70; // 79 == 200k + // UARTBRGL = 69; // nice. 230400 baud + //UARTBRGL = 70; // 79 == 200k IEN_UART0 = 1; + UARTBRGL = 0x8A; // config for 115200 #else UARTBRGL = 0x8A; // config for 115200 #endif @@ -83,7 +85,7 @@ void UART_IRQ1(void) __interrupt(0) { if (UARTSTA & 1) { // RXC UARTSTA &= 0xfe; if (serialBypassActive) { - *blockp++ = UARTBUF; + *blockp++ = 0xAA ^ UARTBUF; if (blockp == (blockbuffer + 4100)) { serialBypassActive = false; blockp = blockbuffer; @@ -91,7 +93,7 @@ void UART_IRQ1(void) __interrupt(0) { } else { rxbuf[rxhead] = UARTBUF; rxhead++; - //checkcommand(UARTBUF); + // checkcommand(UARTBUF); } } if (UARTSTA & 2) { // TXC