2009-03-16 04:15:55     i2c-tools

2009-03-16 04:15:55     i2c-tools

Daniele Pagani (ITALY)

Message: 71008   

Dear Sirs,

I'm using AT24C1024B eeprom connected by i2c to my board, using BF537.

I need this eeprom in order to store/read some parameters (not for boot).

This is my boot:

Linux version 2.6.28.7-ADI-2009R1-pre-svn6163 (root@linux-fbdo) (gcc version 4.1

.2 (ADI svn)) #21 Fri Mar 13 10:26:51 CET 2009

console [early_BFuart0] enabled

early printk enabled on early_BFuart0

Warning: limiting memory to 27MB due to hardware anomaly 05000263

Board Memory: 32MB

Kernel Managed Memory: 28MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x0010c480

  rodata    = 0x0010c480-0x0015aeb8

  bss       = 0x0015aec0-0x0016985c

  data      = 0x0016985c-0x0017a000

    stack   = 0x00178000-0x0017a000

  init      = 0x0017a000-0x00472000

  available = 0x00472000-0x01aff000

  DMA Zone  = 0x01b00000-0x01c00000

Hardware Trace Active and Enabled

Boot Mode: 0

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

boot memmap: 0000000000472000 - 0000000001aff000 (usable)

On node 0 totalpages: 6911

free_area_init_node: node 0, pgdat 001762cc, node_mem_map 00477000

  DMA zone: 54 pages used for memmap

  DMA zone: 0 pages reserved

  DMA zone: 6857 pages, LIFO batch:0

  Normal zone: 0 pages used for memmap

  Movable zone: 0 pages used for memmap

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 6857

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,115200 cons

ole=ttyBF0,115200 max_mem=32M mem=28M

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 128 (order: 7, 512 bytes)

console handover: boot [early_BFuart0] -> real [ttyBF0]

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Kernel managed physical pages: 6911

Memory available: 22792k/28672k RAM, (3040k init code, 1069k kernel code, 439k d

ata, 1024k dma, 308k reserved)

Calibrating delay loop... 997.37 BogoMIPS (lpj=1994752)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (41 KB free)

PDA for CPU0 reserved at 0015bef0

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin GPIO Controller

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

NET: Registered protocol family 1

Setting up Blackfin MMR debugfs

msgmni has been set to 44

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

simple-gpio: now handling 48 GPIOs: 0 - 47

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:03, irq=-1, mdc_

clk=2500000Hz(mdc_div=19)@sclk=100MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

physmap platform flash device: 00400000 at 20000000

physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank

Amd/Fujitsu Extended Query Table at 0x0040

number of CFI chips: 1

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.

RedBoot partition parsing not available

Using physmap partition information

Creating 3 MTD partitions on "physmap-flash.0":

0x00000000-0x00040000 : "bootloader(nor)"

0x00040000-0x003f0000 : "Linux"

0x003f0000-0x00400000 : "MAC Address(nor)"

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc00500, dma channel@7

i2c /dev entries driver

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base

@ffc01400

TCP cubic registered

NET: Registered protocol family 17

Distributed Switch Architecture driver version 0.1

eth0: detected a KSZ8893M switch

dsa slave smi: probed

Freeing unused kernel memory: 3040k freed

dma_alloc_init: dma_page @ 0x0017a000 - 256 pages at 0x01b00000

Then, I run this command:

root:/> i2cdetect 0

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]

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: 50 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --

--> Ok, according to datasheet, 0x50 is the code for write, 0x51 is the code for read.

root:/> i2cdetect -l

i2c-0   i2c             i2c-bfin-twi                            I2C adapter

--> to understand if the driver works fine.

root:/> i2cset 0x00 0x50 0x00 0x23 b

WARNING! This program can confuse your I2C bus, cause data loss and worse!

DANGEROUS! Writing to a serial EEPROM on a memory DIMM

may render your memory USELESS and make your system UNBOOTABLE!

I will write to device file /dev/i2c-0, chip address 0x50, data address

0x00, data 0x23, mode byte.

Continue? [y/N] y

--> to write

root:/> i2cget 0x00 0x51 0x00 b

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will read from device file /dev/i2c-0, chip address 0x51, data address

0x00, using read byte data.

Continue? [Y/n]

0xff

--> to read, but the write is not ok, I don't see the byte written.

root:/> i2cdump 0x00 0x51

No size specified (using byte-data access)

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-0, address 0x51, mode byte

Continue? [Y/n]

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef

00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

--> to check all.

Any suggestion?

Then, if I try to use an application, as decribed in dev-interface, I received erros.

