I2C problems with 16LF18857

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

I2C problems with 16LF18857

Post by Jan Lichtenbelt »

I use the C0 port for SCL and the C1 port for the SDAT of the 16LF18857 microchip. It didn't work, so I made a test Flowcode, see attachment.

1) Before starting the I2C, the C0 and C1 ports are tested with level 1 and 0 each second. The ports work correctly.
2) The second step is to compare the behavoir of this chip with the 16(L)F1847 chip. The last shows I2C pulses and the LCD shows the ID and config word of the slave. The 16LF18857 does show neither data nor clock I2C pulses and stops during writing the slave address (see comment NEVER REACHED in the Enable_I2C_Sensor maco).

What to do now?

Kind regards

Jan
Test_I2C_V1.fcfx
(29.6 KiB) Downloaded 48 times

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C problems with 16LF18857

Post by Jan Lichtenbelt »

It took a while to find a solution.

This microchip 16(L)F18857 has (as usually) 2 sets of I2C ports C3 SCLK1, C4 SDAT1, B1 SCLK2 and B2 SDAT2 with low and high levels special for I2C. Other ports (TTL levels) can be used for I2C also. This can be done by means of software setting (settings of special registers).

1) When starting Flowcode with this microchip, there is a possibility to choose the I2C ports. I needed the C0 as SCLK and C1 as SDAT.
channel 1.jpg
channel 1.jpg (68.94 KiB) Viewed 1071 times
But the Flowcode program did not work.

2) But it is curious why one could change the ports in case of channel 1, because ports should be C3 and C4.
So, I changed the ports to C3 and C4. The breadboard setup with is setting did not work either.

3) Now I changed the Flowcode Bus settings channel to “software”. Curious that the connections were fixed to C3 and C4 and could not be changed, as expected. But this works.
software.jpg
software.jpg (68.75 KiB) Viewed 1071 times
Question: Is it correct that one can change the I2C ports in case of "channel 1"or "channel 2" and can not change the ports in case of "software"? It seems not logic to me.

Kind regards

Jan

User avatar
Benj
Matrix Staff
Posts: 14865
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: I2C problems with 16LF18857

Post by Benj »

Hi Jan,

I can't seem to replicate the problem.

With the two hardware channels you should get the extra Remap properties that allow you to set the hardware channel pins. With the software channel the remap properties should dissappear and you should be able to set the pins by directly editing the SDA and SCL properties.

All working nicely for me here though I am running 8.2 (due to be released later today).

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C problems with 16LF18857

Post by Jan Lichtenbelt »

Hi Ben

You wrote:
you should be able to set the pins by directly editing the SDA and SCL properties
what do you mean with "directly editing"

Kind regrads

Jan

patrick schoon
Posts: 69
Joined: Mon Aug 23, 2010 7:07 pm
Location: Amsterdam
Contact:

Re: I2C problems with 16LF18857

Post by patrick schoon »

Hi Jan,

I had the simular issues with a project i use the same 16F18857 MCU.

Only software channel was working. Hardware channel 1 and 2 did not.

Now i have updated FC8 to V8.2.0.12 and YES hardware channels are working now.
I directly tested both channels (SDA to B4, SCL to B5) and all is working well.

Cheers.

Post Reply