Author Topic: I2C at M52259DEMO  (Read 10376 times)

Offline kbw

  • Newbie
  • *
  • Posts: 6
    • View Profile
I2C at M52259DEMO
« on: March 26, 2009, 11:15:04 AM »
I am trying to attach an 8574A pio to my 52259DEMO board.
The circuit is built on an hole matrix board and connectect with a flat cable to the I/O port connector. Pin 10 (I2C_SDA1) and Pin 12 ( I2CSCL1)  are pulled up with an 4k7 resistor.
It does not work. I am not sure if my software works and so to keeps things simple I enabled the IIC_INTERFACE in app_hw_m5233xh and TEST_IIC and TEST_DS1307 in application.c (uTasker SP9).
After flashing the board I expected to find Data or Clock signals on pin 10 or 12, but the ports remains silent.

The question is should i find I2C signals at pin 10/12?

Regards Karl

 
   

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: I2C at M52259DEMO
« Reply #1 on: March 26, 2009, 02:10:47 PM »
Hi Karl

The M52259 has 2 I2C interfaces:
- I2C0 can be mapped to port QS or keeps its primary function on port AS
- I2C1 can be mapped to port QS, UB, UC, or TH (and has no primary function of its own)

On your M52259DEMO board I2C_SDA1 and I2C_SCL2 are connected to pins 10 and 12 of connector J4. These signals are also marked URTS2 and UCTS2, showing that they are connected to the pins on UC. On the 144 pin processor these are processor pins 98 and 97.

To test these pins using the demo project (for RTC DS1307) you can configure as follows:

In config.h enable the I2C driver with IIC_INTERFACE
In application.c enable TEST_DS1307
In app_hw_m5223x.h you can select the I2C interface (0 or 1) - set OUR_IIC_CHANNEL     1 for I2C1
In the same file you can define which port the I2C1 interface is mapped to. To match the M52259DEMO board set IIC1_ON_UC

Recompile and you should then find that the signals appear at the connector that you require. Note that, if the port for I2C1 is not specified it will default to port QS. If you measure pins 19 and 23 on connector J4 (assuming they have a pull-ups) you should see that the signals are presently there in case you haven't specified anything different.

Regards

Mark

Offline kbw

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: I2C at M52259DEMO
« Reply #2 on: March 26, 2009, 05:25:01 PM »
Hi Mark,
unfortunately no signal.

I have taken a new directory, unpacked uTaskerV1.3_Kirin3.zip
then I unpacked uTaskerV1.3.0_M5223X_SP9.zip in the same directory.
In these files I did this changes:
config.h
        #define M52259DEMO
        #define IIC_INTERFACE
application.c
        #define TEST_DS1307
app_hw_m5223x.h
        #define IIC1_ON_UC 

After compiling and flashing the board, there are no signals at pin 10/12.
Same result with //#define IIC1_ON_UC  at port 19/23.
I also double-checked the cables and everything seems to be ok.

Helpless
Karl




 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: I2C at M52259DEMO
« Reply #3 on: March 26, 2009, 05:30:42 PM »
Hi Karl

I tested in the uTasker simulator and it did what I expected.

I will load to my M52259 board to verify and get back when I have either confirmed or found an explanation.

Regards

Mark

PS. You don't need to add SP9 to the Kirin3 package since SP9 is already included in it.
Also ensure that you force a complete rebuild. Recently there have been a few difficulties since not all files were being recompiled after change (causes changes not always to be used...). A clean usually sorts this out.
« Last Edit: March 26, 2009, 06:06:37 PM by mark »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: I2C at M52259DEMO
« Reply #4 on: March 26, 2009, 06:05:08 PM »
Hi Karl

I have tested this configuration on the M52259EVB and can confirm that the I2C signals appear correctly. I get around 300 SCL clock pulses on SCL1 and some corresponding data on SDA. There is no RTC attached so it doesn't do anything else but the signals look good (about 100KHz clock).

I checked the DEMO circuit again and all looks fine there. The same port lines are connected to the intermediate connector J2B (pins 75 + 77) and then lead to the connector that you are working with.

Have you verified that the project has been rebuilt with the new settings? Perhaps you could check that the signals appear directly on the processor pins to ensure that it is not a connection problem on the board. Also remove your connector in case there is a short circuit there somewhere corrupting measurements.

Regards

Mark

Offline kbw

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: I2C at M52259DEMO
« Reply #5 on: March 26, 2009, 09:00:11 PM »
Hi Mark

shame on me.
It works exactly as you said!

My initial fault was the wrong port, corrected with
 app_hw_m5223x.h
        #define IIC1_ON_UC   

I expected to find a periodical signal and so I have overseen the single pattern.
After triggering once the signals are as expected.

Thank you for your effort, next time I will do it better  ::).

Regards
Karl