| FORUM

FEDEVEL
Platform forum

MCP23017T-E/ML I2C address is not showing.

Anik , 08-07-2024, 06:05 PM
Hello sir,
I made a circuit which has 2 MCP23017T-E/ML for controlling 332 relay. Both IC is in the same but with different I2C address. But one is found for the single time but after the first scan its lost. I cofigure the I2C address by many way but its not working. But the 0x25 ( U43) is working properly. But the 0x23 ( U74) is just show for the first scan. The PCB image is attached. The I2C bus wire length is 8 inch, I am not sure its the problem or not. But I have tried by many way but still only 0x25 showing. Please help me.
QDrives , 08-07-2024, 09:43 PM
SDA and SCL pull-ups?
I2C speed?
What does the "scan" do?
Mini , 08-07-2024, 10:09 PM
I2C scan goes through all addresses and waits for ACK. It is mostly for the case when you don't know your device I2C address and that's where the name scan comes from.
Mini , 08-07-2024, 10:13 PM
As @QDrives said, do you have pull-ups? You have to look with oscilloscope what the signal looks like. Try to communicate yourself directly. Do you receive NACK or nothing?
Mini , 08-07-2024, 10:15 PM
And what about RESET pin? Do you have any pull-up/pull-down there?
Anik , 08-08-2024, 02:05 AM
Yes SDA, SCL have pulled up by 10K.
Reset dont have any pull up or pull down.
Anik , 08-08-2024, 02:08 AM
This is the a simple code for read I2C address, found from internet.
Anik , 08-08-2024, 02:08 AM
Only 0x25 is working. When I trying to communicate with 0x23, its not workinh
Anik , 08-08-2024, 02:19 AM
Could it be the problem, the wire length, its 8 inch long
Mini , 08-08-2024, 10:02 AM
It depends. It's about capacitance and speed you are running at. You can do 8 inch = 20 cm for sure. Try to communicate yourself instead of using I2C scanner. And look the signal with oscilloscope. Do you get ACK or NACK or nothing and so on. Btw you didn't answer the question about RESET signal. Show us the whole schematic. Also can you show PCB layout picture how you run I2C signals. Running SCL and SDA next to each very close and having long traces can cause problems as well.
Anik , 08-08-2024, 03:51 PM
Reset pin is directly connected to the GPIO ( Maybe I should check the GPIO is internally pulled up or not) . The white wire is the I2C bus.
Anik , 08-08-2024, 06:29 PM
No GPIO40 is not internally pulled up
Anik , 08-08-2024, 07:11 PM
Currently I dont have oscilloscope and can not check the SCL. Without oscilloscope maybe I can not measure ACK or NACK
QDrives , 08-08-2024, 08:52 PM
U74 had address 0x23 and is at the end of the I2C. Your 10k pull-up is probably to high resistance. Try 4k7 or 2k2.
Is your reset GPIO push-pull? Probably. But did you do a reset once at power-up (boot-up)?
Have you got SDA and SCL running on the bottom layer (L4), and L2 is Gnd, L3 is another signal layer? This is not good for the signals.
With the width of the trace and length, you can calculate the capacitance. Together with the pull-up resistor, you can calculate the rise time.
That rise time must be lower than needed for the I2C speed that you use.

L1 and L2 are full of copper and L3 and L4 little? The board will bend like a banana with assembly... Think of copper balancing.
Mini , 08-08-2024, 10:14 PM
Well you have floating RESET? I would always external pull-up/pull-down for these cases. You need to program MCU to have internal pull-up activated if it has one. Or solder one physically. And you need to wait some time after doing RESET before chip comes up. But looking at your PCB there is much improvement. @QDrives said well, use lower pull-ups like 2k2 for these long traces. And yes you need to have GND layer above/down I2C traces. Also I see no room constraints. Why you run data and clock next to each other for so long. Keep them separated and have GND in between them or at least VDD. But now you need oscilloscope to see what the signals look like, there is no other way. Unless fixing RESET and trying lower pull-ups will help.
Anik , 08-09-2024, 09:01 AM
Ok, I will try with 4.7K and 2.2K also. Yes I use the GPIO40 which one is connected with the reset pin. but will try again by giving one pulse to high and then keep the state low.
Yes the SCL-SDA is in the bottom layer. but filled with GND pour.

L1- Sig/GND
L2-GND
L3-Sig ( this signal is for the battery gauge and the battery gauge section is in galvanic isolation) So that I dont keep any GND layer on it. All of the trace is come from battery cell and its analog)
L4- Sig/GND

I will calulate the rise time. And will check soon with oscilloscope. Then will let you know.
But please give me some suggestion what should I do when I design any device use long BUS I2C.
QDrives , 08-09-2024, 10:00 PM
See figure 1-2 of the datasheet for reset signal.
Figure 1-1 even has a 1k pull-up for SDA and SCL.
What is the I2C bus speed that you have set? What if you lower the speed?
QDrives , 08-09-2024, 10:02 PM
Reset does not need pull-up or pull-down when the output of the MCU that is driving it is push-pull.
However, you need to drive the reset pin to reset and then release reset.
Figure 1-2 in the datasheet shows this too.
Mini , 08-10-2024, 07:07 PM
Do you mean holding RESET high all the time by MCU? If that's the case yes you could do that however I would use pull up and drive it only down(make reset) when needed. Then you don't have to rely on software to not make a RESET.
Mini , 08-10-2024, 07:11 PM
And btw to the OP have you googled your chip? I found several similar problems from google. Some of them describe your situation and they found out that their RESET was floating.
QDrives , 08-11-2024, 02:39 PM
Yes, the MCU keeps the RESET high **most** if the time.
When the software starts, you first reset the chip by making the reset low. Wait the time needed for it to reset (>= 1us in this case) and then you make it high.
A simple pull-up on reset does not comply with the specification of the chip (figure 1-2).

The advantage of this method is that you can reset the chip at any time. What if your MCU resets just half way through a I2C message? No problem.
If you want to reset (MCU) with pull-up, you need an open drain output to be more correct.
With push-pull GPIO there is no need for pull-up or down, unless there is a safety/security issue. That is not the case here.
Mini , 08-11-2024, 05:21 PM
I always use pull up-s for SPI cs and things like that and it works very well. I drive them low when needed to reset. As soon as slave device gets voltage reset or cs will be pulled up as well. It's good because I don't rely my software when not doing reset. I feel safer this way. And I can reset any time as well. Although sometime I use MCU internal pull ups for that. But I agree OP can use GPIO to hold his RESET high as well, he simply has to program it, I think he just used I2C scanner and didn't do that.
QDrives , 08-12-2024, 09:02 PM
"*...I don't rely my software when not doing reset.*" -- You are relying on the software to read/write the chip are you? You are relying on the software to configure I2C or SPI peripheral too are you?
Then what is the problem on relying on the software to do a reset?
For a push-pull output GPIO a pull-up / down is only required for safety / security when the MCU itself is in reset.
A pull-up is required if
1) you do not have the reset connected to a GPIO or
2) you made the GPIO a open drain output.
Mini , 08-12-2024, 11:12 PM
Yes it helps when MCU is on reset. I may not want reset when my software freezes for example. I'm very well aware of push pull/open-drain. I do program my own MCU from scratch. You can keep using pull-up, I prefer my way.
QDrives , 08-13-2024, 07:16 PM
It is not about preference. It is about stating that a pull-up is required, which is not the case when connected to a push-pull GPIO.
Mini , 08-13-2024, 07:31 PM
Yes, I agree it is not must, but you have to drive it high which I think OP didn't do. However you might want one for the reasons stated above.
QDrives , 08-14-2024, 07:42 PM
Hence my question if the reset is push-pull GPIO...
A pull-up is 'useless' in the context of this post if the GPIO is push-pull. Either he forgot to make the reset high or forgot to do the reset sequence.
If he had not configured the GPIO yet, it would probably be an input and then yes, a pull-up might have solved his issues.
Anik , 08-15-2024, 09:10 PM
On this way by holding the reset pin for sometime then release by the MCU the I2C device found but the speed is very low, at only 2KHz its working. For this application this speed is enough.
Anik , 08-15-2024, 09:11 PM
I am working on the other parts on the board now . But will research more about this and let you know here.
Anik , 08-16-2024, 09:19 AM
Will there be any problem??
QDrives , 08-16-2024, 11:13 PM
It is not advised, but I would say that it should not give you this problem is the I2C clock is <= 100kHz.
Have you tried with lower resistance pull-ups?
Robert Feranec , 08-19-2024, 08:44 AM
@QDrives "Have you tried with lower resistance pull-ups?" - that is exactly also my question. It could help
Anik , 08-21-2024, 07:55 PM
I made two board. The previous board works at 2kHz speed with 10K pull up. And this is enough for now. Will test later by adding lower pull up and higher speed.

This is from the second board. There I have used 4.7K pull up. And the board have not arrived yet. I will test and let you know...
Robert Feranec , 08-22-2024, 04:15 PM
"The previous board works at 2kHz speed with 10K pull up. And this is enough for now." - just be careful, you may keep having random problems if it is not properly fixed.
Use our interactive Discord forum to reply or ask new questions.
Discord invite
Discord forum link (after invitation)

Didn't find what you were looking for?