Page 1 of 1

I2C 18F47K40

Posted: Mon Mar 25, 2019 3:42 pm
by medelec35
Software I2C is working as expected.
With channel 1 or channel 2 I2C does not work & no commands after I2C are executed.
The microcontroller is brought to a halt.

Re: I2C 18F47K40

Posted: Tue Mar 26, 2019 6:11 pm
by Benj
Hi Martin,

Leigh's got one of these device on order so we can investigate for you.

Re: I2C 18F47K40

Posted: Wed Mar 27, 2019 8:47 am
by medelec35
Thanks Ben & Leigh.
When you test the device, can you also test ADC with internal OSC at 64MHz please as it appears to be wandering all over the place.

Thank you.

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:11 pm
by LeighM
Hi Martin,
I think I have the I2C fixed now.
Please try the attached updated CAL file. (C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC)
Thanks
Leigh

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:26 pm
by LeighM
Hi Martin,
I've just done a quick ADC test with default settings and it looks OK.
Do you want to post an example?
Thanks
Leigh

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:32 pm
by medelec35
LeighM wrote:'ve just done a quick ADC test with default settings and it looks OK.
Hi Leigh,
Was that running the chip with internal osc @ 64 MHz?

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:38 pm
by LeighM
Just checked and that was running with OSCFRQ = 0x07;
as your previous program, so that will be 48MHz, not 64

Edit: Yes you are correct, it's a mess at 64MHz
Although in the datasheet there is note reference (3) against that setting, cannot find the relevant note though!

Edit 2: Just changed the ADC conversion speed to Fosc/16 and all is well again. (@64MHz)

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:55 pm
by medelec35
LeighM wrote:Just checked and that was running with OSCFRQ = 0x07;
Yes I was running osc for I2C at 48MHz.
What to change it to 64MHz when ADC was working.
as your previous program, so that will be 48MHz, not 64
LeighM wrote:Just changed the ADC conversion speed to Fosc/16 and all is well again. (@64MHz)
Brilliant thanks Leigh for your help on both I2C and ADC.
Will do some testing and let you know how I got on.

Re: I2C 18F47K40

Posted: Tue Apr 09, 2019 2:55 pm
by medelec35
LeighM wrote:Just checked and that was running with OSCFRQ = 0x07;
as your previous program, so that will be 48MHz, not 64
Yes I was running osc for I2C at 48MHz.
What to change it to 64MHz when ADC was working.
LeighM wrote:Just changed the ADC conversion speed to Fosc/16 and all is well again. (@64MHz)
Brilliant thanks Leigh for your help on both I2C and ADC.
Will do some testing and let you know how I got on.

Re: I2C 18F47K40

Posted: Wed Apr 10, 2019 8:38 am
by medelec35
Hi Leigh,
Tried I2C with:
channel2 (SDA = RD0, SCL = RD1) - Working.
channel1 (SDA = RC0, SCL = RC1) - Not Working.
Software (SDA = RC0, SCL = RC1) - Working.
Using internal osc @ 48MHz

Re: I2C 18F47K40

Posted: Wed Apr 10, 2019 9:29 am
by LeighM
Thanks Martin,
Interesting, I used channel 1 and port C OK, but not pins 0 and 1
One thing I did add in code at start of program was a setting of the port to open drain.
ODCONC = 0xff;
I then forgot to remove it to see if it was really needed.
I'm out of the office at the moment so will investigate further tomorrow.
Leigh

Re: I2C 18F47K40

Posted: Thu Apr 11, 2019 9:14 am
by LeighM
Hi Martin,
Update: It does not require setting of the port to open drain.
But, weirdly, I can get it to work OK on every pin on port C except 0 and 1!
Hmm, does it need further investigation or a read of the silicon errata :roll:
I'll be back

Re: I2C 18F47K40

Posted: Thu Apr 11, 2019 10:17 am
by LeighM
I suspect this might be something to do with the secondary oscillator
but haven't got my head round all the relevant datasheet sections yet

Re: I2C 18F47K40

Posted: Thu Apr 11, 2019 5:30 pm
by Benj
I've poked my head into the datasheet but I've not spotted anything useful so far.

Re: I2C 18F47K40

Posted: Sun May 05, 2019 3:56 pm
by patrick schoon
Hi Guys,

I experiance the same problem with a PIC16F15356.

Software I2C is working but Ch1 and Ch2 are not.
FC8.1.1.11


Regards,

PS