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.

MSSP in PIC18F4550- Changing between SPI and I2C in runtime?

Status
Not open for further replies.

picstudent

New Member
Hi
I am using MSSP module in 18F4550 to talk to a 24LC16 EEPROM and TC77 temp sensor.
Only One chip will be connected at one time to PIC . I have two jumpers on board to select either device.(SCL, SDA or SDI SCK).
During run time I am checking I2C lines for pull up. If jumper is in EEPROM position that pull up will give pin as high and I will read I2C chip. otherwise I will read temp sensor.(My SPI part pins has no pull up)

While at runtime if I change these jumpers IIC engine is ok to switch between modes, but SPI module behaves erratically. If I switch to IIC and returns to SPI, temperature readings using SPI bus fail intermittently. But I2C is Ok always.
Simply changing to I2C and returning to SPI at runtime creates no problem. But in I2C if a read or write is done, then SPI loses balance.

Seems IIC engine is not 100% reset after it's operation to perform smoothly in SPI mode.

How I can completely reset I2C to a 'perfect start' to work flawlessly in SPI mode

Thanks

Roy Thomas
 
Hi,
I have the same problem, but with SPI EEPROM and I2C timekeeper.
You solved the problem?

Thanks
 
Neither protocol is very difficult and both can be implemented in software (SPI is probably slightly easier to implement).

So if you aren't short on pins, do you really need to use the hardware module?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top