From 20d9c5ef2861ba6e2db2e79f576d9cee7311c38d Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Thu, 27 Oct 2022 10:32:41 +0200 Subject: [PATCH 1/6] test commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a01caf..e9af017 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The aim of this project is to develop open source LoRaWAN modem for the [Type ABZ](https://github.com/hardwario/lora-modem-abz/wiki/Type-ABZ-Modules) wireless module by Murata. The firmware provides an AT command interface backward compatible with Murata Modem, Murata's proprietary LoRaWAN firmware. The firmware can be used on all Type ABZ variants with an open (user-reprogrammable) microcontroller. Binary firmware images are provided for HARDWARIO [LoRa Module](https://shop.hardwario.com/lora-module/), Arduino [MKR WAN 1300](https://store-usa.arduino.cc/products/arduino-mkr-wan-1300-lora-connectivity), and [MKR WAN 1310](https://store.arduino.cc/products/arduino-mkr-wan-1310) boards. -## Main Features +## Main Features * Support for [LoRaWAN 1.0.4](https://resources.lora-alliance.org/technical-specifications/ts001-1-0-4-lorawan-l2-1-0-4-specification), [LoRaWAN 1.1](https://resources.lora-alliance.org/technical-specifications/lorawan-specification-v1-1), and regional parameters [RP2-1.0.3](https://resources.lora-alliance.org/technical-specifications/rp2-1-0-3-lorawan-regional-parameters) * Based on the most recent version (unreleased 4.7.0) of [LoRaMac-node](https://github.com/Lora-net/LoRaMac-node) From fb8b5b804c3d42e855560810001a5a35f06af249 Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Thu, 27 Oct 2022 16:51:27 +0200 Subject: [PATCH 2/6] Add $NVM command for supporting User Storage Space Use AT$NVM=0,123 to store value 123 in user space 0 +OK=1,123 Use AT$NVM=0 to read value previously stored +OK=123 It currently supports 4 user spaces (0 to 3) and values are 8 bits unsigned --- src/cmd.c | 22 ++++++++++++++++++++++ src/nvm.c | 37 +++++++++++++++++++++++++++++++++++-- src/nvm.h | 11 +++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 0deb8a4..fd960e1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2055,6 +2055,27 @@ static void get_session(void) } + +// Read and Store a User data into the NVM area +// AT$NVM=0 read data at address 0 +// AT$NVM=0,223 write 223 at address 0 +static void set_nvm(atci_param_t *param) { + uint32_t adr, value; + if (!atci_param_get_uint(param, &adr)) abort(ERR_PARAM); + if (adr >= USER_NVM_MAX_SIZE) abort(ERR_PARAM); + if (param->offset < param->length) { + if (!atci_param_is_comma(param)) abort(ERR_PARAM); + if (!atci_param_get_uint(param, &value)) abort(ERR_PARAM); + if (value >= 256) abort(ERR_PARAM); + user_nvm.values[adr] = value; + userNvm_process(); + OK("%d,%d",(int)adr,(int)value); + } else { + OK("%d",user_nvm.values[adr]); + } +} + + static const atci_command_t cmds[] = { {"+UART", NULL, set_uart, get_uart, NULL, "Configure UART interface"}, {"+VER", NULL, NULL, get_version_comp, NULL, "Firmware version and build time"}, @@ -2125,6 +2146,7 @@ static const atci_command_t cmds[] = { {"$SESSION", NULL, NULL, get_session, NULL, "Get network session information"}, {"$CW", cw, NULL, NULL, NULL, "Start continuous carrier wave transmission"}, {"$CM", cm, NULL, NULL, NULL, "Start continuous modulated FSK transmission"}, + {"$NVM", NULL, set_nvm, NULL, NULL, "Store / Read data from Non Volatile Memory"}, ATCI_COMMAND_CLAC, ATCI_COMMAND_HELP}; diff --git a/src/nvm.c b/src/nvm.c index 00cb526..90f4d11 100644 --- a/src/nvm.c +++ b/src/nvm.c @@ -1,6 +1,7 @@ #include "nvm.h" #include #include +#include #include #include #include @@ -11,7 +12,7 @@ #include "part.h" #include "utils.h" -#define NUMBER_OF_PARTS 8 +#define NUMBER_OF_PARTS 9 /* The following partition sizes have been derived from the in-memory size of @@ -30,6 +31,7 @@ #define REGION1_PART_SIZE 32 #define REGION2_PART_SIZE 1536 #define CLASSB_PART_SIZE 32 +#define USER_NVM_PART_SIZE 12 // Make sure each data structure fits into its fixed-size partition @@ -41,6 +43,7 @@ static_assert(sizeof(SecureElementNvmData_t) <= SE_PART_SIZE, "SecureElement NVM static_assert(sizeof(RegionNvmDataGroup1_t) <= REGION1_PART_SIZE, "RegionGroup1 NVM data too long"); static_assert(sizeof(RegionNvmDataGroup2_t) <= REGION2_PART_SIZE, "RegionGroup2 NVM data too long"); static_assert(sizeof(LoRaMacClassBNvmData_t) <= CLASSB_PART_SIZE, "ClassB NVM data too long"); +static_assert(sizeof(userNvm_t) <= USER_NVM_PART_SIZE, "User NVM data too long"); // And also make sure that NVM data fits into the EEPROM twice. This is @@ -53,7 +56,8 @@ static_assert( SE_PART_SIZE + REGION1_PART_SIZE + REGION2_PART_SIZE + - CLASSB_PART_SIZE + CLASSB_PART_SIZE + + USER_NVM_PART_SIZE <= (DATA_EEPROM_BANK2_END - DATA_EEPROM_BASE + 1 - PART_TABLE_SIZE(NUMBER_OF_PARTS)) / 2, "NVM data does not fit into a single EEPROM bank"); @@ -71,6 +75,8 @@ static part_block_t nvm = { struct nvm_parts nvm_parts; +userNvm_t user_nvm = { 0 }; + sysconf_t sysconf = { .uart_baudrate = DEFAULT_UART_BAUDRATE, .uart_timeout = 1000, @@ -147,6 +153,11 @@ void nvm_init(void) nvm_parts.classb.dsc->size != CLASSB_PART_SIZE) goto retry; + if ((part_find(&nvm_parts.user, &nvm, "user") && + part_create(&nvm_parts.user, &nvm, "user", USER_NVM_PART_SIZE)) || + nvm_parts.user.dsc->size != USER_NVM_PART_SIZE) + goto retry; + size_t size; const uint8_t *p = part_mmap(&size, &nvm_parts.sysconf); if (check_block_crc(p, sizeof(sysconf))) { @@ -155,6 +166,17 @@ void nvm_init(void) } else { log_debug("Invalid system configuration checksum, using defaults"); } + + p = part_mmap(&size, &nvm_parts.user); + if (check_block_crc(p, sizeof(user_nvm))) { + log_debug("Restoring user data from NVM"); + memcpy(&user_nvm, p, sizeof(user_nvm)); + } else { + log_debug("Invalid user data checksum, using defaults"); + user_nvm.magic = USER_NVM_MAGIC; + bzero(user_nvm.values,USER_NVM_MAX_SIZE); + } + return; retry: @@ -192,3 +214,14 @@ void sysconf_process(void) sysconf_modified = false; } + +void userNvm_process(void) +{ + + if (update_block_crc(&user_nvm, sizeof(user_nvm))) { + log_debug("Saving user data to NVM"); + if (!part_write(&nvm_parts.user, 0, &user_nvm, sizeof(user_nvm))) + log_error("Error while writing user data to NVM"); + } + +} diff --git a/src/nvm.h b/src/nvm.h index 04a1442..0f42e87 100644 --- a/src/nvm.h +++ b/src/nvm.h @@ -66,18 +66,29 @@ struct nvm_parts { part_t region1; part_t region2; part_t classb; + part_t user; }; +#define USER_NVM_MAX_SIZE 4 // maximum allows values inside the User Nvm area +#define USER_NVM_MAGIC 0xD15C9101 +typedef struct userNvm_s { + uint32_t magic; + uint8_t values[USER_NVM_MAX_SIZE]; + uint32_t crc32; +} userNvm_t; + extern struct nvm_parts nvm_parts; extern sysconf_t sysconf; extern bool sysconf_modified; extern uint16_t nvm_flags; +extern userNvm_t user_nvm; void nvm_init(void); int nvm_erase(void); void sysconf_process(void); +void userNvm_process(void); #endif // _NVM_H_ \ No newline at end of file From 1bd604aeadc7d7fe6d4b69f1ae48e9f1addd9b3e Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Tue, 1 Nov 2022 19:43:02 +0100 Subject: [PATCH 3/6] Add a feature to block read access on appkey The AppKey is a secret you should not give an easy access to. I've added a command to avoid this access. Once locked it's not possible to regain access to the appkey. It can still write but not read. The additional command is AT$APKACCESS without any parameter. --- src/cmd.c | 17 ++++++++++++++--- src/nvm.c | 3 ++- src/nvm.h | 5 +++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index fd960e1..2ff3680 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -489,11 +489,21 @@ static void set_appskey(atci_param_t *param) static void get_appkey(void) { - atci_print("+OK="); - atci_print_buffer_as_hex(find_key(APP_KEY), SE_KEY_SIZE); - EOL(); + if ( sysconf.appkey_readable ) { + atci_print("+OK="); + atci_print_buffer_as_hex(find_key(APP_KEY), SE_KEY_SIZE); + EOL(); + } else { + abort(ERR_UNSUPPORTED); + } } +static void protect_appkey(atci_param_t *param) +{ + sysconf.appkey_readable = 0; + sysconf_modified = true; + OK_(); +} static void set_appkey_10(atci_param_t *param) { @@ -2147,6 +2157,7 @@ static const atci_command_t cmds[] = { {"$CW", cw, NULL, NULL, NULL, "Start continuous carrier wave transmission"}, {"$CM", cm, NULL, NULL, NULL, "Start continuous modulated FSK transmission"}, {"$NVM", NULL, set_nvm, NULL, NULL, "Store / Read data from Non Volatile Memory"}, + {"$APKACCESS", protect_appkey, NULL, NULL, NULL, "Protect AppKey against read access"}, ATCI_COMMAND_CLAC, ATCI_COMMAND_HELP}; diff --git a/src/nvm.c b/src/nvm.c index 90f4d11..e77bc1b 100644 --- a/src/nvm.c +++ b/src/nvm.c @@ -85,7 +85,8 @@ sysconf_t sysconf = { .sleep = 1, .device_class = CLASS_A, .unconfirmed_retransmissions = 1, - .confirmed_retransmissions = 8 + .confirmed_retransmissions = 8, + .appkey_readable = 1 }; bool sysconf_modified; diff --git a/src/nvm.h b/src/nvm.h index 0f42e87..d481b77 100644 --- a/src/nvm.h +++ b/src/nvm.h @@ -53,6 +53,11 @@ typedef struct sysconf */ uint8_t confirmed_retransmissions; + /* This is allowing to read the appKey from the serial line of not + * once set to false (0) it will not be possible to retrieve the appKey + */ + uint8_t appkey_readable:1; + uint32_t crc32; } sysconf_t; From 58e31f9ff7a4282db195a98ac1968ae00ddfac16 Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Tue, 1 Nov 2022 22:11:53 +0100 Subject: [PATCH 4/6] Add ability to disconnect UART for being able to use SPI flash on MKR1310 MKR1310 use same wires for SPI Flash control and UART line. They are in conflict and SPI can't be use until the serial line has been disabled. This new command $DISUART manage this problem. The initial UART configuration is restored by forcing the PB12 line to 0 corresponding to LORA_IRQ_DUMB signal on MKR1310 --- Makefile | 16 ++++++++++++++-- src/cmd.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/cmd.h | 4 ++++ src/lpuart.c | 12 ++++++++++++ src/lpuart.h | 14 ++++++++++++++ src/main.c | 4 +++- 6 files changed, 97 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e12f274..a096776 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,19 @@ DEBUG_PORT ?= 1 # also the default value. Hardwario LoRa devices use this pin. # # 2 - PB6 (pin 39). Arduino MKRWAN1310 boards use this pin. -TCXO_PIN ?= 1 +TCXO_PIN ?= 2 + +# Specific target MKR1310, add a feature to deactivate the serial port based on +# PB12 GPIO. This is because Arduino team used same pins for serial line and SPI +# lines. As a consequence, Serial line activity prevent to use the SPI port and the +# onboarded SerialFlash. +# The Arduino documentation recommands to maintain the modem in a reset mode but this +# will make the LoRaWAN session lost, so this approach is not working. With the ability +# to deactivate the serail line on request, this may solve the problem even if the right +# solution should be to redesign this board. +# 0 - Disable this specific feature +# 1 - Enable this specific feature with control line PB12 set to 0 (pull-up on the line) +MKR1310 ?= 1 ################################################################################ # You shouldn't need to edit the text below under normal circumstances. # @@ -306,7 +318,7 @@ CFLAGS += -DUSE_FULL_LL_DRIVER CFLAGS += -DDEFAULT_UART_BAUDRATE=$(DEFAULT_UART_BAUDRATE) -CFLAGS += -DTCXO_PIN=$(TCXO_PIN) +CFLAGS += -DTCXO_PIN=$(TCXO_PIN) -DMKR1310=$(MKR1310) # Extra flags to be only applied when we compile the souce files from the lib # subdirectory. Since that sub-directory contains third-party code, disable some diff --git a/src/cmd.c b/src/cmd.c index 2ff3680..833b265 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2085,6 +2085,53 @@ static void set_nvm(atci_param_t *param) { } } +#if MKR1310 == 1 +// The MKR1310 is using the same wires for SPI and UART +// To be able to use the embedded SPI Flash, we need to switch UART Off +// As uart is used for waking the device up when going into sleep mode +// we will disable the sleep mode too during this period of time +// Uart will be resumed by setting GPIO B12 to LOW (it has a pull-up on the line) +static uint8_t __prev_sleep; +static uint8_t __uart_disable = 0; +static void disable_uart(atci_param_t *param) { + // simpler to add everything in a single place, + // make sure these lines are INPUT to not conflict with external signals from SPI + GPIO_InitTypeDef cfg = { + .Mode = GPIO_MODE_INPUT, + .Pull = GPIO_NOPULL + }; + gpio_init(GPIOB, GPIO_PIN_12, &cfg); + gpio_init(GPIOB, GPIO_PIN_13, &cfg); + gpio_init(GPIOB, GPIO_PIN_14, &cfg); + gpio_init(GPIOB, GPIO_PIN_15, &cfg); + + // No need to deactivate uart if the wakeup signal is true + int v = gpio_read(GPIOB, GPIO_PIN_12); + if ( v == 0 ) abort(ERR_PARAM); + OK_(); + + lpuart_disable(); + __prev_sleep = sysconf.sleep; + __uart_disable = 1; + sysconf.sleep = 0; // prevent the device to go deep sleep and never waked up due to serial line deactivation +} + +// this is monitoring the PB12 line and restart the UART when to comes low +void process_uart_wakeup(void) { + // nothing to do + if ( __uart_disable == 0 ) return; + + int v = gpio_read(GPIOB, GPIO_PIN_12); + if ( v == 0 ) { + // restart is requested + lpuart_enable(); + sysconf.sleep = __prev_sleep; + __uart_disable = 0; + OK_(); + } +} + +#endif static const atci_command_t cmds[] = { {"+UART", NULL, set_uart, get_uart, NULL, "Configure UART interface"}, @@ -2158,6 +2205,9 @@ static const atci_command_t cmds[] = { {"$CM", cm, NULL, NULL, NULL, "Start continuous modulated FSK transmission"}, {"$NVM", NULL, set_nvm, NULL, NULL, "Store / Read data from Non Volatile Memory"}, {"$APKACCESS", protect_appkey, NULL, NULL, NULL, "Protect AppKey against read access"}, +#if MKR1310 == 1 + {"$DISUART", disable_uart, NULL, NULL, NULL, "Disable UART"}, +#endif ATCI_COMMAND_CLAC, ATCI_COMMAND_HELP}; diff --git a/src/cmd.h b/src/cmd.h index fb0a514..c568266 100644 --- a/src/cmd.h +++ b/src/cmd.h @@ -51,4 +51,8 @@ void cmd_ans(unsigned int margin, unsigned int gwcnt); #define cmd_print atci_print #define cmd_printf atci_printf +#if MKR1310 == 1 +void process_uart_wakeup(void); +#endif + #endif // _CMD_H diff --git a/src/lpuart.c b/src/lpuart.c index 8ceb335..7b74191 100644 --- a/src/lpuart.c +++ b/src/lpuart.c @@ -129,6 +129,7 @@ void lpuart_init(unsigned int baudrate) } + static void init_gpio(void) { GPIO_InitTypeDef gpio = { @@ -168,6 +169,17 @@ static void deinit_gpio(void) } +void lpuart_disable(void) { + lpuart_flush(); + HAL_UART_DMAPause(&port); + deinit_gpio(); +} + +void lpuart_enable() { + init_gpio(); + HAL_UART_DMAResume(&port); +} + void HAL_UART_MspInit(UART_HandleTypeDef *port) { /* Enable peripherals and GPIO Clocks */ diff --git a/src/lpuart.h b/src/lpuart.h index 53c89ea..a51c4bb 100644 --- a/src/lpuart.h +++ b/src/lpuart.h @@ -97,4 +97,18 @@ void lpuart_before_stop(void); void lpuart_after_stop(void); +/*! @brief Disable LPUART1 Gpio for MKRWAN1310 + * + * This function is specific to MKRWAN1310, it disable the lpuart pins to allow sharing the + * wires on the board with the SPI to use the onboarded flash. + */ +void lpuart_disable(void); + +/*! @brief Reinit LPUART1 Gpio for MKRWAN1310 + * + * This function is specific to MKRWAN1310, it reinit the lpuart pins to allow sharing the + * wires on the board with the SPI to use the onboarded flash. + */ +void lpuart_enable(void); + #endif /* __LPUART_H__ */ diff --git a/src/main.c b/src/main.c index 981390a..eff8f4d 100644 --- a/src/main.c +++ b/src/main.c @@ -60,6 +60,9 @@ int main(void) cmd_event(CMD_EVENT_MODULE, CMD_MODULE_BOOT); while (1) { + #if MKR1310 == 1 + process_uart_wakeup(); + #endif cmd_process(); lrw_process(); sysconf_process(); @@ -91,7 +94,6 @@ int main(void) } enable_irq(); - // Invoke lrw_process as the first thing after waking up to give the MAC // a chance to timestamp incoming downlink as quickly as possible. lrw_process(); From e0b95256494bca1155fb6cee4c9165d96106d954 Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Mon, 7 Nov 2022 23:15:51 +0100 Subject: [PATCH 5/6] Apply requested modification on AT$NVM command commit --- src/cmd.c | 11 ++++++----- src/nvm.c | 10 +++++----- src/nvm.h | 10 +++++----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 833b265..6532aff 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2066,11 +2066,12 @@ static void get_session(void) -// Read and Store a User data into the NVM area +// Read and Write a User data into the NVM area // AT$NVM=0 read data at address 0 // AT$NVM=0,223 write 223 at address 0 -static void set_nvm(atci_param_t *param) { +static void nvm_userdata(atci_param_t *param) { uint32_t adr, value; + if (param == NULL) abort(ERR_PARAM); if (!atci_param_get_uint(param, &adr)) abort(ERR_PARAM); if (adr >= USER_NVM_MAX_SIZE) abort(ERR_PARAM); if (param->offset < param->length) { @@ -2078,8 +2079,8 @@ static void set_nvm(atci_param_t *param) { if (!atci_param_get_uint(param, &value)) abort(ERR_PARAM); if (value >= 256) abort(ERR_PARAM); user_nvm.values[adr] = value; - userNvm_process(); - OK("%d,%d",(int)adr,(int)value); + user_nvm_process(); + OK_(); } else { OK("%d",user_nvm.values[adr]); } @@ -2203,7 +2204,7 @@ static const atci_command_t cmds[] = { {"$SESSION", NULL, NULL, get_session, NULL, "Get network session information"}, {"$CW", cw, NULL, NULL, NULL, "Start continuous carrier wave transmission"}, {"$CM", cm, NULL, NULL, NULL, "Start continuous modulated FSK transmission"}, - {"$NVM", NULL, set_nvm, NULL, NULL, "Store / Read data from Non Volatile Memory"}, + {"$NVM", nvm_userdata, NULL, NULL, NULL, "Write / Read userdata to/from 64 bytes of NVM"}, {"$APKACCESS", protect_appkey, NULL, NULL, NULL, "Protect AppKey against read access"}, #if MKR1310 == 1 {"$DISUART", disable_uart, NULL, NULL, NULL, "Disable UART"}, diff --git a/src/nvm.c b/src/nvm.c index e77bc1b..3ab6e25 100644 --- a/src/nvm.c +++ b/src/nvm.c @@ -29,9 +29,9 @@ #define MAC2_PART_SIZE 512 #define SE_PART_SIZE 512 #define REGION1_PART_SIZE 32 -#define REGION2_PART_SIZE 1536 +#define REGION2_PART_SIZE 1310 #define CLASSB_PART_SIZE 32 -#define USER_NVM_PART_SIZE 12 +#define USER_NVM_PART_SIZE 72 // Make sure each data structure fits into its fixed-size partition @@ -43,7 +43,7 @@ static_assert(sizeof(SecureElementNvmData_t) <= SE_PART_SIZE, "SecureElement NVM static_assert(sizeof(RegionNvmDataGroup1_t) <= REGION1_PART_SIZE, "RegionGroup1 NVM data too long"); static_assert(sizeof(RegionNvmDataGroup2_t) <= REGION2_PART_SIZE, "RegionGroup2 NVM data too long"); static_assert(sizeof(LoRaMacClassBNvmData_t) <= CLASSB_PART_SIZE, "ClassB NVM data too long"); -static_assert(sizeof(userNvm_t) <= USER_NVM_PART_SIZE, "User NVM data too long"); +static_assert(sizeof(user_nvm_t) <= USER_NVM_PART_SIZE, "User NVM data too long"); // And also make sure that NVM data fits into the EEPROM twice. This is @@ -75,7 +75,7 @@ static part_block_t nvm = { struct nvm_parts nvm_parts; -userNvm_t user_nvm = { 0 }; +user_nvm_t user_nvm = { 0 }; sysconf_t sysconf = { .uart_baudrate = DEFAULT_UART_BAUDRATE, @@ -216,7 +216,7 @@ void sysconf_process(void) } -void userNvm_process(void) +void user_nvm_process(void) { if (update_block_crc(&user_nvm, sizeof(user_nvm))) { diff --git a/src/nvm.h b/src/nvm.h index d481b77..c65eee0 100644 --- a/src/nvm.h +++ b/src/nvm.h @@ -74,26 +74,26 @@ struct nvm_parts { part_t user; }; -#define USER_NVM_MAX_SIZE 4 // maximum allows values inside the User Nvm area +#define USER_NVM_MAX_SIZE 64 // maximum allows values inside the User Nvm area #define USER_NVM_MAGIC 0xD15C9101 -typedef struct userNvm_s { +typedef struct user_nvm_s { uint32_t magic; uint8_t values[USER_NVM_MAX_SIZE]; uint32_t crc32; -} userNvm_t; +} user_nvm_t; extern struct nvm_parts nvm_parts; extern sysconf_t sysconf; extern bool sysconf_modified; extern uint16_t nvm_flags; -extern userNvm_t user_nvm; +extern user_nvm_t user_nvm; void nvm_init(void); int nvm_erase(void); void sysconf_process(void); -void userNvm_process(void); +void user_nvm_process(void); #endif // _NVM_H_ \ No newline at end of file From 4aabe2fbfc4addfc5012afec4d6ffb9c1643ceea Mon Sep 17 00:00:00 2001 From: Paul Pinault Date: Mon, 7 Nov 2022 23:29:20 +0100 Subject: [PATCH 6/6] fix some compilation issues and rollback Makefile modifications --- Makefile | 4 ++-- src/cmd.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a096776..693e290 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ DEBUG_PORT ?= 1 # also the default value. Hardwario LoRa devices use this pin. # # 2 - PB6 (pin 39). Arduino MKRWAN1310 boards use this pin. -TCXO_PIN ?= 2 +TCXO_PIN ?= 1 # Specific target MKR1310, add a feature to deactivate the serial port based on # PB12 GPIO. This is because Arduino team used same pins for serial line and SPI @@ -95,7 +95,7 @@ TCXO_PIN ?= 2 # solution should be to redesign this board. # 0 - Disable this specific feature # 1 - Enable this specific feature with control line PB12 set to 0 (pull-up on the line) -MKR1310 ?= 1 +MKR1310 ?= 0 ################################################################################ # You shouldn't need to edit the text below under normal circumstances. # diff --git a/src/cmd.c b/src/cmd.c index 6532aff..a6ae028 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -500,6 +500,7 @@ static void get_appkey(void) static void protect_appkey(atci_param_t *param) { + if (param != NULL) abort(ERR_PARAM); sysconf.appkey_readable = 0; sysconf_modified = true; OK_(); @@ -2095,6 +2096,7 @@ static void nvm_userdata(atci_param_t *param) { static uint8_t __prev_sleep; static uint8_t __uart_disable = 0; static void disable_uart(atci_param_t *param) { + if (param != NULL) abort(ERR_PARAM); // simpler to add everything in a single place, // make sure these lines are INPUT to not conflict with external signals from SPI GPIO_InitTypeDef cfg = {