Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C and 2 PICs . HW problems

Status
Not open for further replies.

fuzzzy

Full Member level 3
Joined
Oct 2, 2004
Messages
156
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Location
ITALY
Activity points
1,650
Hi, I'm trying to connect 2 PIC as master and slave on an I2c bus. master has to control 2 slaves a I2c device and the other PIC. when I connect the pic, self powered on another board, pullup voltage of the master goes down to 1,3V from 5V and the master can't use the bus. this bus instead is ok before connecting other pic.

is there a particular way to set tris port? Should I pullup also the second pic pins?

what about my slave pic address? could you suggest the bet way to set it? thanks
 

Looks like that pins of second PIC that you connect to I2C bus are not in Z state. Did you correctly initialized its TRIS register?

Also, you can select any address for your slave PIC. But if you want to connect others standard I2C devices, like EEPROM, LCD etc. to the same bus, then better select first part of address from reserved set, like 0000.
 

Hi,

I initialized correctly trisc but i had problems, to get bus lines high level i had to force the ck pin as input: variable=(input _pinc3);
in this case this pin remained high and i can use this bus.

i still have problems coommunicating because slave pic doesn'enter I2C ISR or doesnt recognize master address.
Now I'm looking for some I2C slave routines to take inspiration..
 

Hi,

Check to see if all you I2C configuration of the PIC are set correct for a slave mode. If they are then the pines should be as inputs and not output, thus cossing the pines to be in high Z. When setting the PIC as I2C slave, the PIC will automatcly will set the pines used as the necessary state. You can check with the WATCH to see that they are in input state.
Good luck.
 

i checked my configuration. i set trisc in a way the bus is high. so trisc3 has to be 1 and trisC4 has to be 0. other configurations cause a bus line droping low.
in this working configuration i have to use a dummy command var=input(pin_c3) in order to set pin C3 as input. If i use also var=input(pin_c4) bus line drop down.

is this a bug in my compiler??why if i set tris=1 i must also call an input to raise that PIN?
 

Hi,

If you look in the PIC16F8xA.pdf from microchip you will see on page 84 this:
In Slave mode, the SCL and SDA pins must be configured as inputs (TRISC<4:3> set). The MSSP module will override the input state with the output data when required (slave-transmitter).
So, read more in the pdf page 84 section 9.4.3, change your configuration and check again.
Good luck.

Microchip have an MSSP Module Silicon Errata Sheet that you should read, Here is the link:
**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top