Skip to content

Update cellular drivers/tests for UBLOX_C030_R412M #12334

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

Merged
merged 5 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion TESTS/netsocket/dns/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ Case cases[] = {
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE),
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
#ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE),
#endif
#if !defined MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES || MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES > MBED_CONF_APP_DNS_TEST_HOSTS_NUM
Expand Down
20 changes: 18 additions & 2 deletions TESTS/netsocket/udp/udpsocket_echotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)

fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE);
int packets_sent_prev = packets_sent;
bool is_oversized;

for (int retry_cnt = 0; retry_cnt <= 2; retry_cnt++) {
memset(rx_buffer, 0, BUFF_SIZE);
Expand All @@ -94,8 +95,10 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
} else {
sent = sock.send(tx_buffer, pkt_s);
}
if (check_oversized_packets(sent, pkt_s)) {
is_oversized = check_oversized_packets(sent, pkt_s);
if (is_oversized) {
TEST_IGNORE_MESSAGE("This device does not handle oversized packets");
break;
} else if (sent == pkt_s) {
packets_sent++;
} else {
Expand Down Expand Up @@ -127,6 +130,9 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
}
}

if (is_oversized) {
continue;
}
if (use_sendto) {
// Verify received address is correct
TEST_ASSERT(udp_addr == recv_addr);
Expand Down Expand Up @@ -188,6 +194,8 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
int pkt_s = pkt_sizes[s_idx];
int packets_sent_prev = packets_sent;
bool is_oversized;

for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) {
fill_tx_buffer_ascii(tx_buffer, pkt_s);

Expand All @@ -197,7 +205,11 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
sent = sock->send(tx_buffer, pkt_s);
}

if (sent == pkt_s) {
is_oversized = check_oversized_packets(sent, pkt_s);
if (is_oversized) {
TEST_IGNORE_MESSAGE("This device does not handle oversized packets");
break;
} else if (sent == pkt_s) {
packets_sent++;
} else if (sent == NSAPI_ERROR_WOULD_BLOCK) {
if (tc_exec_time.read() >= time_allotted ||
Expand Down Expand Up @@ -239,6 +251,10 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
break;
}
}

if (is_oversized) {
continue;
}
// Make sure that at least one packet of every size was sent.
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke

timer.start();
if (socket->proto == NSAPI_UDP) {
while (success && (size > 0)) {
bool packet_received = false;
while (success && (size > 0 && !packet_received)) {
read_blk = UBLOX_MAX_PACKET_SIZE;
if (read_blk > size) {
read_blk = size;
Expand All @@ -266,6 +267,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
usorf_sz = _at.read_int();
if (usorf_sz > size) {
usorf_sz = size;
} else {
packet_received = true;
}
_at.read_bytes(&ch, 1);
_at.read_bytes((uint8_t *)buffer + count, usorf_sz);
Expand Down Expand Up @@ -453,7 +456,7 @@ nsapi_error_t UBLOX_AT_CellularStack::get_ip_address(SocketAddress *address)
nsapi_error_t UBLOX_AT_CellularStack::gethostbyname(const char *host, SocketAddress *address, nsapi_version_t version, const char *interface_name)
{
char ipAddress[NSAPI_IP_SIZE];
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
nsapi_error_t err = NSAPI_ERROR_DNS_FAILURE;

_at.lock();
if (address->set_ip_address(host)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
CellularDevice *CellularDevice::get_default_instance()
{
static BufferedSerial serial(MBED_CONF_UBLOX_PPP_TX, MBED_CONF_UBLOX_PPP_RX, MBED_CONF_UBLOX_PPP_BAUDRATE);
#if defined (MBED_CONF_UBLOX_AT_RTS) && defined(MBED_CONF_UBLOX_AT_CTS)
#if defined (MBED_CONF_UBLOX_PPP_RTS) && defined(MBED_CONF_UBLOX_PPP_CTS)
tr_debug("UBLOX_PPP flow control: RTS %d CTS %d", MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ using namespace mbed;
CellularDevice *CellularDevice::get_target_default_instance()
{
#if defined(TARGET_UBLOX_C030_R41XM)
#if (NSAPI_PPP_AVAILABLE)
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_PPP device(&serial);
#else
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_AT device(&serial);
#endif
#elif defined(TARGET_UBLOX_C030_N211)
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
static ONBOARD_UBLOX_N2XX device(&serial);
Expand Down
5 changes: 5 additions & 0 deletions tools/test_configs/CellularInterface.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
"lwip.ppp-enabled": true,
"lwip.ethernet-enabled": false,
"cellular.debug-at": false
},
"UBLOX_C030_R412M": {
"platform.stdio-convert-newlines": true,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200
}
}
}