Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize changes with Mbed upstream: July 2024 edition #309

Merged
merged 35 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
42027d1
remove stdio checks in serial init if no console is available
chrJost Oct 10, 2023
aa27fb6
STM32WL fix set preamble length to 8
hallard Oct 24, 2023
d321f0a
Add target support for XDOT_MAX32670
felser Oct 11, 2023
ef64f8a
TARGET_STM: only mask CAN rx interrupt after rx interrupt, not all CA…
pavels Oct 26, 2023
4f88fdf
Sleep Radio in between DC scheduled
hallard Nov 10, 2023
a7f3908
Nuvoton HUSBD support endpoint write ZLP
cyliangtw Dec 5, 2023
8b39ff7
USBCDC: support ZLP
cyliangtw Dec 1, 2023
3aa490a
Don't overlap STM32 FDCAN RAM sections
Nov 30, 2023
6c054cb
allow to override antenna gain
hallard Nov 30, 2023
c79a6bb
TFM: Fix undeclared function tfm_ns_interface_init
ccli8 Mar 19, 2024
b0fbe00
NUVOTON: CAN: Fix filter mask
ccli8 Apr 10, 2024
139e3a9
NUVOTON: CAN: Fix Rx interrupt doesn't work
ccli8 Apr 8, 2024
25be748
NUVOTON: CAN: Fix Message Object number for Tx and recognition of Rx …
ccli8 Apr 12, 2024
53bac3f
NUVOTON: CAN: Fix filter mask being zero
ccli8 Apr 18, 2024
46d098e
Allow custom TCXO control parameter
hallard Apr 4, 2024
3b49c13
NUVOTON: EMAC: Fix undeclared function mbed_error_printf
ccli8 Mar 15, 2024
326c8b3
NUVOTON: AnalogIn: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
b6450bd
NUVOTON: CAN: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
3e9fd81
NUVOTON: AnalogOut: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
59c64da
NUVOTON: SPI: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
283a230
NUVOTON: I2C: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
8879390
NUVOTON: Serial: Fix undeclared function gpio_set
ccli8 Mar 15, 2024
ec21609
Add separate flags for I2C slave transfer in progress
agausmann Mar 12, 2024
66f882e
ESP8266: Fix accessing uninitialized variable
szsam Mar 8, 2024
33d1fec
Added missing delete
mattgbio May 3, 2024
f31b586
Add ability to change number of status registers for macronix QSPIF d…
daniel-723 Feb 27, 2024
91b9d70
correct scan parameters types
matkammusic May 16, 2024
74810d2
skip CRC when initializing TDBStore
mattgbio May 3, 2024
94dd37a
Added missing check for replay protection pointer before allocating n…
mattgbio May 3, 2024
5f3e1cd
Increase AT timeout to 10s in AT_CellularSMS::send_sms
davidalo Dec 30, 2023
6412779
Increase AT timeout to 10s in AT_CellularSMS::get_sms
davidalo Dec 30, 2023
3e75fa8
Fix AT_CellularSMS::list_messages breaking in text mode when CRLF is …
davidalo Dec 30, 2023
9cc6f74
Add missing SPDX identifier to a bajillion Nuvoton source files + som…
multiplemonomials Jul 20, 2024
af06148
More license fixes, upgrade M451 legacy PinNames.h, add MCU description
multiplemonomials Jul 21, 2024
28457a0
Fix some more legacy pin names
multiplemonomials Jul 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions connectivity/FEATURE_BLE/include/ble/gap/ScanParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ class ScanParameters {
/**
* Get the scan interval.
*/
const scan_window_t &getInterval() const
const scan_interval_t &getInterval() const
{
return interval;
}

/**
* Get the scan window.
*/
const scan_interval_t &getWindow() const
const scan_window_t &getWindow() const
{
return window;
}
Expand Down Expand Up @@ -121,8 +121,8 @@ class ScanParameters {
*/
ScanParameters(
phy_t phy = phy_t::LE_1M,
scan_window_t scan_interval = scan_interval_t::min(),
scan_interval_t scan_window = scan_window_t::min(),
scan_interval_t scan_interval = scan_interval_t::min(),
scan_window_t scan_window = scan_window_t::min(),
bool active_scanning = false,
own_address_type_t own_address_type = own_address_type_t::RANDOM,
scanning_filter_policy_t scanning_filter_policy = scanning_filter_policy_t::NO_FILTER
Expand Down
13 changes: 13 additions & 0 deletions connectivity/cellular/include/cellular/framework/API/ATHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,13 @@ class ATHandler {
*/
void skip_param(ssize_t len, uint32_t count);

/** Consumes the given length from the reading buffer even if the stop tag has been found
*
* @param len length to be consumed from reading buffer
* @param count number of parameters to be skipped
*/
void skip_param_bytes(ssize_t len, uint32_t count);

/** Reads given number of bytes from receiving buffer without checking any subparameter delimiters, such as comma.
*
* @param buf output buffer for the read
Expand Down Expand Up @@ -408,6 +415,12 @@ class ATHandler {
*/
bool consume_to_stop_tag();

/** Consumes the received content until current stop tag is found even if stop tag has been found previously
*
* @return true if stop tag is found, false otherwise
*/
bool consume_to_stop_tag_even_found();

/** Return the last 3GPP error code.
* @return last 3GPP error code
*/
Expand Down
24 changes: 22 additions & 2 deletions connectivity/cellular/source/framework/AT/AT_CellularSMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
}

_at.lock();
_at.set_at_timeout(10s);

int write_size = 0;

Expand All @@ -437,6 +438,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
// sending can be cancelled by giving <ESC> character (IRA 27).
_at.cmd_start(ESC);
_at.cmd_stop();
_at.restore_at_timeout();
_at.unlock();
return write_size;
}
Expand Down Expand Up @@ -482,6 +484,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
pdu_str = create_pdu(phone_number, message + i * concatenated_sms_length, pdu_len,
sms_count, i + 1, header_len);
if (!pdu_str) {
_at.restore_at_timeout();
_at.unlock();
return NSAPI_ERROR_NO_MEMORY;
}
Expand Down Expand Up @@ -509,6 +512,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
// sending can be cancelled by giving <ESC> character (IRA 27).
_at.cmd_start(ESC);
_at.cmd_stop();
_at.restore_at_timeout();
_at.unlock();
delete [] pdu_str;
return msg_write_len;
Expand All @@ -523,13 +527,15 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
delete [] pdu_str;
remaining_len -= concatenated_sms_length;
if (_at.get_last_error() != NSAPI_ERROR_OK) {
_at.restore_at_timeout();
return _at.unlock_return_error();
}
}
}

