Skip to content

Cellular connection fails on sequential connect #9760

@ghost

Description

Description

mbed-cli: 1.8.3
toolchain: cmake_gcc_arm
gcc-arm-none-eabi: 7-2018-q2-update (7.3.1)
mbed-os: 5.11.1

I'm using the CellularContext as a cellular interface and am running into the issue where I don't get more than one connect working. The connect only works once when I reset the device.

I'm using a non-blocking connect call and am checking for NSAPI_STATUS_GLOBAL_UP to check whether I'm connected. After a connect, I wait for a couple of seconds before disconnecting. Then again waiting a couple of seconds before starting with the connect again. See the code snippet below for what I'm doing as test, where NetworkConnection is a simple class around CellularContext / NetworkInterface.

This is a simplified example from what I'm trying to do in my application

  1. Do some measurements or whatever
  2. Connect to the network
  3. Send some stuff
  4. Disconnect from the network
  5. Go back to 1

See the attached log (0113.log) where I have tracing and AT commands enabled. Also see network_connection.txt for that class.

I don't understand why it would only do this section when I'm connecting for the second time. @AriParkkila any ideas?

Blocking calls don't make any difference.

2019-01-01 13:17:57 [16] Connecting... (submodules/mbed-system/source/main.cpp:334)

[INFO][CELL]: CellularContext set blocking 0

[INFO][CELL]: CellularContext connect

[DBG ][CELL]: checked operation 0 (0)


[DBG ][CELL]: returning
TRACE_DEBUG("Starting network connection test...");
    mbed_trace_init();

    wtg::connectivity::NetworkConnection network_connection;

    for (std::uint8_t i = 0; i < 50; i++) {
        TRACE_DEBUG("Connecting...");
        if (network_connection.Connect()) {
            TRACE_DEBUG("Connected to network: %s", network_connection.IpAddress().c_str());
        }
        TRACE_DEBUG("Done connecting! (%hhu)", network_connection.GetConnectionStatus());


        rtos::ThisThread::sleep_for(5000);


        TRACE_DEBUG("Disconnecting...");
        network_connection.Disconnect();
        TRACE_DEBUG("Done disconnecting! (%hhu)", network_connection.GetConnectionStatus());


        rtos::ThisThread::sleep_for(20000);
        PRINTF("\n\n\n\n\n");
    }

    TRACE_DEBUG("network connection test finished!");

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions