PIC16F15354 - Non-working I2C & 24C16 Macros

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

Moderator: Benj

Post Reply
Sanjay Singh
Posts: 23
Joined: Fri Jun 08, 2012 10:54 am
Location: India
Has thanked: 10 times
Been thanked: 3 times
Contact:

PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Sanjay Singh »

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

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: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Benj »

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?

Sanjay Singh
Posts: 23
Joined: Fri Jun 08, 2012 10:54 am
Location: India
Has thanked: 10 times
Been thanked: 3 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Sanjay Singh »

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
Attachments
PIC16F15354_Write_Read_EEPROM.fcfx
(9.72 KiB) Downloaded 132 times
PIC16F723A_Write_Read_EEPROM.fcfx
(8.83 KiB) Downloaded 146 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by chipfryer27 »

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

Sanjay Singh
Posts: 23
Joined: Fri Jun 08, 2012 10:54 am
Location: India
Has thanked: 10 times
Been thanked: 3 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Sanjay Singh »

Hi,

I changed the Oscillator setting to 8MHz but still, it's not communicating.

Regards,
San

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by chipfryer27 »

Hi

Can you repost your chart please. Also,did you remember to include your C-code to set the Oscillator?

Regards

Sanjay Singh
Posts: 23
Joined: Fri Jun 08, 2012 10:54 am
Location: India
Has thanked: 10 times
Been thanked: 3 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Sanjay Singh »

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
Attachments
PIC16F15354_Write_Read_EEPROM.fcfx
(10.42 KiB) Downloaded 137 times
osc.JPG
osc.JPG (39.16 KiB) Viewed 21121 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by chipfryer27 »

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

Sanjay Singh
Posts: 23
Joined: Fri Jun 08, 2012 10:54 am
Location: India
Has thanked: 10 times
Been thanked: 3 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Sanjay Singh »

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

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by chipfryer27 »

Hi

It would seem to look that way.

I'm sure Matrix will advise.

Regards

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: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by Benj »

Have you applied the latest files and fixes from here?
viewtopic.php?f=63&t=19743

If not then certainly that's worth doing.

medelec35
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: PIC16F15354 - Non-working I2C & 24C16 Macros

Post by medelec35 »

Sanjay Singh wrote:
Tue Mar 21, 2023 7:20 am
I have added a 1Hz flasher before the start of the EEPROM communication, to confirm the working of the oscillator & the flasher works fine.
With the flasher was you using your eye to judge or a scope/logic analyzer?
Sanjay Singh wrote:
Tue Mar 21, 2023 7:20 am
The C code is not needed as the clock is configured in Project Options > Configure Window. I have attached a screenshot for your reference.
This is not true
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;
If after doing that and updating with Ben's suggestion then try using the sniffer on the 16F15354 target device as another good suggestion from chipfyrer27
Martin

Post Reply