_sms_message_ref_number++;
nsapi_error_t ret = _at.get_last_error();
_at.restore_at_timeout();
_at.unlock();

return (ret == NSAPI_ERROR_OK) ? msg_len : ret;
Expand Down Expand Up @@ -697,6 +703,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
}

_at.lock();
_at.set_at_timeout(10s);

nsapi_size_or_error_t err = list_messages();
if (err == NSAPI_ERROR_OK) {
Expand All @@ -710,6 +717,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho
*buf_size = info->msg_size;
}
free_linked_list();
_at.restore_at_timeout();
_at.unlock();
return NSAPI_ERROR_PARAMETER;
}
Expand All @@ -734,6 +742,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_sms(char *buf, uint16_t len, char *pho

free_linked_list();

_at.restore_at_timeout();
_at.unlock();

// update error only when there really was an error, otherwise we return the length
Expand Down Expand Up @@ -1027,6 +1036,7 @@ nsapi_error_t AT_CellularSMS::list_messages()
int index = 0;
int length = 0;
char *pdu = NULL;
char buffer[32]; // 32 > SMS_STATUS_SIZE, SMS_MAX_PHONE_NUMBER_SIZE, SMS_MAX_TIME_STAMP_SIZE

_at.resp_start("+CMGL:");
while (_at.info_resp()) {
Expand All @@ -1049,8 +1059,18 @@ nsapi_error_t AT_CellularSMS::list_messages()
// +CMGL: <index>,<stat>,<oa/da>,[<alpha>],[<scts>][,<tooa/toda>,<length>]<CR><LF><data>[<CR><LF>
// +CMGL: <index>,<stat>,<da/oa>,[<alpha>],[<scts>][,<tooa/toda>,<length>]<CR><LF><data>[...]]
index = _at.read_int();
(void)_at.consume_to_stop_tag(); // consume until <CR><LF>
(void)_at.consume_to_stop_tag(); // consume until <CR><LF>
_at.read_string(buffer, SMS_STATUS_SIZE);
_at.read_string(buffer, SMS_MAX_PHONE_NUMBER_SIZE);
_at.skip_param(); // <alpha>
_at.read_string(buffer, SMS_MAX_TIME_STAMP_SIZE);
_at.read_int();
int size = _at.read_int(); // length
_at.consume_to_stop_tag(); // consume until <CR><LF> end of header
if (size > 0) {
// we can not use skip param because we already consumed stop tag
_at.skip_param_bytes(size, 1);
}
_at.consume_to_stop_tag_even_found(); // consume until <CR><LF> -> data
}

if (index >= 0) {
Expand Down
40 changes: 40 additions & 0 deletions connectivity/cellular/source/framework/device/ATHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,26 @@ void ATHandler::skip_param(ssize_t len, uint32_t count)
return;
}

void ATHandler::skip_param_bytes(ssize_t len, uint32_t count)
{
if (!ok_to_proceed()) {
return;
}

for (uint32_t i = 0; i < count; i++) {
ssize_t read_len = 0;
while (read_len < len) {
int c = get_char();
if (c == -1) {
set_error(NSAPI_ERROR_DEVICE_ERROR);
return;
}
read_len++;
}
}
return;
}

ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len)
{
if (!ok_to_proceed()) {
Expand Down Expand Up @@ -1093,6 +1113,26 @@ bool ATHandler::consume_to_stop_tag()
return false;
}


bool ATHandler::consume_to_stop_tag_even_found()
{
if (_error_found) {
return true;
}

if (!_is_fh_usable) {
_last_err = NSAPI_ERROR_BUSY;
return true;
}

if (consume_to_tag((const char *)_stop_tag->tag, true)) {
return true;
}

clear_error();
return false;
}

// consume by size needed?

void ATHandler::resp_stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ void ATHandler::skip_param(ssize_t len, uint32_t count)
{
}

void ATHandler::skip_param_bytes(ssize_t len, uint32_t count)
{
}

ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len)
{
return ATHandler_stub::ssize_value;
Expand Down Expand Up @@ -301,6 +305,11 @@ bool ATHandler::consume_to_stop_tag()
return ATHandler_stub::bool_value;
}

bool ATHandler::consume_to_stop_tag_even_found()
{
return ATHandler_stub::bool_value;
}

void ATHandler::resp_stop()
{
if (ATHandler_stub::resp_stop_success_count > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,16 @@ TEST_F(TestAT_CellularSMS, test_AT_CellularSMS_get_sms)
ATHandler_stub::resp_info_false_counter = 1;
ATHandler_stub::resp_info_true_counter2 = 2;
ATHandler_stub::int_value = 11;
ATHandler_stub::read_string_index = 4;
ATHandler_stub::read_string_table[4] = "";
ATHandler_stub::read_string_index = (3 * 2) + (2 * 2); // 3 read_string in list_messages + 2 read_string in read_sms_from_index
ATHandler_stub::read_string_table[10] = "";
// list_messages
ATHandler_stub::read_string_table[9] = "1"; // status
ATHandler_stub::read_string_table[8] = "+00611223344"; // phone
ATHandler_stub::read_string_table[7] = "24/12/12,11:15:00+04"; // timestamp
ATHandler_stub::read_string_table[6] = "1"; // status
ATHandler_stub::read_string_table[5] = "+00611223344"; // phone
ATHandler_stub::read_string_table[4] = "24/12/12,11:15:00+04"; // timestamp
// read_sms_from_index
ATHandler_stub::read_string_table[3] = "REC READ";
ATHandler_stub::read_string_table[2] = "09/01/12,11:15:00+04";
ATHandler_stub::read_string_table[1] = "REC READ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//#include <stdbool.h>
#include "m460_eth.h"
#include "mbed_toolchain.h"
#include "mbed_interface.h"
//#define NU_TRACE
#include "numaker_eth_hal.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <stdbool.h>
#include "m480_eth.h"
#include "mbed_toolchain.h"
#include "mbed_interface.h"
//#define NU_TRACE
#include "numaker_eth_hal.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <stdbool.h>
#include "nuc472_eth.h"
#include "mbed_toolchain.h"
#include "mbed_interface.h"
//#define NU_TRACE
#include "numaker_eth_hal.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void SX126X_LoRaRadio::cold_start_wakeup()
if (MBED_CONF_SX126X_LORA_DRIVER_XTAL == 0) {
#endif
caliberation_params_t calib_param;
set_dio3_as_tcxo_ctrl(TCXO_CTRL_1_7V, 320); //5 ms
set_dio3_as_tcxo_ctrl(MBED_CONF_SX126X_LORA_DRIVER_TCXO_CTRL, 320); //5 ms
calib_param.value = 0x7F;
write_opmode_command(RADIO_CALIBRATE, &calib_param.value, 1);
}
Expand Down
4 changes: 4 additions & 0 deletions connectivity/drivers/lora/COMPONENT_SX126X/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"help": "Default: -1 = use crystal-select, TXCO = 0, XTAL = 1",
"value": -1
},
"tcxo-ctrl": {
"help": "TCXO Control voltage. Default: TCXO control TCXO_CTRL_1_7V (RAK4630 use TCXO_CTRL_3_0V)",
"value": "TCXO_CTRL_1_7V"
},
"spi-mosi": {
"value": "NC"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ bool ESP8266::get_sntp_config(bool *enable, int *timezone, char *server0,
&tmp, timezone, server0, server1, server2)
&& _parser.recv("OK\n");
_smutex.unlock();
*enable = tmp ? true : false;
*enable = (done && tmp) ? true : false;
return done;
}

Expand Down
3 changes: 3 additions & 0 deletions connectivity/lorawan/lorastack/mac/LoRaMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,9 @@ lorawan_status_t LoRaMac::schedule_tx()
if (backoff_time != 0) {
tr_debug("DC enforced: Transmitting in %lu ms", backoff_time);
_can_cancel_tx = true;
if (_device_class != CLASS_C) {
_lora_phy->put_radio_to_sleep();
}
_lora_time.start(_params.timers.backoff_timer, backoff_time);
}
return LORAWAN_STATUS_OK;
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYAS923.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define AS923_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define AS923_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYAU915.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define AU915_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define AU915_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYCN470.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define CN470_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define CN470_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYCN779.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define CN779_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define CN779_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYEU433.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define EU433_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define EU433_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYEU868.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define EU868_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define EU868_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYIN865.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@
/*!
* Default antenna gain
*/
#ifdef LORAPHY_ANTENNA_GAIN
#define IN865_DEFAULT_ANTENNA_GAIN LORAPHY_ANTENNA_GAIN
#else
#define IN865_DEFAULT_ANTENNA_GAIN 2.15f
#endif

/*!
* ADR Ack limit
Expand Down
Loading
Loading