How do I setup I2C on MOD5270/Mod-Dev-70

Discussion to talk about software related topics only.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by seulater »

the data sheet for the part is located here
http://www.nxp.com/documents/data_sheet/PCF8563.pdf

I ran my own test with my own code using read and write and got the same numbers.
simplest thing to do now is add your device to the board and see if you get any more responding addresses.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by lgitlitz »

Doing that loop code only needs to be done up to 128. The I2C address only has 7 bits, the least signifigant bit is the R/W bit. So when you get 0, 57, 6F, 80, D7, and EF, this is actually only addresses 0x0, 0x57, 0x6F if you remove the most significant bit. Ignore the 0x0 address since I think all devices respond to this. The 0x6F device is the address of the Intersil RTC. The 0x57 device should be your sensor. Not sure why the data sheet for the sensor says the address should be 1D. Are you sure you have the right device?
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by seulater »

The 0x57 device should be your sensor.
I don't believe so, as i ran this same test on my dev kit and got the same numbers he did.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by lgitlitz »

Seulater, you are correct again! I am using a newer dev board with the NXP real time clock, it only responds to a single address. The older dev boards with the intersil RTC will respond to two addresses, 0x57 and 0x6F. The 0x6F address is used to access the RTC registers. The 0x57 address is used to access the user EEPROM space available on this device.

So it looks like the sensor module is not even acking its address. 99% sure that there is a hardware issue with the sensor connections. Check that you have a solid ground that is tied to the same ground as the dev board. Also make sure that both your AVDD and DVDD voltage rails have a solid 3.3V. Keep the I2C wires as short as possible between the controller and the sensor. It seems like a pretty simple sensor module with few connections so maybe your sensor was DOA?
arbotic
Posts: 7
Joined: Wed May 19, 2010 12:39 pm

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by arbotic »

seulater and lgitlitz;

I got it working :D I really want to thank you guys. I was about to give up. Having that loop code and realizing that I could set the RTC, made me zero in on connections.

I feel a bit dumb now but I just needed 1K inline resistors. This whole time I thought I needed pull up resistors on SDA and SCK. The code comments mentioned a jumper (JP12) to enable the pull up resistors on the development board. I don't have a JP12 :? The Parallax Propeller interface requires two 10 pull ups so that was my mind set. Anyway, I looked at the 5270 platform schematic for 100th time and really took noticed that the RTC has two inline unmarked resistors (I have an older MOD-DEV-70) so i grab a couple 1k and placed em inline. Blam, I could see 1D.

That's as far as I've gotten so far but I think I'm well on my way.

I really appreciate all the help.

Mike
sehsamudra
Posts: 19
Joined: Fri Sep 23, 2011 10:11 pm

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by sehsamudra »

Hi, I tried a simple experiment on a MOD54415 1.7 w/MOD-DEV-70CR 1.91 and code is attached:

Code: Select all

#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <smarttrap.h>
#include <taskmon.h>
#include "i2cmaster.h"

extern "C" {
void UserMain(void * pd);
}

const char * AppName="TESTBUS";

void UserMain(void * pd) {
	InitializeStack();
	if (EthernetIP == 0) GetDHCPAddress();
	OSChangePrio(MAIN_PRIO);
	EnableAutoUpdate();
	StartHTTP();
	EnableTaskMonitor();

#ifndef _DEBUG
	EnableSmartTraps();
#endif


	iprintf("Application started again\n");

	for( int x =0; x<128; x++)
	{
		if( I2CStart( x, I2C_START_READ ) < I2C_TIMEOUT )
			iprintf("We have a %X on the bus\r\n", x );
		I2CStop();
	}
	iprintf("Completed scan of I2C bus\n");

	while (1) {
		OSTimeDly(20);
	}
}
output is puzzling: no I2C devices? where did the RTC device go? Is the schematic wrong ?
----- Main Menu -----
A - Show ARP Cache
C - Show Counters
E - Show Ethernet Registers
I - Setup
P - Ping (Example: "P 192.168.1.1")
W - Show OS Seconds Counter
? - Display Menu
Link Status: UP, 100 Mbps, Full Duplex
Waiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started
Waiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started
Completed scan of I2C busWaiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started
Waiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started again
Waiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started again
Waiting 2sec to start 'A' to abort
Configured IP = 0.0.0.0
Configured Mask = 0.0.0.0
MAC Address= 00:03:f4:06:b7:ec
Application started again
Completed scan of I2C bus
mbrown
Posts: 61
Joined: Tue Jan 29, 2013 7:12 pm

Re: How do I setup I2C on MOD5270/Mod-Dev-70

Post by mbrown »

We've been playing with just this set of code in our office yesterday...We've looked at it and think there could potentially be a problem with the i2cmaster file. Normally what's supposed to happen if the bus times out is the driver is supposed to recover by resetting the bus. Currently, I don't think master does this. Try running this with i2cmulti. Just remember that the first argument passed into init is the slave address not the frequency divider, so if you are modifying those arguments, be aware of that.
Post Reply