Help request: List of PIC proven to work with i2c lib

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
sawani
Posts: 19
Joined: 02 Sep 2011 13:06

Help request: List of PIC proven to work with i2c lib

#1 Post by sawani » 15 Dec 2015 03:26

friends,
I have learned here that some of PIC micro controllers come defective right from factory that they cannot work with the I2C library. I wonder then, if there is a place where one can find a list of devices which has this fault, that he can avoid them right before he start his design.
Also I request anyone who has experience working whit I2C with pics help me with a list of device I can possibly use to replace PIC18F46K22, which has the stated problem. I have learned about the I2C problem with some chips when I have already produced PCB. Now I wonder which chip I can possible use to replace the 46k22, and save my time.
The list of good devices will also help even if I won’t be able to use them for replacement, i.e. when I am pushed to redesign my system.
Thank you very much

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: Help request: List of PIC proven to work with i2c lib

#2 Post by biljana.nedeljkovic » 15 Dec 2015 10:47

Hello,

How did you experience that I2C Library is not working, is it a hardware problem with a faulty chip or does it not work at all when you use our library?

The replacement for the mentioned microcontroller can be compared in various features, what is the most important, mamory, pinout?

You can check the datasheet for your controller's family or browse through Microchip's website.
http://ww1.microchip.com/downloads/en/D ... 41412F.pdf

Kind regards,
Biljana

sawani
Posts: 19
Joined: 02 Sep 2011 13:06

Re: Help request: List of PIC proven to work with i2c lib

#3 Post by sawani » 16 Dec 2015 07:10

biljana.nedeljkovic wrote:Hello,

How did you experience that I2C Library is not working, is it a hardware problem with a faulty chip or does it not work at all when you use our library?

The replacement for the mentioned microcontroller can be compared in various features, what is the most important, mamory, pinout?

You can check the datasheet for your controller's family or browse through Microchip's website.
http://ww1.microchip.com/downloads/en/D ... 41412F.pdf

Kind regards,
Biljana
Thank you Biljana
The most important feature was pinout because I have already produced the pcb. I have tried replaced it with pic18f4520. It seem to work but now it looks like I have a new problem.

The I2C experience with the first chip (pic18f46k22) is that it hangs when I attempt to write to EEPROM (24C08A). I searched the forum and find out it is a common problem. The explained reason for this (according to the topic found here: http://www.mikroe.com/forum/viewtopic.php?f=13&t=21270) is that some chips come from the manufacture with the problem that the PIR1.SSPIF bit (which is use on the library) does not set. I found in another or two forums the same thing was mentioned so I become highly convinced that the problem really exist. There is where the idea of a list of devices which do not have this problem stroke my mind.

NEW EXPERIENCE WITH PIC18F4520:
The f4520 is pin compatible with f46k22 so I decided to give it a shot. The mcu didn't hang now, which suggest the library can work with f4520. Or, according the the explained cause of the problem, the f4520 do not have issues with PIR1.SSPIF.

THE NEW PROBLEM:
Although the library now works, it seem that no data is being saved into the EEPROM, or (if it is saved) I can not ready it. I do not have a scope so I test the stored data by reading it back and display. I am using a number of module on my system, so the hard to send all code here. But I copy here the part which I think can help see what I am doing with the library.

Code: Select all

implements

sub procedure Prep2WrEEPROM
    I2C1_Start()           ' issue I2C start signal
    I2C1_Wr(0xA0)          ' EEPROM address +W
end sub

sub procedure Prep2RdEEPROM
    Prep2WrEEPROM
    I2C1_Wr(RdAddress)     'Address to read data from
    I2C1_Repeated_Start()  ' issue I2C signal repeated start
end sub

sub procedure SpecieIndexWr
'Save sellected specie index number into EEPROM:
    'Incubation specie Index---------------------------------------------------
    Prep2WrEEPROM
    I2C1_Wr(1)             ' address to write Specie Index
    I2C1_Wr(SvdSpecieIndex)      ' send data (data to be written)
    I2C1_Stop()            ' issue I2C stop signal
    delay_ms(20)          ' wait for the write cycle to finish
end sub

sub procedure SpecieIndexRd
    'Retrieve specie specie index number from EEPROM--------------------------------
    RdAddress = 1         ' Address to read specie index from
    Prep2RdEEPROM          ' Prepare to read a byte from above address
    I2C1_Wr(0xA1)          ' send byte (device address + R)
    RtrvdSpecieindex = I2C1_Rd(0)     ' Read the data (NO acknowledge)
    I2C1_Stop()            ' issue I2C stop signal
end sub
I have just wake up this morning. Haven't yet work much on this new problem my self since I encountered it last night. But though i better add it here.

Again thank you very much for your help and time.

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: Help request: List of PIC proven to work with i2c lib

#4 Post by biljana.nedeljkovic » 16 Dec 2015 15:43

Hello,

For each microcontroller, it is convenient to look at the errata documentation before implementing serious projects:
http://ww1.microchip.com/downloads/en/D ... 00514H.pdf

Check if the problem is with the complete line of microcontroller or if there is only some faulty batch of chips.
In that case you can order another microcontroller to try it.

The list of microcontrollers that can replace it is not very practical just because there are many aspects one should consider.

Please take a look at our examples for EEPROM, and attach your project in a way I could reproduce the same behavior and test it here.
You can send a zipped file.

Kind regards,
Biljana

sawani
Posts: 19
Joined: 02 Sep 2011 13:06

Re: Help request: List of PIC proven to work with i2c lib

#5 Post by sawani » 17 Dec 2015 04:26

Hi, Biljana

Thank you very much. And yes, I am learning from you now :)... It is better to read the errata before using any chip.
The good thing is the new chip I was trying on my project has proven to work very well with the library. I have managed to save and retrieve data from EEPROM already. Very efficiently till now. So I can say I have no problem with this anymore. I only benefited to get new experiences and understanding.

I thank you for taking your time answering my post

Nice time there :)

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: Help request: List of PIC proven to work with i2c lib

#6 Post by biljana.nedeljkovic » 17 Dec 2015 13:14

Hello,

I am glad this has been resolved.

I wish you good luck in your projects!

Best regards,
Biljana

sawani
Posts: 19
Joined: 02 Sep 2011 13:06

Re: Help request: List of PIC proven to work with i2c lib

#7 Post by sawani » 18 Dec 2015 21:19

Thank you Biljana

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”