mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12334 from AriParkkila/cell-c030-r412m
Update cellular drivers/tests for UBLOX_C030_R412Mpull/12349/head
commit
e3ad1cae55
TESTS/netsocket
features/cellular/framework/targets/UBLOX
targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030
tools/test_configs
|
@ -204,8 +204,8 @@ Case cases[] = {
|
||||||
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
|
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
|
||||||
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
|
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
|
||||||
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE),
|
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE),
|
||||||
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
|
|
||||||
#ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
|
#ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
|
||||||
|
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
|
||||||
Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE),
|
Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE),
|
||||||
#endif
|
#endif
|
||||||
#if !defined MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES || MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES > MBED_CONF_APP_DNS_TEST_HOSTS_NUM
|
#if !defined MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES || MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES > MBED_CONF_APP_DNS_TEST_HOSTS_NUM
|
||||||
|
|
|
@ -86,6 +86,7 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
|
||||||
|
|
||||||
fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE);
|
fill_tx_buffer_ascii(tx_buffer, BUFF_SIZE);
|
||||||
int packets_sent_prev = packets_sent;
|
int packets_sent_prev = packets_sent;
|
||||||
|
bool is_oversized;
|
||||||
|
|
||||||
for (int retry_cnt = 0; retry_cnt <= 2; retry_cnt++) {
|
for (int retry_cnt = 0; retry_cnt <= 2; retry_cnt++) {
|
||||||
memset(rx_buffer, 0, BUFF_SIZE);
|
memset(rx_buffer, 0, BUFF_SIZE);
|
||||||
|
@ -94,8 +95,10 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
|
||||||
} else {
|
} else {
|
||||||
sent = sock.send(tx_buffer, pkt_s);
|
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");
|
TEST_IGNORE_MESSAGE("This device does not handle oversized packets");
|
||||||
|
break;
|
||||||
} else if (sent == pkt_s) {
|
} else if (sent == pkt_s) {
|
||||||
packets_sent++;
|
packets_sent++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,6 +129,9 @@ void UDPSOCKET_ECHOTEST_impl(bool use_sendto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_oversized) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (use_sendto) {
|
if (use_sendto) {
|
||||||
// Verify received address is correct
|
// Verify received address is correct
|
||||||
TEST_ASSERT(udp_addr == recv_addr);
|
TEST_ASSERT(udp_addr == recv_addr);
|
||||||
|
@ -187,6 +193,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) {
|
for (unsigned int s_idx = 0; s_idx < sizeof(pkt_sizes) / sizeof(*pkt_sizes); ++s_idx) {
|
||||||
int pkt_s = pkt_sizes[s_idx];
|
int pkt_s = pkt_sizes[s_idx];
|
||||||
int packets_sent_prev = packets_sent;
|
int packets_sent_prev = packets_sent;
|
||||||
|
bool is_oversized;
|
||||||
|
|
||||||
for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) {
|
for (int retry_cnt = 0; retry_cnt <= RETRIES; retry_cnt++) {
|
||||||
fill_tx_buffer_ascii(tx_buffer, pkt_s);
|
fill_tx_buffer_ascii(tx_buffer, pkt_s);
|
||||||
|
|
||||||
|
@ -196,7 +204,11 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
|
||||||
sent = sock->send(tx_buffer, pkt_s);
|
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++;
|
packets_sent++;
|
||||||
} else if (sent == NSAPI_ERROR_WOULD_BLOCK) {
|
} else if (sent == NSAPI_ERROR_WOULD_BLOCK) {
|
||||||
if (tc_exec_time.read() >= time_allotted ||
|
if (tc_exec_time.read() >= time_allotted ||
|
||||||
|
@ -237,6 +249,10 @@ void UDPSOCKET_ECHOTEST_NONBLOCK_impl(bool use_sendto)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_oversized) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Make sure that at least one packet of every size was sent.
|
// Make sure that at least one packet of every size was sent.
|
||||||
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
|
TEST_ASSERT_TRUE(packets_sent > packets_sent_prev);
|
||||||
if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {
|
if (memcmp(tx_buffer, rx_buffer, pkt_s) == 0) {
|
||||||
|
|
|
@ -251,7 +251,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
|
||||||
|
|
||||||
timer.start();
|
timer.start();
|
||||||
if (socket->proto == NSAPI_UDP) {
|
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;
|
read_blk = UBLOX_MAX_PACKET_SIZE;
|
||||||
if (read_blk > size) {
|
if (read_blk > size) {
|
||||||
read_blk = size;
|
read_blk = size;
|
||||||
|
@ -266,6 +267,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
|
||||||
usorf_sz = _at.read_int();
|
usorf_sz = _at.read_int();
|
||||||
if (usorf_sz > size) {
|
if (usorf_sz > size) {
|
||||||
usorf_sz = size;
|
usorf_sz = size;
|
||||||
|
} else {
|
||||||
|
packet_received = true;
|
||||||
}
|
}
|
||||||
_at.read_bytes(&ch, 1);
|
_at.read_bytes(&ch, 1);
|
||||||
_at.read_bytes((uint8_t *)buffer + count, usorf_sz);
|
_at.read_bytes((uint8_t *)buffer + count, usorf_sz);
|
||||||
|
@ -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)
|
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];
|
char ipAddress[NSAPI_IP_SIZE];
|
||||||
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
|
nsapi_error_t err = NSAPI_ERROR_DNS_FAILURE;
|
||||||
|
|
||||||
_at.lock();
|
_at.lock();
|
||||||
if (address->set_ip_address(host)) {
|
if (address->set_ip_address(host)) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ UBLOX_PPP::UBLOX_PPP(FileHandle *fh) : AT_CellularDevice(fh)
|
||||||
CellularDevice *CellularDevice::get_default_instance()
|
CellularDevice *CellularDevice::get_default_instance()
|
||||||
{
|
{
|
||||||
static BufferedSerial serial(MBED_CONF_UBLOX_PPP_TX, MBED_CONF_UBLOX_PPP_RX, MBED_CONF_UBLOX_PPP_BAUDRATE);
|
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);
|
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);
|
serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_UBLOX_PPP_RTS, MBED_CONF_UBLOX_PPP_CTS);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,8 +26,13 @@ using namespace mbed;
|
||||||
CellularDevice *CellularDevice::get_target_default_instance()
|
CellularDevice *CellularDevice::get_target_default_instance()
|
||||||
{
|
{
|
||||||
#if defined(TARGET_UBLOX_C030_R41XM)
|
#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 BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
||||||
static ONBOARD_UBLOX_AT device(&serial);
|
static ONBOARD_UBLOX_AT device(&serial);
|
||||||
|
#endif
|
||||||
#elif defined(TARGET_UBLOX_C030_N211)
|
#elif defined(TARGET_UBLOX_C030_N211)
|
||||||
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
static BufferedSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
|
||||||
static ONBOARD_UBLOX_N2XX device(&serial);
|
static ONBOARD_UBLOX_N2XX device(&serial);
|
||||||
|
|
|
@ -43,6 +43,11 @@
|
||||||
"lwip.ppp-enabled": true,
|
"lwip.ppp-enabled": true,
|
||||||
"lwip.ethernet-enabled": false,
|
"lwip.ethernet-enabled": false,
|
||||||
"cellular.debug-at": false
|
"cellular.debug-at": false
|
||||||
|
},
|
||||||
|
"UBLOX_C030_R412M": {
|
||||||
|
"platform.stdio-convert-newlines": true,
|
||||||
|
"platform.stdio-baud-rate": 115200,
|
||||||
|
"platform.default-serial-baud-rate": 115200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue