Hi Joep,
You are correct for the 16f877 but If you take a look at the 16f8777A 
datasheet it states:

bit 0 SEN: Start Condition Enabled/Stretch Enabled bit

In Master mode:

1 = Initiate Start condition on SDA and SCL pins. Automatically cleared by 
hardware.

0 = Start condition Idle

In Slave mode:

1 = Clock stretching is enabled for both slave transmit and slave receive 
(stretch enabled)

0 = Clock stretching is enabled for slave transmit only (PIC16F87X 
compatibility)



And for the 18f14k50 it states



In Slave mode:
1 = Clock stretching is enabled for both slave transmit and slave receive 
(stretch enabled)
0 = Clock stretching is disabled



By default SSP2CON is initialized to 00000000, and in the i2c slave code I 
could not find any code that is initializing SSP2CON.

So to enable i2c slave clock stretching for bot transmit an receive, the SEN 
bit should be set in slave mode.

Maybe tonight I can do a little testing, but currently I have not a 16f877a 
board with i2c, so I have to do some soldering first, I think it can be 
easily tested by adding 10us delay in the i2c slave echo example

Albert




----- Original Message ----- 
From: "Joep Suijs" <[email protected]>
To: <[email protected]>
Sent: Saturday, August 01, 2009 8:06 AM
Subject: [jallib] Re: i2c slave; clock stretch not enabled for MSSP 
hardware?


>
> Hi Albert,
>
> Clock streching is required for i2c to work properly, so I can't
> imagine this could be disabled - what is the point to disable a
> mandatory feature?
> If I look at the 16f877 datasheet, SEN is the start condition enable
> bit, not clock-related.
>
> I was also about to say that clock streching must be enabled, since it
> works. But rethinking this I am not so sure it must for hardware
> master.
> Do you have any reason to assume clock streching does not work? And
> would that be on 18f only (which I haven't looked into) or also 16f?
>
> Joep
>
> 2009/8/1 AlbertF <[email protected]>:
>>
>> Hi,
>> Looking at the i2c code and the datasheets, it looks like the i2c
>> slave clock stretching is not enabled for devices that have the
>> SSP2CON register (MSSP). In order to enable clock stretching the SEN
>> bit must be set in slave mode (if I interpreted the datasheets
>> correctly), I think clock stretching is an absolute must if you have
>> multiple interrupt source.
>> Albert
>> >
>>
>
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to