Created
March 13, 2019 13:58
-
-
Save martijnthe/712a92d1353ae01881dc17e73e0cbf28 to your computer and use it in GitHub Desktop.
lora vs flash ISR error logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/sx127x/sx1272/sx1272.c b/drivers/sx127x/sx1272/sx1272.c | |
index c25d3c4..7e9c51e 100644 | |
--- a/drivers/sx127x/sx1272/sx1272.c | |
+++ b/drivers/sx127x/sx1272/sx1272.c | |
@@ -947,8 +947,44 @@ void SX1272SetPublicNetwork( bool enable ) | |
} | |
} | |
+#include "soc/uart_reg.h" | |
+ | |
+static IRAM_ATTR void panicPutChar(char c) | |
+{ | |
+ while (((READ_PERI_REG(UART_STATUS_REG(CONFIG_CONSOLE_UART_NUM)) >> UART_TXFIFO_CNT_S)&UART_TXFIFO_CNT) >= 126) ; | |
+ WRITE_PERI_REG(UART_FIFO_REG(CONFIG_CONSOLE_UART_NUM), c); | |
+} | |
+ | |
+static IRAM_ATTR void panicPutStr(const char *c) | |
+{ | |
+ int x = 0; | |
+ while (c[x] != 0) { | |
+ panicPutChar(c[x]); | |
+ x++; | |
+ } | |
+} | |
+ | |
+static IRAM_ATTR void panicPutHex(int a) | |
+{ | |
+ int x; | |
+ int c; | |
+ for (x = 0; x < 8; x++) { | |
+ c = (a >> 28) & 0xf; | |
+ if (c < 10) { | |
+ panicPutChar('0' + c); | |
+ } else { | |
+ panicPutChar('a' + c - 10); | |
+ } | |
+ a <<= 4; | |
+ } | |
+} | |
+ | |
void SX1272OnTimeoutIrq( void ) | |
{ | |
+ panicPutStr("SX1272OnTimeoutIrq State:"); | |
+ panicPutChar('0' + SX1272.Settings.State); | |
+ panicPutChar('\n'); | |
+ | |
switch( SX1272.Settings.State ) | |
{ | |
case RF_RX_RUNNING: | |
@@ -1001,6 +1037,10 @@ void SX1272OnTimeoutIrq( void ) | |
} | |
IRAM_ATTR void SX1272RadioFlagsIrq (void) { | |
+ panicPutStr("SX1272RadioFlagsIrq:"); | |
+ panicPutHex(SX1272.irqFlags); | |
+ panicPutChar('\n'); | |
+ | |
if (SX1272.irqFlags & RADIO_IRQ_FLAG_RX_TIMEOUT) { | |
SX1272.irqFlags &= ~RADIO_IRQ_FLAG_RX_TIMEOUT; | |
if( ( RadioEvents != NULL ) && ( RadioEvents->RxTimeout != NULL ) ) | |
@@ -1035,6 +1075,11 @@ static IRAM_ATTR void SX1272OnDioIrq (void) { | |
break; | |
case MODEM_LORA: | |
irqflags1 = SX1272Read(REG_LR_IRQFLAGS); | |
+ panicPutChar('F'); | |
+ panicPutChar(':'); | |
+ panicPutHex(irqflags1); | |
+ panicPutChar('\n'); | |
+ | |
if ((irqflags1 & RFLR_IRQFLAGS_RXDONE) || (irqflags1 & RFLR_IRQFLAGS_TXDONE)) { | |
SX1272OnDio0Irq(); | |
} | |
diff --git a/esp32/mods/modlora.c b/esp32/mods/modlora.c | |
index 10d775d..871bc36 100644 | |
--- a/esp32/mods/modlora.c | |
+++ b/esp32/mods/modlora.c | |
@@ -709,6 +709,7 @@ static void McpsIndication (McpsIndication_t *mcpsIndication) { | |
} | |
static void MlmeConfirm (MlmeConfirm_t *MlmeConfirm) { | |
+ printf("MlmeConfirm status: %u type: %u\n", MlmeConfirm->Status, MlmeConfirm->MlmeRequest); | |
if (MlmeConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK) { | |
switch (MlmeConfirm->MlmeRequest) { | |
case MLME_JOIN: | |
@@ -1057,6 +1058,7 @@ static void TASK_LoRa (void *pvParameters) { | |
break; | |
case E_LORA_STATE_JOIN: | |
TimerStop( &TxNextActReqTimer ); | |
+ printf("E_LORA_STATE_JOIN %u\n", lora_obj.joined); | |
if (!lora_obj.joined) { | |
if (lora_obj.activation == E_LORA_ACTIVATION_OTAA) { | |
#if defined(FIPY) || defined(LOPY4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment