Skip to content

Commit 7fd4692

Browse files
authored
Merge pull request #8862 from 0xc0170/dev_rollup
Rollup 5.11rc v3
2 parents 0283bb8 + 6c1c169 commit 7fd4692

File tree

18 files changed

+265
-194
lines changed

18 files changed

+265
-194
lines changed

TESTS/netsocket/tcp/tcpsocket_echotest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace utest::v1;
2626

2727
namespace {
2828
static const int SIGNAL_SIGIO = 0x1;
29-
static const int SIGIO_TIMEOUT = 5000; //[ms]
29+
static const int SIGIO_TIMEOUT = 20000; //[ms]
3030

3131
static const int BUFF_SIZE = 1200;
3232
static const int PKTS = 22;

TESTS/netsocket/tcp/tcpsocket_echotest_burst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace utest::v1;
2626

2727
namespace {
2828
static const int SIGNAL_SIGIO = 0x1;
29-
static const int SIGIO_TIMEOUT = 5000; //[ms]
29+
static const int SIGIO_TIMEOUT = 20000; //[ms]
3030

3131
static const int BURST_CNT = 100;
3232
static const int BURST_SIZE = 1220;

TESTS/netsocket/tcp/tcpsocket_endpoint_close.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace utest::v1;
2626

2727
namespace {
2828
static const int SIGNAL_SIGIO = 0x1;
29-
static const int SIGIO_TIMEOUT = 5000; //[ms]
29+
static const int SIGIO_TIMEOUT = 20000; //[ms]
3030
}
3131

3232
static void _sigio_handler(osThreadId id)

TESTS/netsocket/tcp/tcpsocket_recv_timeout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace utest::v1;
2626

2727
namespace {
2828
static const int SIGNAL_SIGIO = 0x1;
29-
static const int SIGIO_TIMEOUT = 5000; //[ms]
29+
static const int SIGIO_TIMEOUT = 20000; //[ms]
3030
}
3131

3232
static void _sigio_handler(osThreadId id)

TESTS/netsocket/tcp/tcpsocket_thread_per_socket_safety.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using namespace utest::v1;
2727
namespace {
2828
static const int SIGNAL_SIGIO1 = 0x1;
2929
static const int SIGNAL_SIGIO2 = 0x2;
30-
static const int SIGIO_TIMEOUT = 5000; //[ms]
30+
static const int SIGIO_TIMEOUT = 20000; //[ms]
3131

3232
Thread thread(osPriorityNormal, tcp_global::TCP_OS_STACK_SIZE);
3333
volatile bool running = true;

components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp

Lines changed: 192 additions & 166 deletions
Large diffs are not rendered by default.

features/cellular/framework/API/CellularNetwork.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class CellularNetwork {
230230
*/
231231
virtual nsapi_error_t get_attach(AttachStatus &status) = 0;
232232

233-
/** Request detach from a network.
233+
/** Request detach and deregister from a network.
234234
*
235235
* @return NSAPI_ERROR_OK on success
236236
* NSAPI_ERROR_DEVICE_ERROR on failure

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char
7272
_previous_at_timeout(timeout),
7373
_at_send_delay(send_delay),
7474
_last_response_stop(0),
75-
_fh_sigio_set(false),
7675
_processing(false),
7776
_ref_count(1),
7877
_is_fh_usable(true),
@@ -109,9 +108,7 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char
109108
set_tag(&_info_stop, CRLF);
110109
set_tag(&_elem_stop, ")");
111110

112-
_fileHandle->set_blocking(false);
113-
114-
set_filehandle_sigio();
111+
set_file_handle(fh);
115112
}
116113

117114
void ATHandler::set_debug(bool debug_on)
@@ -154,6 +151,8 @@ FileHandle *ATHandler::get_file_handle()
154151
void ATHandler::set_file_handle(FileHandle *fh)
155152
{
156153
_fileHandle = fh;
154+
_fileHandle->set_blocking(false);
155+
set_filehandle_sigio();
157156
}
158157

159158
void ATHandler::set_is_filehandle_usable(bool usable)
@@ -312,11 +311,7 @@ void ATHandler::process_oob()
312311

313312
void ATHandler::set_filehandle_sigio()
314313
{
315-
if (_fh_sigio_set) {
316-
return;
317-
}
318314
_fileHandle->sigio(mbed::Callback<void()>(this, &ATHandler::event));
319-
_fh_sigio_set = true;
320315
}
321316

322317
void ATHandler::reset_buffer()
@@ -1230,3 +1225,26 @@ void ATHandler::debug_print(const char *p, int len)
12301225
}
12311226
#endif // MBED_CONF_CELLULAR_DEBUG_AT
12321227
}
1228+
1229+
bool ATHandler::sync(int timeout_ms)
1230+
{
1231+
tr_debug("AT sync");
1232+
// poll for 10 seconds
1233+
for (int i = 0; i < 10; i++) {
1234+
lock();
1235+
set_at_timeout(timeout_ms, false);
1236+
// For sync use an AT command that is supported by all modems and likely not used frequently,
1237+
// especially a common response like OK could be response to previous request.
1238+
cmd_start("AT+CMEE?");
1239+
cmd_stop();
1240+
resp_start("+CMEE:");
1241+
resp_stop();
1242+
restore_at_timeout();
1243+
unlock();
1244+
if (!_last_err) {
1245+
return true;
1246+
}
1247+
}
1248+
tr_error("AT sync failed");
1249+
return false;
1250+
}

features/cellular/framework/AT/ATHandler.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ class ATHandler {
181181
*/
182182
void set_is_filehandle_usable(bool usable);
183183

184+
/** Synchronize AT command and response handling to modem.
185+
*
186+
* @param timeout_ms ATHandler timeout when trying to sync. Will be restored when function returns.
187+
* @return true is synchronization was successful, false in case of failure
188+
*/
189+
bool sync(int timeout_ms);
190+
184191
protected:
185192
void event();
186193
#ifdef AT_HANDLER_MUTEX
@@ -211,8 +218,6 @@ class ATHandler {
211218
uint16_t _at_send_delay;
212219
uint64_t _last_response_stop;
213220

214-
bool _fh_sigio_set;
215-
216221
bool _processing;
217222
int32_t _ref_count;
218223
bool _is_fh_usable;

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define DEVICE_TIMEOUT 5 * 60 * 1000 // 5 minutes
2929

3030
#if NSAPI_PPP_AVAILABLE
31+
#define AT_SYNC_TIMEOUT 1000 // 1 second timeout
3132
#include "nsapi_ppp.h"
3233
#endif
3334

@@ -557,6 +558,8 @@ void AT_CellularContext::do_connect()
557558
tr_error("Failed to open data channel!");
558559
call_network_cb(NSAPI_STATUS_DISCONNECTED);
559560
_is_connected = false;
561+
} else {
562+
_is_context_activated = true;
560563
}
561564
}
562565
#else
@@ -630,13 +633,17 @@ nsapi_error_t AT_CellularContext::disconnect()
630633
_at.lock();
631634
_at.set_file_handle(_at.get_file_handle());
632635
_at.set_is_filehandle_usable(true);
633-
//_at.sync(); // consume extra characters after ppp disconnect, also it may take a while until modem listens AT commands
636+
if (!_at.sync(AT_SYNC_TIMEOUT)) { // consume extra characters after ppp disconnect, also it may take a while until modem listens AT commands
637+
tr_error("AT sync failed after PPP Disconnect");
638+
}
634639
_at.unlock();
635640
#endif // NSAPI_PPP_AVAILABLE
636641
_at.lock();
637642

638643
// deactivate a context only if we have activated
639644
if (_is_context_activated) {
645+
// CGACT and CGATT commands might take up to 3 minutes to respond.
646+
_at.set_at_timeout(180 * 1000);
640647
_is_context_active = false;
641648
size_t active_contexts_count = 0;
642649
_at.cmd_start("AT+CGACT?");
@@ -662,17 +669,27 @@ nsapi_error_t AT_CellularContext::disconnect()
662669
// 3GPP TS 27.007:
663670
// For EPS, if an attempt is made to disconnect the last PDN connection, then the MT responds with ERROR
664671
if (_is_context_active && (rat < CellularNetwork::RAT_E_UTRAN || active_contexts_count > 1)) {
672+
_at.clear_error();
665673
_at.cmd_start("AT+CGACT=0,");
666674
_at.write_int(_cid);
667675
_at.cmd_stop_read_resp();
668676
}
669-
}
670677

671-
if (!_at.get_last_error()) {
672-
_is_connected = false;
673-
call_network_cb(NSAPI_STATUS_DISCONNECTED);
678+
if (_new_context_set) {
679+
_at.clear_error();
680+
_at.cmd_start("AT+CGDCONT=");
681+
_at.write_int(_cid);
682+
_at.cmd_stop_read_resp();
683+
}
684+
_at.clear_error();
685+
_at.cmd_start("AT+CGATT=0");
686+
_at.cmd_stop_read_resp();
687+
_at.restore_at_timeout();
674688
}
675689

690+
_is_connected = false;
691+
call_network_cb(NSAPI_STATUS_DISCONNECTED);
692+
676693
return _at.unlock_return_error();
677694
}
678695

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ nsapi_error_t AT_CellularNetwork::detach()
361361
_at.cmd_start("AT+CGATT=0");
362362
_at.cmd_stop_read_resp();
363363

364+
_at.cmd_start("AT+COPS=2");
365+
_at.cmd_stop_read_resp();
366+
364367
call_network_cb(NSAPI_STATUS_DISCONNECTED);
365368

366369
return _at.unlock_return_error();

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularNetwork.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ AT_CellularNetwork::RegistrationMode QUECTEL_BC95_CellularNetwork::has_registrat
3636
nsapi_error_t QUECTEL_BC95_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat)
3737
{
3838
if (opRat != RAT_NB1) {
39-
//TODO: Set as unknown or force to NB1?
40-
_op_act = RAT_UNKNOWN;
39+
// only rat that is supported by this modem
40+
_op_act = RAT_NB1;
4141
return NSAPI_ERROR_UNSUPPORTED;
4242
}
4343

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/PinNames.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ typedef enum {
117117
// ADC internal channels
118118
ADC_TEMP = 0xF0,
119119
ADC_VREF = 0xF1,
120-
ADC_VBAT = 0xF2,
121120

122121
// Arduino connector namings
123122
A0 = PA_0,

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/PinNames.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ typedef enum {
115115
// ADC internal channels
116116
ADC_TEMP = 0xF0,
117117
ADC_VREF = 0xF1,
118-
ADC_VBAT = 0xF2,
119118

120119
// Arduino connector namings
121120
A0 = PA_0,

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/TARGET_DISCO_F746NG/system_clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
**/
3131

3232
#include "stm32f7xx.h"
33+
#include "nvic_addr.h"
3334
#include "mbed_error.h"
3435

3536
/*!< Uncomment the following line if you need to relocate your vector Table in
@@ -92,7 +93,7 @@ void SystemInit(void)
9293
#ifdef VECT_TAB_SRAM
9394
SCB->VTOR = RAMDTCM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
9495
#else
95-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
96+
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; /* Vector Table Relocation in Internal FLASH */
9697
#endif
9798

9899
}

targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ/TARGET_DISCO_L072CZ_LRWAN1/PinNames.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ typedef enum {
100100
// ADC internal channels
101101
ADC_TEMP = 0xF0,
102102
ADC_VREF = 0xF1,
103-
ADC_VBAT = 0xF2,
104103

105104
// Arduino connector namings
106105
A0 = PA_0,

targets/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3460,6 +3460,7 @@
34603460
],
34613461
"release_versions": ["2", "5"],
34623462
"device_name": "STM32F746NG",
3463+
"bootloader_supported": true,
34633464
"overrides": {
34643465
"network-default-interface-type": "ETHERNET"
34653466
}
@@ -7299,7 +7300,7 @@
72997300
"USTICKER"
73007301
],
73017302
"device_name": "TMPM4G9F15FG",
7302-
"detect_code": ["7016"],
7303+
"detect_code": ["7015"],
73037304
"release_versions": ["5"],
73047305
"bootloader_supported": true
73057306
},

tools/export/iar/iar_definitions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@
129129
"STM32F439ZI": {
130130
"OGChipSelectEditMenu": "STM32F439ZI\tST STM32F439ZI"
131131
},
132+
"STM32F439VI": {
133+
"OGChipSelectEditMenu": "STM32F439VI\tST STM32F439VI"
134+
},
132135
"LPC1768": {
133136
"OGChipSelectEditMenu": "LPC1768\tNXP LPC1768"
134137
},

0 commit comments

Comments
 (0)