2008-10-27 12:28:24     can't get the TWI-LCD-CHAR Interface working

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-10-27 12:28:24     can't get the TWI-LCD-CHAR Interface working

Li Yuqian (CHINA)

Message: 64235   

 

Hi guys,

 

i am try get a HD44780 LCD char working, but not luck, i can't get it working. i follow this link for driver and this link  for hardware for my testing.

 

for pcf8574 chips i found one Philips, and the chip label is PCF8574T-k75331, my board is a custom used BF537, i used uClinux-dist-2008R1-RC8 and blackfin-toolchain-08r1-8.

 

now i try to load the driver

 

1. modprobe i2c-bfin-twi

 

2. modprobe i2c-dev

 

3. cat /dev/i2c-0 will show >> cat: read error: Input/output error

 

4. modprobe bfin_twi_lcd

TWI LCD Driver v0.00

root:/ cat /dev/lcd

cat: /dev/lcd: No such device or address

 

5. root:/> cat /proc/iomem

ffc00400-ffc004ff : bfin-uart.1

ffc00500-ffc005ff : bfin-spi.0

ffc01400-ffc01400 : i2c-bfin-twi.0

 

and the /proc/bus directory nothing show out.

 

6. i try using uClinux-dist-2008R1-RC8/user/blkfin-test/ppifcd-test/i2c.c to scan the i2c bus, just got

root:/> ./i2c

FOUND I2C device at 0x20 (8-bit Adrress 0x40)

Error: could not write

Error: could not write

Error: could not read back

Error: could not write

Error: could not read back

 

7. when i try to load the pcf8574 driver, the console show nothing and nothing happed

 

seems i can't get the pcf8574 working now, so, my question is, does the PCF8574T and PCF8574 have some different? or i missed something  ? thanks

 

my board define file is

 

#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)

static struct resource bfin_twi0_resource[] = {

        [0] = {

                .start = TWI0_REGBASE,

                .end   = TWI0_REGBASE,

                .flags = IORESOURCE_MEM,

        },

        [1] = {

                .start = IRQ_TWI,

                .end   = IRQ_TWI,

                .flags = IORESOURCE_IRQ,

        },

};

 

static struct platform_device i2c_bfin_twi_device = {

        .name = "i2c-bfin-twi",

        .id = 0,

        .num_resources = ARRAY_SIZE(bfin_twi0_resource),

        .resource = bfin_twi0_resource,

};

#endif

 

 

#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)

        &i2c_bfin_twi_device,

#endif

 

QuoteReplyEditDelete

 

 

2008-10-28 08:30:04     Re: can't get the TWI-LCD-CHAR Interface working

Michael Hennerich (GERMANY)

Message: 64275   

 

For me things work on 2008R1 and svn trunk.

See my comments below.

 

The driver in 2008R1 and svn trunk is different.

The driver on svn trunk uses the new style I2C drivers binding. And the Slave address needs to be defined the platform board file.

 

For scanning the I2C bus simply use u-boot iprobe command.

See below:

 

U-Boot 1.1.6-svn1382 (ADI-2009R1-pre) (Oct 6 2008 - 10:03:02)

 

CPU: ADSP bf537-0.2 (Detected Rev: 0.2)

Board: ADI BF537 stamp board

Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz

RAM: 64 MB

Flash: 4 MB

In: serial

Out: serial

Err: serial

Net: Blackfin EMAC

MAC: 00:E0:22:FE:40:C8

Hit any key to stop autoboot: 0

 

bfin> iprobe

Valid chip addresses: 22 2F

bfin>

 

In this case 0x22 in the I2C slave address of the I2C IO expander.

 

On 2008R1 - This one is the one that needs to be given as Kconfig option.

Be aware 0x22 = 34 dec.

 

<M> TWI/I2C LCD support for HD44780 based LCD modules

(34) I2C Slave Address

 

 

root:/> version

kernel: Linux release 2.6.22.19-ADI-2008R1.5-svn5301, build #2116 Tue Oct 28 13:18:14 CET 2008

toolchain: bfin-linux-uclibc-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release svn-7172, build #521 Tue Oct 28 13:17:19 CET 2008

root:/>

 

root:/> modprobe i2c-bfin-twi

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller Driver, Version 1.8, regs_base@ffc01400

 

root:/> modprobe bfin_twi_lcd

TWI LCD Driver v0.00

 

root:/> while [ 1 ];twilcd_test -p 0 "`uptime`";done

TWI LCD Test Application

 

Position : 0

Message : 19:07:40 up 1 min, load average: 0.00, 0.00, 0.00

TWI LCD Test Application

 

Position : 0

Message : 19:07:40 up 1 min, load average: 0.00, 0.00, 0.00

TWI LCD Test Application

 

You might want to svn update your 2008R1 tree – I checked in a small change.

Use msleep in two places where we would have been busy waiting for 2-4 ms otherwise.

 

Best regards,

Michael

 

QuoteReplyEditDelete

 

 

2008-10-29 05:23:42     Re: can't get the TWI-LCD-CHAR Interface working

Li Yuqian (CHINA)

Message: 64324   

 

Thanks Michael, i try upgrade my uClinux version to 2008R1.5, now my LCD working. coool !

Attachments

    Outcomes