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

AnalogIn corrupted after MeshInterface::get_default_instance(); #326

Open
maclobdell opened this issue Feb 3, 2021 · 1 comment
Open

Comments

@maclobdell
Copy link
Contributor

maclobdell commented Feb 3, 2021

Description of defect

Adding an AnalogIn object to mbed-os-example-mesh-minimal results in corrupted AnalogIn measurement values.

If the AnalogIn measurement is placed before mesh = MeshInterface::get_default_instance(); (or if that line is commented out), then the correct measurements are printed out.

Expected behavior (with get_default_instance() is commented out).
Full scale uint16 (0 to 65,536) measurements as expected.

61978
61986
61984
61994

Actual behavior (with get_default_instance() called before the measurement)
Results limited to 1 decimal digit. Sometimes in different situations the measurements are 2 or 3 digits consistently but they are always random instead of related to the actual analog value.

0
8
1
3
7

Target(s) affected by this defect ?

K64F
NUCLEO_F429ZI

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM

What version of Mbed-os are you using (tag or sha) ?

Mbed 5.15 (b114a9c)
Mbed OS 6.5 (f227856)

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

N/A

How is this defect reproduced ?

Plug in any analog sensor or voltage value (0-3.3V) to an analog input such as A1.

Add the following code to the mbed-os-example-mesh-minimal main.cpp.

AnalogIn water_sensor(A1);
uint16_t water_sensor_value = 0;

First commend out this part:

    mesh = MeshInterface::get_default_instance();
    if (!mesh) {
        printf("Error! MeshInterface not found!\n");
        return -1;
    }

And then add this part:

    while(1){
        water_sensor_value = water_sensor.read_u16();
        printf("%d\r\n",water_sensor_value);
        ThisThread::sleep_for(2000);
    }

Lastly, to recreate the problem, uncomment the section with get_default_instance().

@ciarmcom
Copy link
Member

ciarmcom commented Feb 3, 2021

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3389

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

No branches or pull requests

2 participants