I2C-Master with PIC16F690 not working

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hello Matrix Team,
in Flowcode6 works only the software-I2C and in Flowcode7 software and hardware is not working?
The datasheet says, that the master is present on this chip.

Please have a look to the attached PDF. The 6 chips of the datasheet have master and slave on board.
In Flowcode7 I compile only the I2C-Init and get errors. The message says, that I have to switch to software-mode, but I´m in software mode?????
Can you look to this situation, what happens and why is the hardware mode not running?


Thanks
Jörg
Attachments
PIC16F690_I2C_Bug.pdf
(375.49 KiB) Downloaded 196 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by stefan.erni »

Hi Jörg

I2C Hardware was not working on my FC7, but software mode I2C was working.

Maybe you try to compile again .

Gruss

Stefan

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by LeighM »

Hi Jörg,
The master mode on this device is a bit of a hybrid, it needs more firmware, so you might as well use our software channel.
Have a look at page 191 of the datasheet.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hello matrix team,
I now found out, what happens. In my software was a I2C-component from Flowcode6 who was not running. I had to erase all belonging to the component
and place a new one from Flowcode7. Now Flowcode7 compiles in software-mode. What`s not correct in software mode is the value of the baud select.
I know, there is a limit in the upper frequency, but in the lower the displayed value is not shown correct.



Jörg

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by stefan.erni »

Hi Jörg

Normal is 100kHz, 400kHz, 1Mega.
Is there something else?

Stefan

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hi Stefan,
the maximum clock frequency I measured is about 18khz.
This value is not the one who is setup into the custom box.
Setting up 100khz gives a clock frequency under 10khz@8mhz oscillator speed?


Jörg

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by stefan.erni »

Hi Jörg

Are you using the intern RC Oszi?
What about the delay. If you test a second on/off on a port output. is it 1Second or 5Second?
Can you post the program?

Stefan

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hi Stefan,
here are the new facts:
The attachement shows all of what I did. New program in Flowcode7 with I2C-master. At first I compiled this program without errors.
Then I close Flowcode, opens again Flowcode, load the program and it appears a compiling error you can see on the PDF?????
With this setup I got a clock frequency of about 6,4khz. The intern oscillator is not touched, so he would run @ 4mhz.
The compiler doesn`t detect, that I was already in software mode????
What`s wrong there?


Jörg
Attachments
Flowcode7-PIC16F690_I2C_BUG.pdf
(509.07 KiB) Downloaded 213 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by stefan.erni »

hoi Jürg

Same effect if I load the program with the I2C. It's shows software but gives an error.
If I change to Hardware, compiele and back to software,compiele, it's works again.

it's looks a little bit similar to the uart probeml from me...

http://www.matrixtsl.com/mmforums/viewt ... 64&t=19808

Stefan

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hi Matrix Team,
another info for the bug:
When the compile error appears --> switch to hardware --> switch back back to software --> compiling without error !?!
This happens after new starting Flowcode.
Can you have a second look to the scl frequency. There is a limit in the upper, I know. But the software speed is not the same you could
setup in the component box.


Jörg

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Benj »

Hello,

Here is I believe a fix for the component connections being broken when reloading a project.
I2C_Master.fcpx
(12.6 KiB) Downloaded 200 times
I'll have a look at the speed of the software channel, what device family are you using and which baud rate?

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hi Benj,
now is working with the founded breaking connections. Well done.

To the frequency:
The component setup (baud) = 100khz
The measured clock frequency = 6,76khz (@4mhz intern oscillator)
Device family is wriitten in the headline = PIC16F690


Jörg

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Benj »

Hi Jörg,

4MHz is fairly slow but yes I can see that the 6.76KHz is fairly slow so I'll have a look and see if we can do anything about this.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times
Contact:

Re: I2C-Master with PIC16F690 not working

Post by Jörg Güldner »

Hi Benj,
in my case you see 100khz at the component setup and gets 6,76khz from the cpu. Can you put in a dummy devider, so that the baud setup is nearly the same as the frequency coming out from the cpu?


Jörg

Post Reply