Probing the mini2440 I2C bus

I’m fairly new to electronics and i’ve certainly never used I2C before so I built a simple circuit based on a DS1621 I2C thermometer as a test. I got this for a couple of pounds from the seller ‘crodnet’ on ebay.

I found an old 2.5″ laptop drive connector which wasn’t large enough to fit on CON5 so i chopped it up and put it on the camera interface. I wired up the SDA and SCL lines along with 3.3V and GND to the veroboard. I also soldered a couple of LEDs, one for the power light and the other wired up through a transistor with the base connected to the thermostat output on the DS1621. This pin can be programmed to go high at a particular temperature.

I then plugged it in and powered up the mini2440. Running i2cdetect showed a new device at 0x48. The other devices are the onboard EEPROM. Looking at the datasheet for the DS1621 the temperature can be read from the location 0xAA. I was able to observe the temperature in hex through i2cget. Converting the output 0x0016 to decimal gives 22.0 degrees. The sensor is pretty neat, it responds almost immediately to the presence of your finger.

Below are the I2C commands i used. I installed i2c tools using opkg.

root@mini2440:~# i2cdetect -l
i2c-0    i2c           s3c2410-i2c                         I2C adapter

root@mini2440:~# i2cdetect s3c2410-i2c
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

root@mini2440:~# watch --interval=1  i2cget -y s3c2410-i2c 0x48 0xAA w

Every 1.0s: i2cget -y s3c2410-i2c 0x48 0xAA w      Tue Sep 15 23:31:25 2009
0x0016

Below is a picture of the device..it looks like a right mess but it works great!

DSC_0032

The next stage is compile the driver from the lmsensors package…

7 Replies to “Probing the mini2440 I2C bus”

  1. Doug,

    Is there anything similar for SPI. I am using 2.6.32.7 (from bitbake) , default config.

    Docs on how to setup kernel and how to use from application seems to be lacking. I haven’t found one
    after hours of searching. Any pointers that you are aware of that will get me started pl

    1. I haven’t looked into SPI much but I do agree there is not as much documentation. There is an spi-dev interface. Have you seen the free book linux device drivers (revision 3)?

      http://lwn.net/Kernel/LDD3/

      Although it’s not bang up to date i’ve found it a very useful reference. Then there is the kernel documentation and the source code. Which device do you have?

  2. Hello Doug,

    I’m a complete newbie on both embedded devices and electronics. I only worked on a AVR32 board NGW100 before a little bit. Now i ordered a Mini2440 to plug in some sensors like temperature, heart rate etc… I’ll try to get datas by I2C.

    I’ve been searching on internet but my mind isn’t clear because of my lack of inormation and experience. May i ask some questions?

    1- I plan to use this temperature sensor:
    http://www.sparkfun.com/commerce/product_info.php?products_id=9418

    Do i need to set up extra circuit on it? Or may i just get the datas by connecting its pins to boards GPIO? If not GPIO, where?

    2- Far as i read, i need to compile the kernel for i2c support. After i compile, how can i test if it works or not? Can i test it without sensors working?

    If you would help me, it will be really great motivation for beginning. Thanks.

    yalpertem@gmail.com

  3. Hi, I haven’t heard of the chip used in that temp sensing module you’ve linked to but it will hook up no problem. All you need are the SDA /SCL lines and 3.3V / GND. Look in the schematic for their location. I would also check if it is supported by Linux because if it isn’t you’ll need to write a driver. That’s pretty easy considering it won’t be much different to what exists already but you might not want the extra trouble, in which case choose something that is supported like a LM75, DS1621 etc.. If you compile Bus Errors kernel i2c support should be enabled by default. There is already an I2C EPROM on the board you can play around with. Good luck! Doug

  4. Hey Doug,

    I am using the friendly arm cam130 module. if I’m right that should be on the I2C bus at address 60. I know the camera module is working as i have got it running with the test2440 application that came on the DVD. So the camera module works – no loose contacts and all that. but in linux, i can’t find it on i2cdetect. It showed the UUUUU part that the EEPROM, but the rest of the table was just dashes. and my driver is failing at the point where it should get the cameras manufaturing address.
    Any ideas on how i can detect this camera on the bus?

  5. Hi Wingston,

    Have you seen this driver?

    http://code.google.com/p/s3c2440camera/

    It’s just a guess, but maybe the camera needs something like a chip select line pulled low to enable it, in which case if you don’t have the pins configured properly in your kernel, or you’re not following the correct procedure it might not show up on the I2C bus. That’s purely speculation – you’d have to read the datasheet to check.

    I haven’t followed progress on it, but i ported the driver to 2.6.32.7 (pretty trivial if i remember). I’ll try and dig it out over the weekend.

    Doug

Leave a Reply

Your email address will not be published. Required fields are marked *