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

removed IIC bus initialization in begin function #33

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Giacomo-Papaluca
Copy link

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description

While trying out a setup with two different TLE493D-p2b6 sensors (A2 and A3) connected to the same IIC bus of an Arduino Teensy 4.0, I encountered malfunctions in communications between the microcontroller and the sensors.
I believe that it is both a logical and a functional mistake to initialize the IIC bus interface (calling mInterface.bus->begin()) inside the void Tle493d::begin(TwoWire &bus, TypeAddress_e slaveAddress, bool reset, uint8_t oneByteRead) method as this functionality should not be handled by the sensor instance. Also, this might cause problems with the IIC interface if multiple sensors are connected to the same bus, as a bus (re)initialization can be performed while it is used by another sensor causing malfunction in the interface.

By removing the bus initialization from the library method and performing it only once in the setup of the microcontroller, everything works fine.

Another solution could be to check wether the bus was already initialized with the isEnabled() method but, as I wrote, I think this kind of functionality shouldn't be handled by the library.

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

Successfully merging this pull request may close these issues.

None yet

1 participant