cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ggancio
Visitor
Visitor
3,343 Views
Registered: ‎05-13-2010

MB I2C device

Hi community; I'm working with the Spartan 3E Starter Kit and I2C, under microblaze the I2C core works fine with a simple code to read an ADC but when I tried to use the I2C under ucLinux (same HW, and petalinux 0.4 distro, edk 10.1) I get the an error message, I select during the kernel setup process " device drivers -- I2C --I2C support -- I2C Alg -- Xlinx I2C " , also during the uclinux start up , the I2C can not get a irq assigned ( its assigned on HW with low priority ).

 

 

Some transcripts...

Startup msg.

.......

uclinux[mtd]: set ROMfs to be root filesystem index=0
i2c /dev entries driver
xilinx_iic xilinx_iic.0: could not allocate interrupt 3.
xilinx_iic: probe of xilinx_iic.0 failed with error -22
TCP cubic registered

...........

 

Using C program on uclinux

Can not access driver (/dev/i2c-0)!

 

and..

# ls /dev/i2c-
/dev/i2c-0   /dev/i2c-2   /dev/i2c-4   /dev/i2c-6
/dev/i2c-1   /dev/i2c-3   /dev/i2c-5   /dev/i2c-7
# cat /dev/i2c-0
cat: /dev/i2c-0: No such device
#

idem for all.....

 

Some HW

BEGIN xps_iic
 PARAMETER INSTANCE = I2C
 PARAMETER HW_VER = 2.00.a
 PARAMETER C_CLK_FREQ = 50000000
 PARAMETER C_BASEADDR = 0x81600000
 PARAMETER C_HIGHADDR = 0x8160ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT Scl = I2C_Scl
 PORT Sda = I2C_Sda
 PORT IIC2INTC_Irpt = I2C_IIC2INTC_Irpt
END
....Int_c.....

 PORT Intr = I2C_IIC2INTC_Irpt&RS232_DCE_Interrupt&Ethernet_MAC_IP2INTC_Irpt&xps_timer_1_Interrupt
......

BEGIN DRIVER
 PARAMETER DRIVER_NAME = iic
 PARAMETER DRIVER_VER = 1.13.b
 PARAMETER HW_INSTANCE = I2C
END

 

Any Idea will be very, very appreciated.

 

Thanks in advance.

Tags (1)
0 Kudos
Reply
2 Replies
mamisadegh2
Observer
Observer
3,304 Views
Registered: ‎06-15-2010

Dear Sir,

 

I tried to investigate your problem, and to make the same conditions as yours in my system in order to see if the error messages you mentioned here will happen.

 

my base system is similir to yours and i am using petalinux 0.4 for this specific test.

 

I have enabled all of the required i2c drivers in my petalinux kernel, and I have inserted them into the kernel.

 

Here is my kernel boot log ( the section that you are interested in)

 

........

erase region 0: offset=0x0,size=0x20000,blocks=256
RedBoot partition parsing not available
i2c /dev entries driver
i2c-core: driver [dev_driver] registered
i2c_adapter i2c-0: adapter [xilinx_iic.0] registered
i2c-dev: adapter [xilinx_iic.0] registered as minor 0
xilinx_iic.0 #0 at 0x90000000 mapped to 0xC4004000, irq=3
TCP cubic registered
...........

 

so as you see there is no such error,

 

now when the kernel comes up, here is the outcome of the cat /dev/i2c-0 command:

 

/dev # cat i2c-0
i2c-dev: i2c-0 reading 4096 bytes.
i2c_adapter i2c-0: master_xfer[0] R, addr=0x00, len=4096
xilinx_iic.0 #0: Unexpected error 1078.
/dev #

 

as you see the driver is working, about error 1078, i dont know what it is but i guess it is related to some required pre-configurations that i have not done in my system. ( it is not directly related to driver )

 

some portions of my MHS file

BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 2.00.a
 PARAMETER C_BASEADDR = 0x81800000
 PARAMETER C_HIGHADDR = 0x8180ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT Intr = xps_iic_0_IIC2INTC_Irpt&RS232_DCE_Interrupt&Ethernet_MAC_IP2INTC_Irpt&xps_timer_0_Interrupt
 PORT Irq = microblaze_0_Interrupt
END

BEGIN xps_iic
 PARAMETER INSTANCE = xps_iic_0
 PARAMETER HW_VER = 2.01.a
 PARAMETER C_BASEADDR = 0x90000000
 PARAMETER C_HIGHADDR = 0x90001FFF
 BUS_INTERFACE SPLB = mb_plb
 PORT IIC2INTC_Irpt = xps_iic_0_IIC2INTC_Irpt
END

My kernel .config file

 

#
# I2C support
#
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y

#
# I2C Algorithms
#
# CONFIG_I2C_ALGOBIT is not set
# CONFIG_I2C_ALGOPCF is not set
# CONFIG_I2C_ALGOPCA is not set
CONFIG_XILINX_IIC=y

 

hope helped,

Regards

Mohammad Sadegh Sadri

 

 

 

0 Kudos
Reply
ggancio
Visitor
Visitor
3,288 Views
Registered: ‎05-13-2010

Thanks for your reply and your time, after seen your logs and files (almost  the same configuration that me) I start to review the kernel configuration, the I2C and was the same. Then I find under "Platform options -- Definitions of INTC_0  " the maximum number of interrupts, after increase NUM_INTR_INPUTS range to 4, the kernel was able to assign an Irq to the I2C, and the software starts to work, just fine!.

Thanks again for you time and answer.

0 Kudos
Reply