CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

I2C Master H/ware on PIC's with SSP NOT MSSP

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

I2C Master H/ware on PIC's with SSP NOT MSSP
PostPosted: Sat Sep 09, 2006 7:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 11:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 12:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 12:23 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 2:13 pm     Reply with quote

AN578 i think
Ttelmah
Guest







PostPosted: Sat Sep 09, 2006 2:27 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Sep 10, 2006 2:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 11, 2006 10:02 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 11, 2006 10:06 am     Reply with quote

Sorry, dont know why but I thought this post was started in 2003... :P
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 11, 2006 11:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Oct 12, 2006 1:37 am     Reply with quote

Thanks a lot PCM Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group