I2C 18F47K40
Moderator: Benj
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
I2C 18F47K40
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.
With channel 1 or channel 2 I2C does not work & no commands after I2C are executed.
The microcontroller is brought to a halt.
- Attachments
-
- I2C test.fcfx
- (122.38 KiB) Downloaded 191 times
Martin
- 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 18F47K40
Hi Martin,
Leigh's got one of these device on order so we can investigate for you.
Leigh's got one of these device on order so we can investigate for you.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: I2C 18F47K40
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.
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.
Martin
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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
I think I have the I2C fixed now.
Please try the attached updated CAL file. (C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC)
Thanks
Leigh
- Attachments
-
- PIC_CAL_I2C.c
- (28.25 KiB) Downloaded 205 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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
I've just done a quick ADC test with default settings and it looks OK.
Do you want to post an example?
Thanks
Leigh
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: I2C 18F47K40
Hi Leigh,LeighM wrote:'ve just done a quick ADC test with default settings and it looks OK.
Was that running the chip with internal osc @ 64 MHz?
Martin
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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)
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)
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: I2C 18F47K40
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
Brilliant thanks Leigh for your help on both I2C and ADC.LeighM wrote:Just changed the ADC conversion speed to Fosc/16 and all is well again. (@64MHz)
Will do some testing and let you know how I got on.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: I2C 18F47K40
Yes I was running osc for I2C at 48MHz.LeighM wrote:Just checked and that was running with OSCFRQ = 0x07;
as your previous program, so that will be 48MHz, not 64
What to change it to 64MHz when ADC was working.
Brilliant thanks Leigh for your help on both I2C and ADC.LeighM wrote:Just changed the ADC conversion speed to Fosc/16 and all is well again. (@64MHz)
Will do some testing and let you know how I got on.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: I2C 18F47K40
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
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
Martin
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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
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
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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
I'll be back
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
I'll be back
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: I2C 18F47K40
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
but haven't got my head round all the relevant datasheet sections yet
- 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 18F47K40
I've poked my head into the datasheet but I've not spotted anything useful so far.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 74
- Joined: Mon Aug 23, 2010 7:07 pm
- Location: Amsterdam
- Has thanked: 7 times
- Been thanked: 13 times
- Contact:
Re: I2C 18F47K40
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
I experiance the same problem with a PIC16F15356.
Software I2C is working but Ch1 and Ch2 are not.
FC8.1.1.11
Regards,
PS