Skip to content
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

Fix Ublox C030 SARA-R412M onboard cellular device serial (target default instance). #15148

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

phlegx
Copy link

@phlegx phlegx commented Oct 21, 2021

Summary of changes

Whit the following mbed_app.json config example, the ONBOARD_UBLOX target is used and the serial connection to the Ublox module can work properly.

"target_overrides": {
    "*": {
        "platform.stdio-convert-newlines": true,
        "platform.stdio-baud-rate": 115200,
        "platform.default-serial-baud-rate": 115200,
        "mbed-trace.enable": true,
        "cellular.debug-at": true,
        "cellular.use-apn-lookup": true,
        "nsapi.default-cellular-apn": "\"some.provider.com\"",
        "nsapi.default-cellular-plmn": null,
        "nsapi.default-cellular-sim-pin": null,
        "nsapi.default-cellular-username": null,
        "nsapi.default-cellular-password": null,
        "lwip.ipv4-enabled": true,
        "lwip.ipv6-enabled": true,
        "lwip.tcp-enabled": true,
        "lwip.ethernet-enabled": false,
        "lwip.ppp-enabled": false,
        "ppp.ipv4-enabled": false,
        "ppp.ipv6-enabled": false
    },
    "UBLOX_C030_R412M": {
        "target.features_add": ["STORAGE"],
        "target.components_add": ["SD"],
        "target.network-default-interface-type": "CELLULAR",
        "storage.storage_type": "FILESYSTEM",
        "sd.SPI_MOSI": "SPI_MOSI",
        "sd.SPI_MISO": "SPI_MISO",
        "sd.SPI_CLK": "SPI_CLK",
        "sd.SPI_CS": "SPI_NSS"
    }
}

Bugfix on ONBOARD_UBLOX.cpp#L30 adding line serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);.

With the correct serial flow control, the serial connection is stable and don't get lost.

CellularDevice *CellularDevice::get_target_default_instance()
{
#if defined(TARGET_UBLOX_C030_R41XM)
    static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
    serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS); // <---------- Bugfix
    static ONBOARD_UBLOX_AT device(&serial);
#elif defined(TARGET_UBLOX_C030_N211)
...

The discussion about this bug can be found on issue #15143.

Impact of changes

Migration actions required

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[X] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@RobMeades @0xc0170


Copy link
Contributor

@RobMeades RobMeades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@phlegx
Copy link
Author

phlegx commented Oct 21, 2021

Thanks to @RobMeades for his advice and help in this issue!

@ciarmcom ciarmcom requested review from 0xc0170, RobMeades and a team October 21, 2021 12:30
@ciarmcom
Copy link
Member

@phlegx, thank you for your changes.
@0xc0170 @RobMeades @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 21, 2021

Thank you both for fixing this

@0xc0170 0xc0170 requested a review from andypowers October 21, 2021 14:01
@phlegx
Copy link
Author

phlegx commented Oct 21, 2021

@RobMeades you need to re-review.

Copy link
Contributor

@RobMeades RobMeades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me still! Thanks for all the hard work @phlegx.

Copy link
Collaborator

@andypowers andypowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@phlegx
Copy link
Author

phlegx commented Oct 22, 2021

Thank you all for the reviews. I'm not authorized to merge this pull request. Are any of you authorized?

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 22, 2021

Thank you all for the reviews. I'm not authorized to merge this pull request. Are any of you authorized?

I'll start CI . Once green, we can merge.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 22, 2021

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Oct 22, 2021
@mbed-ci
Copy link

mbed-ci commented Oct 22, 2021

Test run: FAILED

Summary: 1 of 9 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_example-test-lts

@phlegx
Copy link
Author

phlegx commented Oct 22, 2021

I don't know what kind of test this is and if it is related to this bugfix.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 22, 2021

Test passed but then timeouted, not related. I restarted it

@mergify mergify bot removed the needs: CI label Oct 22, 2021
@mbed-ci
Copy link

mbed-ci commented Oct 22, 2021

Test run: FAILED

Summary: 1 of 9 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_example-test-lts

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 22, 2021

This is internal error, I'll report it to our test team

@mbed-ci
Copy link

mbed-ci commented Oct 22, 2021

Test run: FAILED

Summary: 1 of 9 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_example-test-lts

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 25, 2021

We need to review internal CI to find a root cause for this. We will get back to this PR once it's resolved

@mbed-ci
Copy link

mbed-ci commented Oct 25, 2021

Test run: SUCCESS

Summary: 9 of 9 test jobs passed
Build number : 4
Build artifacts

@phlegx
Copy link
Author

phlegx commented Mar 15, 2022

Notice: could also be added like in related Ublox files of other targets:

#if DEVICE_SERIAL_FC
    if (MDMRTS != NC && MDMCTS != NC) {
        tr_debug("Modem flow control: RTS %d CTS %d", MDMRTS, MDMCTS);
        serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
    }
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants