Page 1 of 1

I2C-Master with PIC16F690 not working

Posted: Wed Feb 07, 2018 12:21 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Wed Feb 07, 2018 4:03 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Wed Feb 07, 2018 4:12 pm
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.

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 12:12 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 12:25 pm
by stefan.erni
Hi Jörg

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

Stefan

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 3:29 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 3:53 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 5:42 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Thu Feb 08, 2018 7:03 pm
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.flowcode.co.uk/mmforums/viewt ... 64&t=19808

Stefan

Re: I2C-Master with PIC16F690 not working

Posted: Fri Feb 09, 2018 7:32 am
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

Re: I2C-Master with PIC16F690 not working

Posted: Mon Feb 12, 2018 11:48 am
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 301 times
I'll have a look at the speed of the software channel, what device family are you using and which baud rate?

Re: I2C-Master with PIC16F690 not working

Posted: Mon Feb 12, 2018 12:11 pm
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

Re: I2C-Master with PIC16F690 not working

Posted: Mon Feb 12, 2018 12:28 pm
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.

Re: I2C-Master with PIC16F690 not working

Posted: Mon Feb 12, 2018 4:12 pm
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