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
I2C external responds to multiple addresses #4
Comments
Hi Andrei
Thank you for pointing this out. I need to look into this but I'm quite sure you're right...
regards
lukas
From: Andrei Stoica [mailto:notifications@github.com]
Sent: Donnerstag, 2. November 2017 11:45
To: soldernerd/UltrasonicAnemometer
Cc: Subscribed
Subject: [soldernerd/UltrasonicAnemometer] I2C external responds to multiple addresses (#4)
Hi,
First of all thanks for sharing this nice project with the open-source community! Your work is great!
One thing I have noticed by trying out your code for the external I2C communication is that it responds to other addresses except the one selected by firmware and the 0x00 address for the general call. As I understand from your code this is not the desired behavior as you would like to have the device answer to its own fixed address, say 0x51.
I know the PIC32 MCU used needs to explicitly be told to lock only onto the given address and ignore the other calls on going on the bus and this is what is done here (app_i2c_external.c#L106)
PLIB_I2C_ReservedAddressProtectEnable(I2C_EXTERNAL);
However, as a higher degree of selectivity the PIC32 has also a mask for addressing which runs on top of the selected address. The call to (app_i2c_external.c#L112)
PLIB_I2C_SlaveMask7BitSet (I2C_EXTERNAL, 0xFF);
acts as a wildcard and actually makes the MCU respond as a slave to almost all the addresses on the bus (i.e. except the protected ones on I2C 0x01-0x08).
As a fix to achieve your desired behavior you should explicitly set
PLIB_I2C_SlaveMask7BitSet (I2C_EXTERNAL, 0x00);
and in this way only the desired address will be replied to (e.g. 0x51), and respectively, 0x00 as the general call address.
This behaviour is documented in section 24 of the MCU detailed <http://ww1.microchip.com/downloads/en/DeviceDoc/61116F.pdf> datasheet
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on <#4> GitHub, or mute <https://github.com/notifications/unsubscribe-auth/ANb3AMl1M9vg7-voGy0vHW09PkbkNGpaks5syZ0hgaJpZM4QPfH0> the thread. <https://github.com/notifications/beacon/ANb3AFmXzo-tRZqdmz_0j_Xne6cagzugks5syZ0hgaJpZM4QPfH0.gif>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
First of all thanks for sharing this nice project with the open-source community! Your work is great!
One thing I have noticed by trying out your code for the external I2C communication is that it responds to other addresses except the one selected by firmware and the 0x00 address for the general call. As I understand from your code this is not the desired behavior as you would like to have the device answer to its own fixed address, say 0x51.
I know the PIC32 MCU used needs to explicitly be told to lock only onto the given address and ignore the other calls on going on the bus and this is what is done here (app_i2c_external.c#L106)
However, as a higher degree of selectivity the PIC32 has also a mask for addressing which runs on top of the selected address. The call to (app_i2c_external.c#L112)
acts as a wildcard and actually makes the MCU respond as a slave to almost all the addresses on the bus (i.e. except the protected ones on I2C 0x01-0x08).
As a fix to achieve your desired behavior you should explicitly set
and in this way only the desired address will be replied to (e.g. 0x51), and respectively, 0x00 as the general call address.
This behaviour is documented in section 24 of the MCU detailed datasheet
The text was updated successfully, but these errors were encountered: