Skip to content

I2C Transfer fails after soft Reset #5

Open
@MatthieuTanguay

Description

@MatthieuTanguay

Good morning,
I have been experiencing a strange behavior when I am trying to run the SCD example code on a P1AM-200 from Fact Engineering. As found on their website, "this board uses the ATSAMD51P20 Microcontroller like the Adafruit Grand Central M4".

When I try to run the example code out of the box I get the following error:
"Error trying to execute readFirmwareVersion(): Received NACK on transmit of data"

I ran a few different test trying to isolate the issue and the issue originate from the sensor.softReset(); line.

The following code all give the Received NACK on transmit

sensor.stopPeriodicMeasurement();
sensor.softReset();
delay(2000);
sensor.stopPeriodicMeasurement();
sensor.softReset();
delay(5000);
sensor.stopPeriodicMeasurement();
sensor.softReset();

The followoing code works, without the use the softReset();

sensor.stopPeriodicMeasurement();
delay(2000);

The following code works as expected with the softReset();

sensor.stopPeriodicMeasurement();
sensor.softReset();
sensor.stopPeriodicMeasurement();
delay(2000);

This solution seems to be the cleanest one. Line 97 in the Adafruit_SCD30.cpp file gave me this idea.

// first I2C xfer after reset can fail, double tapping seems to get by it

Running the command above in the following order gives the following error: "Error trying to execute readFirmwareVersion(): Wrong CRC found"

sensor.stopPeriodicMeasurement();
sensor.softReset();
delay(2000);
sensor.stopPeriodicMeasurement();

Why would this be happening? Is it the expected behavior of the library?

Thank you in advance.

P.S. I don't write many bug report, please forgive me if it is very lenghty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions