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

Enable hwfc for Quectel modem during runtime and add support for EG91-EX #2042

Merged

Conversation

YutingYou
Copy link
Contributor

@YutingYou YutingYou commented Mar 3, 2020

Problem

The pre-production B5SoM boards don't support hardware flow control. To distinguish them from the new b5som boards, we're going to automatically enable hwfc by detecting the hardware version.

This PR adds two features:

  1. Enable hwfc for Quectel modem during runtime
  2. Add support for EG91-EX

Solution

Steps to Test

We don't have the new B5SoM boards on hand, provide a rough test app.

Example App

#include "application.h"
#include "deviceid_hal.h"
#include "exflash_hal.h"

SYSTEM_MODE(MANUAL);

Serial1LogHandler logHandler(115200, LOG_LEVEL_ALL, {
    {"app", LOG_LEVEL_ALL},
    {"ncp", LOG_LEVEL_ALL},
    {"hal.ble", LOG_LEVEL_WARN},
    {"lwip", LOG_LEVEL_WARN},
    {"ot", LOG_LEVEL_WARN},
    {"sys", LOG_LEVEL_WARN},
    {"system", LOG_LEVEL_WARN}}
);

void setup(void) {
}

void loop() {
    uint8_t hw_data[4] = {};
    int r = hal_exflash_read_special(HAL_EXFLASH_SPECIAL_SECTOR_OTP, 32, hw_data, sizeof(hw_data));
    if (!r) {
        Log.info("OTP area dump: NCP_ID: %x HW_VER: %x Feature_Flags: %x %x", hw_data[0], hw_data[1], hw_data[2], hw_data[3]);
    } else {
        Log.error("r: %d", r);
    }

    uint32_t hw_version;
    if (hal_get_device_hw_version(&hw_version, nullptr) == SYSTEM_ERROR_NONE) {
        Log.info("hw version: %d", hw_version);
        if (hw_version== hw_data[1]) {
            Log.info("TEST PASSED!");
        } else {
            Log.info("TEST FAILED!");
        }
    } else {
        Log.info("TEST FAILED!");
    }

    delay(10000);
}

References

[CH47749]


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

@YutingYou YutingYou added this to the 1.5.0-rc.2 milestone Mar 3, 2020
@YutingYou YutingYou requested a review from avtolstoy March 3, 2020 04:31
hal/inc/deviceid_hal.h Outdated Show resolved Hide resolved
hal/src/b5som/network/quectel_ncp_client.cpp Outdated Show resolved Hide resolved
hal/src/b5som/network/quectel_ncp_client.cpp Outdated Show resolved Hide resolved
hal/src/nRF52840/deviceid_hal.cpp Outdated Show resolved Hide resolved
@avtolstoy avtolstoy added the ready to merge PR has been reviewed and tested label Mar 3, 2020
@avtolstoy avtolstoy merged commit 1f92f78 into develop Mar 3, 2020
@avtolstoy avtolstoy deleted the ch47749/enable-hwfc-for-Quectel-modem-during-runtime branch March 3, 2020 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ready to merge PR has been reviewed and tested
Projects
None yet
2 participants