Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

2 i2c slave devices wont work at same time

Status
Not open for further replies.

SimonTHK

Member
hello
I have 3 different slave devices in a project. One for music, one for 4x7 segment display driver and one for controlling 20 microprocessors (tus 20 adresses, but same schematic).

The music and 20 microprocessors works fine together. The music and display work fine together. But my display and my 20 microprocessors wont work together.

If I try to send to my display while my microprocessors are connected at the same time, the info wont reach my display. Neither will any info reach my 20 microprocessors.

I send 1 byte to each microprocesor, but only to 1 microprocessor at a time. I send 6 bytes to the segment display driver. I programmed it to send to display driver first, but it never happens and the program halts.

None are using the same adresses. Mycroprocessor uses adresses from 20-50 and display uses 56.

What could cause this? Take in mind that eveything works very well aslong as it aint together.
 
It do sound as though you have an address problem there somewhere, as the master will wait for an acknowledgement from the slave before it will proceed and with an address problem there will be no acknowledgement so the program will just halt waiting.

The other thing is what value pullup resistors do you have on the SDA and SCL lines as with so many devices on the bus the pullup resistors might be too high of value.
I have struck this problem before and found around 3K6 was needed for several devices.

A third problem could be the display has not initiated correctly and is still holding the SCL or SDA line low and hence the next address will not be acknowledged, try adding a delay after the first address to the display.


EDIT......... what 4x7 display driver are you using, as some i have used have the address set by a voltage divider across 2 pins and if your supply voltage takes a dip when the driver is addressed then the address could be wrong, all depends on you circuit setup.

Pete.
 
Last edited:
Hi thanks
My display driver is hard pulled to ground and gives me adress 56.
I have added 10k resistors in parallel with me 5k pullups allready to lower my overall pullup resistance, also the wire is only extended with 10 cm when I add the display.
My display is working fine when it is the only i2c device connected. Will you still think that a delay could help this out then?
I just know that a none working slave device can make a Uc halt. But is it the aknowledgement from the slave that is the only moment it can halt? Is it the only thing that can cause a halt?
 
Well i guess there is many things that can make it halt , but the obvious is a address problem.

Try commenting out the display in code so the master dont call the slave display, but leave it connected to the I2C bus and see if the program runs without halting, this will help eliminate where the problem is.

What is the display driver chip.........part number ?????

Pete.
 
it seems that I "fixed" the problem by just making another i2c bus and I have enough outputs on my Uc. Though I will still try and see if I can figure out what caused the other problem.
 
Try turning the display off in your program and leave it connected to the bus, then run the program with the display section of code turned off.

The saa1064 is an old favorite of mine and i have about 20 of them.... great chip.

Pete.
 
Last edited:
Ok, as i said an address problem, but in this case it was actually missing from the bus and the master called the slave and it was not there to respond, so the master waited, and waited, and waited...................

Pete.
 
Use a logic analyzer to monitor the I2C bus.

You can get one of several inexpensive ones like the bus pirate for about $30, if you can't afford that use a pickit2 in LOGIC TOOL mode (pickit2.exe) to see the raw bus.

LogicSniffer-Logic_Analyzer_Client-W490.jpg
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top