Skip to content

Commit

Permalink
Serial wake up from deep sleep for Uni
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Jun 23, 2020
1 parent 72831c2 commit 64bb9fa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
5 changes: 1 addition & 4 deletions software/firmware/source/SoftRF/GNSSHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ void PickGNSSFix()
}
#if defined(USE_NMEA_CFG)
if (C_Version.isUpdated()) {
#if 0
if (strncmp(C_Version.value(), "RST", 3) == 0) {
SoC->WDT_fini();
Serial.println();
Expand All @@ -782,9 +781,7 @@ void PickGNSSFix()
Serial.flush();
RF_Shutdown();
SoC->reset();
} else
#endif
if (strncmp(C_Version.value(), "OFF", 3) == 0) {
} else if (strncmp(C_Version.value(), "OFF", 3) == 0) {
shutdown(" OFF ");
} else if (strncmp(C_Version.value(), "?", 1) == 0) {
char psrfc_buf[MAX_PSRFC_LEN];
Expand Down
40 changes: 32 additions & 8 deletions software/firmware/source/SoftRF/Platform_CC13XX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,24 @@
#include <ti/drivers/Watchdog.h>
#include <xdc/runtime/Memory.h>

#include "SoCHelper.h"
#include "RFHelper.h"
#include "LEDHelper.h"
#include "SoundHelper.h"
#include "BaroHelper.h"

#include "EasyLink.h"

#if defined(ASSERT)
#undef ASSERT
#endif

#if defined(ENERGIA_ARCH_CC13XX)
#include <ti/devices/cc13x0/driverlib/sys_ctrl.h>
#include <ti/devices/cc13x0/driverlib/aon_batmon.h>
#include <SCSerial.h>
#endif /* ENERGIA_ARCH_CC13XX */

#if defined(ENERGIA_ARCH_CC13X2)
#include <ti/devices/cc13x2_cc26x2/driverlib/sys_ctrl.h>
#include <ti/devices/cc13x2_cc26x2/driverlib/aon_batmon.h>
Expand All @@ -36,14 +49,6 @@
#include <ADXL362.h>
#endif /* ENERGIA_ARCH_CC13X2 */

#include "SoCHelper.h"
#include "RFHelper.h"
#include "LEDHelper.h"
#include "SoundHelper.h"
#include "BaroHelper.h"

#include "EasyLink.h"

#if !defined(EXCLUDE_SX12XX)
// RFM95W pin mapping
lmic_pinmap lmic_pins = {
Expand Down Expand Up @@ -370,6 +375,18 @@ static void CC13XX_loop()
#endif /* ENERGIA_ARCH_CC13X2 */
}

#if defined(USE_SERIAL_DEEP_SLEEP)

#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>

/* Wake-up UART0 pin table */
PIN_Config UART0_TableWakeUp[] = {
IOID_12 | PIN_INPUT_EN | PIN_PULLUP | PINCC26XX_WAKEUP_NEGEDGE,
PIN_TERMINATE /* Terminate list */
};
#endif

static void CC13XX_fini()
{
// Disable battery monitoring
Expand All @@ -390,6 +407,13 @@ static void CC13XX_fini()

#endif /* ENERGIA_ARCH_CC13X2 */

#if defined(USE_SERIAL_DEEP_SLEEP)
Serial.end();

/* Configure DIO for wake up from shutdown */
PINCC26XX_setWakeup(UART0_TableWakeUp);
#endif

Power_shutdown(0, 0);
}

Expand Down
2 changes: 2 additions & 0 deletions software/firmware/source/SoftRF/hal_conf_extra.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@

#elif defined(ENERGIA_ARCH_CC13X2)

//#define USE_SERIAL_DEEP_SLEEP

#define ENABLE_NORMAL_MODE
#define EXCLUDE_TEST_MODE

Expand Down

0 comments on commit 64bb9fa

Please sign in to comment.