PIC16F15354 - Non-working I2C & 24C16 Macros
Moderator: Benj
-
- Posts: 23
- Joined: Fri Jun 08, 2012 10:54 am
- Location: India
- Has thanked: 10 times
- Been thanked: 3 times
PIC16F15354 - Non-working I2C & 24C16 Macros
Hi,
On the PIC16F15354 device, the Serial EEPROM (software) 24C16 MACRO doesn't seem to work.
Instead, I tried using I2C MACRO, but the result was one & the same.
I'm struck on a project with this issue.
Kindly help in resolving the issue.
Thanks
San
On the PIC16F15354 device, the Serial EEPROM (software) 24C16 MACRO doesn't seem to work.
Instead, I tried using I2C MACRO, but the result was one & the same.
I'm struck on a project with this issue.
Kindly help in resolving the issue.
Thanks
San
- 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: PIC16F15354 - Non-working I2C & 24C16 Macros
Hello San,
Please can you attach your program so we can see what you're doing. Do you have external pull up resistors on the SCL / SDA pins?
Please can you attach your program so we can see what you're doing. Do you have external pull up resistors on the SCL / SDA pins?
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: 23
- Joined: Fri Jun 08, 2012 10:54 am
- Location: India
- Has thanked: 10 times
- Been thanked: 3 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi Benj,
Yes, the h/w has external pull-up resistors on the SCL & SDA pins
The h/w perfectly works with PIC16F723A without any issues & with PIC16F15354, on the same h/w it doesn't.
I have attached both files for your reference.
Sanjay
Yes, the h/w has external pull-up resistors on the SCL & SDA pins
The h/w perfectly works with PIC16F723A without any issues & with PIC16F15354, on the same h/w it doesn't.
I have attached both files for your reference.
Sanjay
- Attachments
-
- PIC16F15354_Write_Read_EEPROM.fcfx
- (9.72 KiB) Downloaded 314 times
-
- PIC16F723A_Write_Read_EEPROM.fcfx
- (8.83 KiB) Downloaded 338 times
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi
In your 723A your clock is running at 8MHz however in your 15354 you only have it running at 1MHz which is probably too low. You have also forgot to include a C-Code block to set the Osc value.
Regards
In your 723A your clock is running at 8MHz however in your 15354 you only have it running at 1MHz which is probably too low. You have also forgot to include a C-Code block to set the Osc value.
Regards
-
- Posts: 23
- Joined: Fri Jun 08, 2012 10:54 am
- Location: India
- Has thanked: 10 times
- Been thanked: 3 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi,
I changed the Oscillator setting to 8MHz but still, it's not communicating.
Regards,
San
I changed the Oscillator setting to 8MHz but still, it's not communicating.
Regards,
San
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi
Can you repost your chart please. Also,did you remember to include your C-code to set the Oscillator?
Regards
Can you repost your chart please. Also,did you remember to include your C-code to set the Oscillator?
Regards
-
- Posts: 23
- Joined: Fri Jun 08, 2012 10:54 am
- Location: India
- Has thanked: 10 times
- Been thanked: 3 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi,
Thanks for your reply.
The C code is not needed as the clock is configured in Project Options > Configure Window. I have attached a screenshot for your reference.
I have added a 1Hz flasher before the start of the EEPROM communication, to confirm the working of the oscillator & the flasher works fine. The file is attached.
Regards,
Sanjay
Thanks for your reply.
The C code is not needed as the clock is configured in Project Options > Configure Window. I have attached a screenshot for your reference.
I have added a 1Hz flasher before the start of the EEPROM communication, to confirm the working of the oscillator & the flasher works fine. The file is attached.
Regards,
Sanjay
- Attachments
-
- PIC16F15354_Write_Read_EEPROM.fcfx
- (10.42 KiB) Downloaded 313 times
-
- osc.JPG (39.16 KiB) Viewed 43946 times
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi
Unfortunately I don't have the chip nor memory to test for myself to see if I can replicate.
However I assume you are using the same EEPROM in both tests so can rule it out as faulty. Do other I2C devices work when connected to the 15534? Might help narrow it down more.
Regards
EDIT
Medelec35 created an I2C sniffer that scans for all connected devices. Might be worth trying that to see if the chip can see the EEPROM
https://www.flowcode.co.uk/forums/viewt ... 3445#p3445
Unfortunately I don't have the chip nor memory to test for myself to see if I can replicate.
However I assume you are using the same EEPROM in both tests so can rule it out as faulty. Do other I2C devices work when connected to the 15534? Might help narrow it down more.
Regards
EDIT
Medelec35 created an I2C sniffer that scans for all connected devices. Might be worth trying that to see if the chip can see the EEPROM
https://www.flowcode.co.uk/forums/viewt ... 3445#p3445
-
- Posts: 23
- Joined: Fri Jun 08, 2012 10:54 am
- Location: India
- Has thanked: 10 times
- Been thanked: 3 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi,
The ICs were tested on the same hardware.
When I connected my Logic analyzer, with 723A, the comm was good & with 15354, there was absolutely no communication whatsoever on the bus.
I tried using "I2C (Peripheral CAL)", and the result was the same.
I strongly feel that the device file has some issues with it.
Regards,
Sanjay
The ICs were tested on the same hardware.
When I connected my Logic analyzer, with 723A, the comm was good & with 15354, there was absolutely no communication whatsoever on the bus.
I tried using "I2C (Peripheral CAL)", and the result was the same.
I strongly feel that the device file has some issues with it.
Regards,
Sanjay
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
Hi
It would seem to look that way.
I'm sure Matrix will advise.
Regards
It would seem to look that way.
I'm sure Matrix will advise.
Regards
- 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: PIC16F15354 - Non-working I2C & 24C16 Macros
Have you applied the latest files and fixes from here?
viewtopic.php?f=63&t=19743
If not then certainly that's worth doing.
viewtopic.php?f=63&t=19743
If not then certainly that's worth doing.
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: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC16F15354 - Non-working I2C & 24C16 Macros
With the flasher was you using your eye to judge or a scope/logic analyzer?Sanjay Singh wrote: ↑Tue Mar 21, 2023 7:20 amI have added a 1Hz flasher before the start of the EEPROM communication, to confirm the working of the oscillator & the flasher works fine.
This is not trueSanjay Singh wrote: ↑Tue Mar 21, 2023 7:20 amThe C code is not needed as the clock is configured in Project Options > Configure Window. I have attached a screenshot for your reference.
The reason is at power on the default speed with 32MHz selected is 16MHz
That is because the 32MHz is being divided down.
To run at 32MHz you will need the C code block as Chipfryer27 mentioned even though you have changed your target device.
Just place a C code black at the start of main with
Code: Select all
OSCFRQ = 0x06;
Martin