However there is a problem in the i2c2_transmit routine which I finally
found it:
procedure i2c_wait is
while ! pir3_ssp2if loop end loop
pir3_ssp2if = low
end procedure
function i2c2_transmit (byte in data) return bit is
ssp2buf = data ; write data
i2c_wait ; wait until write is finished
-- get Acknowledge Status Bit _ACKSTAT
-- which indicates that the slave has responded (or not)
-- if i2c device send an Aknowledge, then ready and OK
if SSP2CON2_ACKSTAT == low then
return true -- okay
; else
-- HERE is the problem, the following two lines are freezing the
communication until a new complete initialization of the I2c is performed,
which may be wrong because usually the initialization of i2c should be
performed only once
; ssp2con1_sspen = false; disable i2c
; ssp2con1_sspen = true; enable i2c
return false -- no response
end if
end function
BTW, the i2c_wait can be used in all START, RESTART or STOP routines,
instead of testing SEN, RSEN or PEN
Vasile
On Thu, Jan 27, 2011 at 1:38 AM, mattschinkel <[email protected]>wrote:
> > As long you have provided
> > understandable definition files, it does not bother me to add aliases as
> > need in my program.
>
> We had aliased SPI registers in device files to fix this issue. The
> same should be done for I2C.
>
> Matt.
>
> On Jan 26, 2:27 pm, vasile surducan <[email protected]> wrote:
> > hi Rob,
> >
> > I'm still struggle with the secondary i2c since one or 10 days ago. The
> > register name is not an issue for me. As long you have provided
> > understandable definition files, it does not bother me to add aliases as
> > need in my program. With other words my i2c2 library is using Microchip
> > register names and the program is aliasing those names to jallib
> definition
> > files.
> > Since I don't know yet where is the problem, opening and following
> > discussion in an issue is not my favorite job ( I'm also very busy these
> > days).
> > If I will be able to find out the problem I'll post my working secondary
> > i2c_hw lib.
> > If not, I've learned that I can live without it too.
> >
> > thx,
> > Vasile
> >
> > On Wed, Jan 26, 2011 at 5:43 AM, Rob Hamerling <[email protected]
> >wrote:
> >
> >
> >
> > > Hi Vasile
> >
> > > A day or 10 ago I invited you to open an issue for this (see subj).
> > > May I ask you why you didn't (yet)?
> >
> > > Regards, Rob.
> >
> > > On 2011/01/16 11:16, Rob Hamerling wrote:
> >
> > > You might open a separate issue for this, since it concerns a
> different
> > >> set of libs (and authors).
> >
> > > --
> > > R. Hamerling, Netherlands ---http://www.robh.nl
> >
> > > --
> > > 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]<jallib%[email protected]>
> <jallib%[email protected]<jallib%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/jallib?hl=en.
> >
> >
>
> --
> 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]<jallib%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>
--
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.