Now, for example, if I write:

#include "i2c-dev.h" // I've copied this file from i2c-tools directory

#include <stdio.h>

int main(){

return 0;

}

then I run:

bfin-linux-uclibc-gcc namefile.c

I have:

In file included from /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/pthread.h:21,

                 from /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/bits/uClibc_mutex.h:15,

                 from /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/bits/uClibc_stdio.h:119,

                 from /opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/stdio.h:72,

                 from simple.c:7:

/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/time.h:105: error: conflicting types for ‘timer_tâ€Tm

/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/linux/types.h:22: error: previous declaration of ‘timer_tâ€Tm was here

So, I can not compile.

Any suggestion for the first and the second problem?

Regards,

Daniele.

TranslateQuoteReplyEditDelete

2009-03-16 04:33:33     Re: i2c-tools

Mike Frysinger (UNITED STATES)

Message: 71022   

perhaps the i2c bus is running too fast for the eeprom ?  i dont suppose you have a logic analyzer you can put on the bus to make sure things are shifting out as you'd expect ?

as for the 2nd, include i2c-dev.h last, not first

QuoteReplyEditDelete

2009-03-16 05:37:41     Re: i2c-tools

Daniele Pagani (ITALY)

Message: 71023   

Sorry, Mike,

but who can I change the speed of the i2c bus?

Please, consider that I've only one device connected to the i2c bus, that is the eeprom.

It means, that I can also think to do a "static" setup for the i2c speed.

Regarding the #include, I don't understand what means "last, not first".

I've 3 i2c-dev.h

The first in /linux directory, but, as I read in dev-interface document, I need to use i2c-dev.h in i2ctools directory.

In i2c-tools directory I've two versions:

i2c-tools-3.0.1 and

i2c-tools-3.0.2

So, I don't understand, in userspace, what I need to use.

I'm using live distribution,

uclinux-dist 7862

linux 6164

Regards,

Daniele.

TranslateQuoteReplyEditDelete

2009-03-16 06:14:52     Re: i2c-tools

Mike Frysinger (UNITED STATES)

Message: 71024   

you include multiple headers.  i2c-dev.h needs to be last.

QuoteReplyEditDelete

2009-03-16 08:59:49     Re: i2c-tools

Daniele Pagani (ITALY)

Message: 71030   

Dear Mike,

now, the compilation is ok, thank you.

Anyway, I've the same result as usign i2c-tools.

So, when I choose settings with make menuconfig, I select also the:

<*> Blackfin TWI I2C support

(50) Blackfin TWI I2C clock (khz)

so, I suppose that the clock is 50khz.

The eeprom's datasheet tells me something like 400khz as clock frequency scl, so I don't think that this could be the problem.

I'll use the oscilloscope as soon as possible, in order to understand electrical signal's problems.

Under Miscellaneous I2C Chip support, I've selected also:

<*> EEPROMs from most vendors

so, I suppose that AT24- is supported.

Suggestions?

Regards,

Daniele.

TranslateQuoteReplyEditDelete

2009-03-23 04:40:13     Re: i2c-tools

Ashish Gupta (INDIA)

Message: 71364   

Dear Daniele Pagani

I am new to using the I2C bus on blackfin uClinux, can u please tell me how you went about adding the i2c-tools. I am using a BF537.

regards

Ashish

QuoteReplyEditDelete

2009-03-24 04:48:37     Re: i2c-tools

Daniele Pagani (ITALY)

Message: 71430   

Dear Ashish,

please, consider that I'm using uclinux live dist:

uclinux-dist revision 7862

linux revision 6164

Then, running make menuconfig I select:

Device Drivers

I2C Support

<*> I2C device interface

I2C Hardware Bus support

<*> Blackfin TWI I2C support

<50) Khz

Miscellaneous I2C Chip support

<*> EEPROMs from most vendors

Then, in Blackfin app programs you'll find I2C Tools.

I suggest you to read:

  docs.blackfin.uclinux.org/doku.php?id=i2c

Regards,

Daniele.

TranslateQuoteReplyEditDelete

2009-04-09 09:26:49     Re: i2c-tools

Ralph Bertelsmann (GERMANY)

Message: 72466   

> then, in Blackfin app programs you'll find I2C Tools.

Are there I2C Tools in 2008R1.5-RC3?

Or do i have to go to trunk?

Thanks & Greetings!

TranslateQuoteReplyEditDelete

2009-04-09 15:24:10     Re: i2c-tools

Mike Frysinger (UNITED STATES)

Message: 72474   

there were added after the release, so no

  • Created
Was this helpful?

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.