It is currently 23 Oct 2017 14:50

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: 06 Oct 2017 17:42 
Offline
mikroElektronika team
User avatar

Joined: 15 Jan 2016 12:50
Posts: 1453
Hi,

Unfortunately I don't have PIC18F23K22,
but I have tested I2C1 on PIC18LF26K22 which uses the same library
with EEPROM click and it was working properly.

Also, unfortunately, we don't have PCF8566,
therefore I cannot try your code.

I suggest you to check datasheet of module which you
are using and to try to debug your code.

Kind regards,
Lana


Top
 Profile  
 
PostPosted: 07 Oct 2017 14:09 
Offline

Joined: 08 Jul 2014 18:12
Posts: 4
Hi

Well I'm still not seeing a start bit or the data for the device address being sent when I scope the SCL and SDA pins.

Am I missing something with the set up of the Micro? I am setting TRISC pins 3 and 4 to be outputs before running the I2C routines. Do I need to be doing anything else?


Thanks


Top
 Profile  
 
PostPosted: 07 Oct 2017 19:15 
Offline

Joined: 24 Jun 2007 19:27
Posts: 879
Location: 01120 Dagneux France
hello,

very ofen, it is a problem of bad adressing ..

to check device on I2C bus, i use this application.. (written for 18F26K2 I2C1 bus RC3 RC4)
list all devices fund on I2C bus


Top
 Profile  
 
PostPosted: 10 Oct 2017 08:42 
Offline

Joined: 25 Dec 2008 15:22
Posts: 2703
Location: Scotland
@mertinroger

even if the address is wrong you would still see the pic send Start, Data, and then it would wait for ACK if requested.

I assume you have the external pull-ups fitted.

Take the I2C slave off the bus and then see if the PIC is able to drive the SDA/SCL. This will be the start point from which to move forward, if you get the PIC driving the bus then it proves that your pic and basic code are good. Next you can work out why the I2C slave is holding the bus lines.

_________________
Best Regards

Mince


Top
 Profile  
 
PostPosted: 12 Oct 2017 16:02 
Offline

Joined: 08 Jul 2014 18:12
Posts: 4
@Mince

Thanks for the tips. I removed the slave device and verified that the PIC was not outputting anything on the SCL/SDA lines. I added ANSELC=0; in my set up and that fixed the problem. Now my PIC is talking. I have since been able to port that code over to my intended target board that uses a PIC18F67K22.

Thanks to all for your help.

Cheers


Top
 Profile  
 
PostPosted: 14 Oct 2017 07:47 
Offline

Joined: 24 Aug 2014 17:55
Posts: 82
Location: Sheffield
Hi Mertin,
glad you got it sorted, such a simple thing to forget. I did a similar thing on a project I was working for a customer, drove me mad for days trying to sort it, so on every project now I always initialise all the PIC I/O as being digital and turn off all Analog periphs until I am at the stage when needed.

_________________
"When the bugs strike it's no good bashing your head against a brick wall, you might damage the wall"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: