Page 1 of 1

PIC16F15354 - Non-working I2C & 24C16 Macros

Posted: Tue Mar 07, 2023 10:53 am
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

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

Posted: Wed Mar 08, 2023 6:03 pm
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?

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

Posted: Mon Mar 20, 2023 2:48 pm
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

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

Posted: Mon Mar 20, 2023 10:59 pm
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

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

Posted: Tue Mar 21, 2023 5:55 am
by Sanjay Singh
Hi,

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

Regards,
San

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

Posted: Tue Mar 21, 2023 7:07 am
by chipfryer27
Hi

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

Regards

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

Posted: Tue Mar 21, 2023 7:20 am
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

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

Posted: Tue Mar 21, 2023 12:09 pm
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

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

Posted: Tue Mar 21, 2023 2:53 pm
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

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

Posted: Tue Mar 21, 2023 4:08 pm
by chipfryer27
Hi

It would seem to look that way.

I'm sure Matrix will advise.

Regards

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

Posted: Tue Mar 28, 2023 2:27 pm
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.

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

Posted: Tue Mar 28, 2023 10:17 pm
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