View previous topic :: View next topic |
Author |
Message |
camleot23
Joined: 16 Aug 2019 Posts: 52
|
i2c Scanner starts counting from 10 to the last point |
Posted: Thu Aug 22, 2019 6:53 am |
|
|
Hello All,
I use I2C Scanner functions which I got from this forum. I have a real hardware, 1 LCD with I2C, 1 pic, 1 Arduino. Pic is master, Arduino is slave. I want to communicate with them via I2C protocol. When I connect them together at first it worked and i2c scanner gave me their addresses correctly which are 4E and 3C. Then, I plugged out the power (which is the same Arduino) after I plugged in the Arduino, I2C scanner started to count from 10 and increased by 2 every time. I didn't wait for the last point but I suppose it would count to the last point. I don't understand why this happened. When I try to load my program while the system was on and i2c scanner was giving me addresses, it again started from the beginning.
Do you have any idea why this happened? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Thu Aug 22, 2019 7:15 am |
|
|
I2C scanner _should_ count from 0x10, and count in 2's.
Addresses below 0x10, are 'reserved' in I2C. Hence no point in scanning these
Also in 8bit I2C addressing, the 'even' addresses are the write addresses,
and the odd addresses are the read address for the same device. The
I2C scanner 'works' by testing for the acknowledge from a writable
device, so only tests the even addresses.
So I2C scanner is doing what it should. If it is not reporting the devices
it is because the devices are not working. Sounds as if something has
not woken up correctly in your switching on/off. This is always a thing
to be careful when doing. |
|
|
camleot23
Joined: 16 Aug 2019 Posts: 52
|
|
Posted: Thu Aug 22, 2019 7:24 am |
|
|
Ttelmah you didn't get what I meant. I wanted to say, I2C scanner thinks there are devices because it is printing that values to serial port and then it says that much devices found (more than 2) . But I just have 2 slaves.I didn't ask why the code is counting from 10 to the last address, I asked my scanner finds devices on every addresses becuase it sends that addresses to serial port. Now could I explain very clearly? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Thu Aug 22, 2019 7:29 am |
|
|
No I'm not. It is reporting devices because the bus is shorted low.
It is the 'low' on the bus that it sees to say a device has acknowledged.
Something is shorting the bus.... |
|
|
camleot23
Joined: 16 Aug 2019 Posts: 52
|
|
Posted: Thu Aug 22, 2019 7:34 am |
|
|
Hmm, I get it. Thank you |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
Re: i2c Scanner starts counting from 10 to the last point |
Posted: Thu Aug 22, 2019 9:45 am |
|
|
camleot23 wrote: | Hello All,
I use I2C Scanner functions which I got from this forum. I have a real hardware, 1 LCD with I2C, 1 pic, 1 Arduino. Pic is master, Arduino is slave. I want to communicate with them via I2C protocol. When I connect them together at first it worked and i2c scanner gave me their addresses correctly which are 4E and 3C. Then, I plugged out the power (which is the same Arduino) after I plugged in the Arduino, I2C scanner started to count from 10 and increased by 2 every time. I didn't wait for the last point but I suppose it would count to the last point. I don't understand why this happened. When I try to load my program while the system was on and i2c scanner was giving me addresses, it again started from the beginning.
Do you have any idea why this happened? |
Missing or open circuit pull-up resistors on the I2C bus or Arduino slave not set up correctly (has not initialized the I/O port for the I2C bus)? _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|