LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-29-2017, 05:38 AM   #16
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled

Below are my output

Code:
:~# ls /sys/bus/i2c/devices/
0-003c  0-0050  1-0008  1-001b  2-0038  2-0068  i2c-0   i2c-1   i2c-2
:~#
Code:
:~# ls -l /sys/bus/i2c/devices/
lrwxrwxrwx    1 root     root             0 Jan  1  2000 0-003c -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-003c
lrwxrwxrwx    1 root     root             0 Jan  1  2000 0-0050 -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-0050
lrwxrwxrwx    1 root     root             0 Jan  1  2000 1-0008 -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-0008
lrwxrwxrwx    1 root     root             0 Jan  1  2000 1-001b -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-001b
lrwxrwxrwx    1 root     root             0 Jan  1  2000 2-0038 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2/2-0038
lrwxrwxrwx    1 root     root             0 Jan  1  2000 2-0068 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2/2-0068
lrwxrwxrwx    1 root     root             0 Jan  1  2000 i2c-0 -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0
lrwxrwxrwx    1 root     root             0 Jan  1  2000 i2c-1 -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1
lrwxrwxrwx    1 root     root             0 Jan  1  2000 i2c-2 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2
:~#
Here is message during board booting

Code:
rtc-ds1307 2-0068: rtc core: registered ds1307 as rtc0
rtc-ds1307 2-0068: 56 bytes nvram
snvs_rtc 20cc000.snvs:snvs-rtc-lp: rtc core: registered 20cc000.snvs:snvs-r as rtc1
i2c /dev entries driver
rtc-ds1307 2-0068: setting system clock to 2017-06-29 07:50:44 UTC (1498722644)

My hardware is DART-MX6 board. It is the main board connected with an extended board name VAR-DT6Custom Board.

These are the spec of DART-MX6 board and extended VAR-DT6Custom board:
DART-MX6
VAR-DT6Custom Board

You can check the connection between DART-MX6 and VAR-DT6 Custom board at page 9 of VAR-DT6Custom Board

For the chip set, please check it at DART-MX6 spec. RTC is ISL12057. I2C address of ISL12057 is 0x68. It seems that driver of DS1307 is used for ISL12057 because I see the RTC on my board is ISL12057, but during booting the board, ds1307 message is displayed.

If you need to refer more detail about DART-MX6 and VAR-DT6Custom board, you can check them at below links. Please select "DOCUMENTATION" tab in the web.
DART-MX6 More ref
VAR-DT6Custom More ref

For root permission, I am running as a root because my account is root. I will take care about security of root permission. At present, I need to solve the error about RTC accessing firstly.

I am trying to eliminate RTC driver from the kernel but I am not successful now. So, the error still occurs.
 
Old 06-29-2017, 09:07 AM   #17
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,475

Rep: Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354
Right, disregard most of my output. I had the illusion you had an x86 board there; You have a 32bit arm A9 cored cpu.

I am suspicious of the address 0x68. I presume the Arm A9 can do an 8 bit instruction, but it's more usual to have an address range with input separated from output. i2c is a serial connection which needs an i2c serial port, not an I/O address. Something has to do serial/parallel translation before it can talk to the bus.

If you go at what i2c serial port it's talking to, and what's talking to that, what do you find?
 
Old 06-30-2017, 06:30 AM   #18
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thanks sir for your enthusiasm!!

I tried to connect another RTC- DS3231 - to i2c-0. i2c-tools can access to DS3231 normally. Slave address of DS3231 is also 0x68.

Code:
:~# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: UU -- -- -- 54 55 -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
:~# i2cget 0 0x68 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x68, data address
0x00, using read byte data.
Continue? [Y/n] y
0x04
:~# i2cget 0 0x68 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-0, chip address 0x68, data address
0x00, using read byte data.
Continue? [Y/n] y
0x14
:~#
But for i2c-2, the error "Devices or resource busy" still occur. So I think it same error as "IOError: [Errno 16] Device or resource busy"

Code:
:~# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
:~# i2cget 2 0x68 0
Error: Could not set address to 0x68: Device or resource busy
:~#
Quote:
I am suspicious of the address 0x68. I presume the Arm A9 can do an 8 bit instruction, but it's more usual to have an address range with input separated from output. i2c is a serial connection which needs an i2c serial port, not an I/O address. Something has to do serial/parallel translation before it can talk to the bus.
As above information, I can access to I2C-0 devices by i2c-tools, but accessing to I2C-2 is not successful.
By this result, I think ARM A9 can control i2c device well. But at 0x68 of i2c-2, there is some trouble. It may be a driver is controlling i2c-2, address 0x68, so I can not access to that I2C-2, address 0x68.

Code:
If you go at what i2c serial port it's talking to, and what's talking to that, what do you find?
So sorry. I can not get your idea. So, could you describe it in another way that is clearer?

Thanks.

