| View previous topic :: View next topic |
| Author |
Message |
scanan
Joined: 13 Aug 2004 Posts: 84 Location: Turkey
|
| external eeprom |
Posted: Thu Dec 25, 2025 1:30 am |
|
|
Hi,
I have application which uses a pic18f6410 and eeprom 2416.
2 eeprom is connected to pic but comunicate on different bus.
On the same hardware,
when I compile the code with ccs ver 4.135 everything works fine
I read write in eeprom . But when I compile the code with ccs ver 5.118
cant read and write in the eeprom. what could be the issue. The code was written 10 years ago with ccs 4.114. I want to compile on ccs ver 5118.
I did some modification on the 2416 driver
#define EEPROM_SDA1 PIN_C4
#define EEPROM_SCL1 PIN_C3
#define EEPROM_SDA2 PIN_C1
#define EEPROM_SCL2 PIN_C0
#use i2c(master, sda=EEPROM_SDA1, scl=EEPROM_SCL1,stream=b1,FORCE_HW)
#use i2c(master, sda=EEPROM_SDA2, scl=EEPROM_SCL2,stream=b2,FORCE_SW)
works in Software i2c mode but note on Harware mode
cheers _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9608 Location: Greensville,Ontario
|
|
Posted: Thu Dec 25, 2025 12:23 pm |
|
|
FWIW...
My 'gut' is telling me to stay with 4.135 as it WORKS and the project is 10 years old.
Unless you change the PIC, I don't see the need to use a newer version of the compiler. |
|
 |
dyeatman
Joined: 06 Sep 2003 Posts: 1975 Location: Norman, OK
|
|
Posted: Thu Dec 25, 2025 3:05 pm |
|
|
You said there are two eeproms.
Is one working and one not (if so, which is which) or are
neither of them working in HW mode? _________________ Google and Forum Search are some of your best tools |
|
 |
scanan
Joined: 13 Aug 2004 Posts: 84 Location: Turkey
|
|
Posted: Fri Dec 26, 2025 4:54 am |
|
|
| dyeatman wrote: | You said there are two eeproms.
Is one working and one not (if so, which is which) or are
neither of them working in HW mode? |
neither working in HW but both works in SW _________________ Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com
Do whatever you do with amateur spirit -
But always feel professional. |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9608 Location: Greensville,Ontario
|
|
Posted: Fri Dec 26, 2025 7:22 am |
|
|
Well ,since they work with SW version, it's not a PCB/hardware problem.
I'd look at the listings of both the working 4.135 and the nonworking 5.118. Since the source code is the same, the listing should be identical.
My hunch is the newer compiler has set some bits wrong in a register, perhaps a peripheral on the i/o ports hasn't been disabled ? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20009
|
|
Posted: Sat Dec 27, 2025 5:37 am |
|
|
The problem here is you are specifying impossible things. The old compiler
was just ignoring these. The newer one is trying to do what you say,
and failing. Your chip only has one hardware MSSP, on C3 and C4, so only
these pins can accept the force_hw. Then you are not specifying the I2C
clock rate. The default for the newer compiler is to always clock as fast
as possible. You need to be specifying your clock rate for the hardware
I2C. Be aware that the hardware I2C will be defaulting to I2C voltage
levels on the input pins. How good are your pullups?. At the high rate
the new compiler will generate these will need to be very low resistance
if the bus has any significant capacitance. |
|
 |
|