View previous topic :: View next topic |
Author |
Message |
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
I2C Master H/ware on PIC's with SSP NOT MSSP |
Posted: Sat Sep 09, 2006 7:09 am |
|
|
I am using an PIC16F88, and am a bit miffed that I can only use the s/ware I2C in Master mode.
Since most of us use external I2C devices such as EEPROM, RTC's, display drivers etc. the PIC's hardware I2C is useless.
has anyone any code to use the SSP as I2C Master ?
for those of you who dont understand the issue, the SSP module was the I2C/SPI hardware module on most PIC's until fairly recently.
the newer PIC's have an MSSP, the M signifying support for master hardware mode.
Surely CCS, you can write functions to Master mode the SSP.
Mike |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 09, 2006 11:00 am |
|
|
CCS does have library code for a hardware master, but it only works
on PICs that have a MSSP. The 16F88 only has an SSP module.
The SSP doesn't support a hardware master. The data sheet says:
Quote: | In Master mode operation, the SCL and SDA lines are manipulated in firmware |
|
|
|
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
Posted: Sat Sep 09, 2006 12:10 pm |
|
|
oh guru.
( this is not being sarcastic, just recognising your contribution of the past 5 years)
I think the SSP is capable of a pseudo hardware MASTER by a bit of asm and jiggery pokery.
I have seen some Microchip app notes of early vintage which use bit i/o reading before sending out the data in the hardware registers.
If i had the time and skill, I think I could do it, but unfortunately, dont have either.
Mike |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Sep 09, 2006 12:23 pm |
|
|
I'm not sure how it would do this because there's no baud rate
generator in the SSP module. But I'll look for the appnotes you
mentioned over the weekend and see if I can find something. |
|
|
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
Posted: Sat Sep 09, 2006 2:13 pm |
|
|
AN578 i think |
|
|
Ttelmah Guest
|
|
Posted: Sat Sep 09, 2006 2:27 pm |
|
|
I think you will find it is AN554.
However there really is no advantage to it over the full 'software' implementation. All the timings are still done in software. The only feature used from the hardware, is the ability to detect the presence of the start and stop conditions (from the slave hardware), which makes it easier to implement a multi-master system (which is what AN578 describes). For communication to I2C slaves, the fully software master is as good.
Best Wishes |
|
|
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
Posted: Sun Sep 10, 2006 2:14 am |
|
|
Ttelmah,
your reply is complete enough for me to close the page on this topic.
yes, it was AN578 which lead me to think that they used the h/war shift register to senf the bytes out.
I have what I need up and running using the s/ware I2C master.
for interest, I am using the newish Philips (NXP) SC16I752 I2C to UART/DUART chip. its is a lovely chip, loads and loads of features, 64 byte FIFO, 8 GP I/O auto Xon/Xoff, auto CTS/RTS. I dont even need to use interrupt driven Tx and RX. just poll the registers.
Its tricky to set up being a PC uart 16C550 type, but it is working a treat.
Also, check out Analog Devices ADuM1251 , its a 2.5KV digital isolator for I2C
I will post code when complete
Mike |
|
|
Neckruin
Joined: 17 Jan 2006 Posts: 66
|
|
Posted: Wed Oct 11, 2006 10:02 am |
|
|
I Know this post is quite old.
Anyway, I hope some of you remember this and answer this simple question (taking into account tha time lasted since then):
If I wish to use a PIC16F877 (with MSSP available) as Master in an I2C bus... does it worth to use the Hardware capabilities or not?
I mean... when inserting the #use_2c statement in the code the FORCE_HW option... what does it mean and does implie exactly?
Can I use the SSP Interrupt for something useful?
Well, finally they where 3 questions...
I hope you can help me
Thanks in advance,
Juanma |
|
|
Neckruin
Joined: 17 Jan 2006 Posts: 66
|
|
Posted: Wed Oct 11, 2006 10:06 am |
|
|
Sorry, dont know why but I thought this post was started in 2003... :P |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 11, 2006 11:53 am |
|
|
Quote: | I wish to use a PIC16F877 (with MSSP available) as Master in an I2C bus... does it worth to use the Hardware capabilities or not? |
At lower crystal frequencies, you can get a faster baud rate for SCL
than if you used software i2c.
Quote: |
When inserting the #use_2c statement in the code the FORCE_HW
option... what does it mean and does implie exactly ?
|
It uses the hardware in the MSSP module to create the i2c signals,
instead of doing it by "bit banging".
Quote: | Can I use the SSP Interrupt for something useful? |
It's normally used for an i2c slave. Look at the EX_SLAVE.C example. |
|
|
Neckruin
Joined: 17 Jan 2006 Posts: 66
|
|
Posted: Thu Oct 12, 2006 1:37 am |
|
|
Thanks a lot PCM |
|
|
|