Skip to content

Commit

Permalink
working CLI for TAG support
Browse files Browse the repository at this point in the history
Signed-off-by: Shreya Patel <[email protected]>
  • Loading branch information
paTelshREya committed Jul 24, 2024
1 parent a30a37e commit 48717ce
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 52 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ project(openthread_cli)
# NORDIC SDK APP START
target_sources(app PRIVATE src/main.c
src/utils.c
src/mqttsn.c
src/gpio.c
# src/mqttsn.c
# src/gpio.c
src/openthread_client.c
src/lorawan_client.c
src/gpsparser.c
src/minmea.c
src/nvs.c
# src/lorawan_client.c
# src/gpsparser.c
# src/minmea.c
# src/nvs.c
src/app_bluetooth.c
src/bluetooth/lns_client.c)
src/bluetooth/lns_client.c
)
# NORDIC SDK APP END

target_sources_ifdef(CONFIG_CLI_SAMPLE_LOW_POWER app PRIVATE src/low_power.c)
2 changes: 1 addition & 1 deletion Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
# Configure LoRaWAN Client

module = LORAWAN_CLIENT
module-str = gps-parser
module-str = lorawan-client
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
28 changes: 28 additions & 0 deletions boards/nrf5340tag_nrf5340_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
<NRF_PSEL(SPIM_MISO, 0, 23)>;
};
};

spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 8)>,
<NRF_PSEL(SPIM_MOSI, 1, 10)>,
<NRF_PSEL(SPIM_MISO, 1, 11)>;
};
};

};

&uart0 {
Expand Down Expand Up @@ -96,8 +105,27 @@
spi-max-frequency = <125000>;
};
};

&gpio_fwd {
uart {
gpios = <&gpio0 11 0>;
};
};

&spi2 {
cs-gpios = <&gpio1 9 0>;
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-names = "default";
};

/ {
nrf21540-fem {
compatible = "nordic,nrf21540-fem";
tx-en-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
rx-en-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
pdn-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
mode-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
spi-if = <&spi2>;
};
};
41 changes: 23 additions & 18 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CONFIG_MQTT_SNCLIENT_TOPIC_PREFIX="ot"
CONFIG_BT_DEVICE_NAME="nRF528xx"

CONFIG_BT=y
#CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y
Expand Down Expand Up @@ -84,7 +84,7 @@ CONFIG_MAIN_STACK_SIZE=4096
# Drivers

# Support temperature sensor
CONFIG_NRFX_TEMP=y
# CONFIG_NRFX_TEMP=y

# TODO: Support USB update without booting into DFU mode
#CONFIG_STREAM_FLASH=y
Expand All @@ -104,11 +104,11 @@ CONFIG_LOG=y
# of seeing errors...
CONFIG_LOG_PROCESS_THREAD=y
CONFIG_LOG_MODE_DEFERRED=n
#CONFIG_LOG_MAX_LEVEL=4
##CONFIG_OPENTHREAD_DEBUG=y
##CONFIG_OPENTHREAD_L2_DEBUG=y
#CONFIG_OPENTHREAD_LOG_LEVEL_WARN=y
##CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
CONFIG_LOG_MAX_LEVEL=4
CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_L2_DEBUG=y
CONFIG_OPENTHREAD_LOG_LEVEL_WARN=y
CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y

# Logging modules
CONFIG_OT_COMMAND_LINE_INTERFACE_LOG_LEVEL_INF=y
Expand Down Expand Up @@ -173,18 +173,23 @@ CONFIG_BT_HCI_ACL_FLOW_CONTROL=y
#CONFIG_NET_BUF_POOL_USAGE=y

# LORA
CONFIG_SPI=y
CONFIG_LORA=y
CONFIG_LORA_SHELL=y
CONFIG_LORAWAN=y
CONFIG_LORA_SX126X=y
CONFIG_LORAMAC_REGION_EU868=y
#CONFIG_LORA_LOG_LEVEL_DBG=y
#CONFIG_LORAWAN_LOG_LEVEL_DBG=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
# CONFIG_SPI=y
# CONFIG_LORA=y
# CONFIG_LORA_SHELL=y
# CONFIG_LORAWAN=y
# CONFIG_LORA_SX126X=y
# CONFIG_LORAMAC_REGION_EU868=y
# #CONFIG_LORA_LOG_LEVEL_DBG=y
# #CONFIG_LORAWAN_LOG_LEVEL_DBG=y
# CONFIG_MPU_ALLOW_FLASH_WRITE=y

# GPS
CONFIG_GPS_PARSER_LOG_LEVEL_DBG=y
# CONFIG_GPS_PARSER_LOG_LEVEL_DBG=y

# LoRaWAN Client
CONFIG_LORAWAN_CLIENT_LOG_LEVEL_DBG=y
# CONFIG_LORAWAN_CLIENT_LOG_LEVEL_DBG=y

# FEM
CONFIG_MPSL=y
CONFIG_MPSL_FEM=y
CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
9 changes: 6 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <zephyr/drivers/uart.h>
#include <zephyr/usb/usb_device.h>
#include <zephyr/drivers/lora.h>
// #include <zephyr/drivers/lora.h>

#include <openthread/platform/logging.h>
#include "openthread/instance.h"
Expand All @@ -23,7 +23,7 @@
#include "utils.h"
#include "mqttsn.h"
#include "app_bluetooth.h"
#include "gpio.h"
// #include "gpio.h"

#if defined(CONFIG_CLI_SAMPLE_LOW_POWER)
#include "low_power.h"
Expand Down Expand Up @@ -76,6 +76,7 @@ int main(int aArgc, char *aArgv[])
ret);
continue;
}
LOG_INF("*** Hello Mesh from while!!! ***");
k_msleep(100);
}
#endif
Expand All @@ -93,7 +94,9 @@ int main(int aArgc, char *aArgv[])
// appbluetoothInit();

// Start MQTT-SN client
mqttsnInit();
LOG_INF("*** before mqttsnInit ***");
// mqttsnInit();
LOG_INF("*** after mqttsnInit ***");

return 0;
}
Expand Down
Loading

0 comments on commit 48717ce

Please sign in to comment.