Skip to content

Commit e3ad1ca

Browse files
authored
Merge pull request #12334 from AriParkkila/cell-c030-r412m
Update cellular drivers/tests for UBLOX_C030_R412M
2 parents edb39c6 + 4da93bf commit e3ad1ca

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

TESTS/netsocket/dns/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ Case cases[] = {
204204
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
205205
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
206206
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE),
207-
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
208207
#ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
208+
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
209209
Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE),
210210
#endif
211211
#if !defined MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES || MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES > MBED_CONF_APP_DNS_TEST_HOSTS_NUM

TESTS/netsocket/udp/udpsocket_echotest.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
8686

8787
fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE);
8888
int packets_sent_prev = packets_sent;
89+
bool is_oversized;
8990

9091
for (int retry_cnt = 0; retry_cnt <= 2; retry_cnt++) {
9192
memset(rx_buffer, 0, BUFF_SIZE);
@@ -94,8 +95,10 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
9495
} else {
9596
sent = sock.send(tx_buffer, pkt_s);
9697
}
97-
if (check_oversized_packets(sent, pkt_s)) {
98+
is_oversized = check_oversized_packets(sent, pkt_s);
99+
if (is_oversized) {
98100
TEST_IGNORE_MESSAGE("This device does not handle oversized packets");
101+
break;
99102
} else if (sent == pkt_s) {
100103
packets_sent++;
101104
} else {
@@ -126,6 +129,9 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
126129
}
127130
}
128131

132+
if (is_oversized) {
133+
continue;
134+
}
129135
if (use_sendto) {
130136
// Verify received address is correct
131137
TEST_ASSERT(udp_addr == recv_addr);
@@ -187,6 +193,8 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
187193
for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
188194
int pkt_s = pkt_sizes[s_idx];
189195
int packets_sent_prev = packets_sent;
196+
bool is_oversized;
197+
190198
for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) {
191199
fill_tx_buffer_ascii(tx_buffer, pkt_s);
192200

@@ -196,7 +204,11 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
196204
sent = sock->send(tx_buffer, pkt_s);
197205
}
198206

199-
if (sent == pkt_s) {
207+
is_oversized = check_oversized_packets(sent, pkt_s);
208+
if (is_oversized) {
209+
TEST_IGNORE_MESSAGE("This device does not handle oversized packets");
210+
break;
211+
} else if (sent == pkt_s) {
200212
packets_sent++;
201213
} else if (sent == NSAPI_ERROR_WOULD_BLOCK) {
202214
if (tc_exec_time.read() >= time_allotted ||
@@ -237,6 +249,10 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
237249
break;
238250
}
239251
}
252+
253+
if (is_oversized) {
254+
continue;
255+
}
240256
// Make sure that at least one packet of every size was sent.
241257
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
242258
if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
251251

252252
timer.start();
253253
if (socket->proto == NSAPI_UDP) {
254-
while (success && (size > 0)) {
254+
bool packet_received = false;
255+
while (success && (size > 0 && !packet_received)) {
255256
read_blk = UBLOX_MAX_PACKET_SIZE;
256257
if (read_blk > size) {
257258
read_blk = size;
@@ -266,6 +267,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
266267
usorf_sz = _at.read_int();
267268
if (usorf_sz > size) {
268269
usorf_sz = size;
270+
} else {
271+
packet_received = true;
269272
}
270273
_at.read_bytes(&ch, 1);
271274
_at.read_bytes((uint8_t *)buffer + count, usorf_sz);
@@ -453,7 +456,7 @@ nsapi_error_t UBLOX_AT_CellularStack::get_ip_address(SocketAddress *address)
453456
nsapi_error_t UBLOX_AT_CellularStack::gethostbyname(const char *host, SocketAddress *address, nsapi_version_t version, const char *interface_name)
454457
{
455458
char ipAddress[NSAPI_IP_SIZE];
456-
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
459+
nsapi_error_t err = NSAPI_ERROR_DNS_FAILURE;
457460

458461
_at.lock();
459462
if (address->set_ip_address(host)) {

features/cellular/framework/targets/UBLOX/PPP/UBLOX_PPP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
111111
CellularDevice *CellularDevice::get_default_instance()
112112
{
113113
static BufferedSerial serial(MBED_CONF_UBLOX_PPP_TX, MBED_CONF_UBLOX_PPP_RX, MBED_CONF_UBLOX_PPP_BAUDRATE);
114-
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
114+
#if defined (MBED_CONF_UBLOX_PPP_RTS) && defined(MBED_CONF_UBLOX_PPP_CTS)
115115
tr_debug("UBLOX_PPP flow control: RTS %d CTS %d", MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
116116
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
117117
#endif

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ using namespace mbed;
2626
CellularDevice *CellularDevice::get_target_default_instance()
2727
{
2828
#if defined(TARGET_UBLOX_C030_R41XM)
29+
#if (NSAPI_PPP_AVAILABLE)
30+
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
31+
static ONBOARD_UBLOX_PPP device(&serial);
32+
#else
2933
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
3034
static ONBOARD_UBLOX_AT device(&serial);
35+
#endif
3136
#elif defined(TARGET_UBLOX_C030_N211)
3237
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
3338
static ONBOARD_UBLOX_N2XX device(&serial);

tools/test_configs/CellularInterface.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"lwip.ppp-enabled": true,
4444
"lwip.ethernet-enabled": false,
4545
"cellular.debug-at": false
46+
},
47+
"UBLOX_C030_R412M": {
48+
"platform.stdio-convert-newlines": true,
49+
"platform.stdio-baud-rate": 115200,
50+
"platform.default-serial-baud-rate": 115200
4651
}
4752
}
4853
}

0 commit comments

Comments
 (0)