Last edited by jackbk; 07-03-2017 at 05:16 AM.
 
Old 06-30-2017, 10:15 AM   #19
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,475

Rep: Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354
Quote:
If you go at what i2c serial port it's talking to, and what's talking to that, what do you find?

So sorry. I can not get your idea. So, could you describe it in another way that is clearer?
Yes. Each i2c port is a serial port. The port in question seems to be
0068 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2/2-0068.

Now either that's an Arm i2c port, or on some device. I presumed the latter; My point was that you should investigate the i2c device if possible. The ds1307 has 56 bytes of ram, so I'm surprised at it only having a single byte of I/O.
 
Old 07-03-2017, 05:16 AM   #20
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Finally, I can access to ISL12057 RTC!

Please see attachment named resolve_ioerror.png.
I can remove a driver that controls ISL12057 RTC, and access to the RTC by i2c-tools successfully.

Now Python can communicate with ISL12057 RTC by SMBus well. I can talk with it.

I will investigate more about this issue, but at now, I understand the problem is as below.
1. A driver is controlling my RTC, so I can not access to my RTC by i2c-tool or SMBus
2. Remove the driver will move my RTC to free state. I can talk to my RTC when it is in free state.

Here is more output after I remove the driver.
Code:
:~# cat /proc/ioports | grep rtc
:~# cat /proc/ioports |grep rtc
:~# cat /proc/ioports
:~# ls -l /sys/bus/i2c/devices
lrwxrwxrwx    1 root     root             0 Jan  1  1970 0-003c -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-003c
lrwxrwxrwx    1 root     root             0 Jan  1  1970 0-0050 -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-0050
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-0008 -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-0008
lrwxrwxrwx    1 root     root             0 Jan  1  1970 1-001b -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1/1-001b
lrwxrwxrwx    1 root     root             0 Jan  1  1970 2-0038 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2/2-0038
lrwxrwxrwx    1 root     root             0 Jan  1  1970 i2c-0 -> ../../../devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 i2c-1 -> ../../../devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 i2c-2 -> ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2
:~#
Thank you Mr.business_kid so much for giving many good opinions in this topic.

Quote:
Now either that's an Arm i2c port, or on some device. I presumed the latter;
I checked the block diagram of DART-MX6 board. At page 8, I2C Master Port is in "AP Peripherals" block. So I am thinking I2C-2 master port is on some device. Does it match with your expectation?

Quote:
My point was that you should investigate the i2c device if possible
If my above thinking is correct, I will just use i2c-tool or SMBus to issue a read/write command to my slave RTC. I assume that the I2C device master works well, so I do not spend so much time about the detail of that I2C master.

Quote:
The ds1307 has 56 bytes of ram, so I'm surprised at it only having a single byte of I/O.
Sorry sir. I do not understand that idea well. Below is my understanding. If it is not correct, please give me your opinion.

I think you mention about single byte of I/O is 0x68? If it is correct, this is slave address of my RTC - I2C. 56 bytes of ram in DS1307 is internal RAM of that RTC. Is there any relationship between 0x68 and 56 bytes RAM?
Attached Thumbnails
Click image for larger version

Name:	resolve_ioerror.png
Views:	150
Size:	40.7 KB
ID:	25369  
 
Old 07-03-2017, 11:39 AM   #21
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,475

Rep: Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354Reputation: 2354
Great!
Code:
 ../../../devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2
soc = System On Chip - some big fpga.

Rereading my comments, if you're working, stop fixing it and don't worry about anything I said.
 
Old 08-06-2018, 06:08 AM   #22
Keelung
LQ Newbie
 
Registered: Aug 2018
Posts: 1

Rep: Reputation: Disabled
The direct cause to this issue is, i2c slave address is set by I2C_SLAVE but I2C_SLAVE_FORCE.

See int set_slave_addr(int file, int address, int force) in i2c-tools-3.1.2\tools\i2cbusses.c
and static int SMBus_set_addr(SMBus *self, int addr) in i2c-tools-3.1.2\py-smbus\smbusmodule.c

So, if this occurs, please check i2cdump output with/without -f argument firstly.

i2c-tools v4.0 has this issue too.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian 5 mdadm "device or resource busy" raid edwardzc Debian 1 12-27-2010 04:52 AM
Fix For "[ao_alsa] Playback Open Error: Device Or Resource Busy. No coding!! Frank64 Linux - Hardware 2 03-03-2008 04:28 PM
Wireless RT2500, "Device or resource busy" in Ubuntu puggers Linux - Hardware 2 10-22-2006 01:18 PM
gnomemeeting crashed, now i got "video0: Device or resource busy" B sirpelidor Linux - Hardware 0 01-10-2005 03:02 AM
nvidia insmod: "Device or resource busy" w/GeForce 4 MX KeithSpook Linux - Hardware 4 03-03-2004 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration