LinuxQuestions.org
Help answer threads with 0 replies.
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 02-14-2017, 11:44 PM   #1
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Rep: Reputation: Disabled
What is error "IOError: [Errno 16] Device or resource busy"?


Hello all,

I am trying to use SMBus supported by Python to initialize an I2C devices on my board but I get an error message as below.

IOError: [Errno 16] Device or resource busy

Did you have meet this error before?

Please support me if you have any idea.

Thanks.

Last edited by jackbk; 02-14-2017 at 11:44 PM. Reason: add more detail description
 
Old 02-15-2017, 09:27 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
It means that your software can't access it because something else is, or has claimed it. It's not always fully accurate. It really means the kernel failed in talking to the device.
 
Old 02-15-2017, 10:05 AM   #3
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Do you know how to fix this error?

I searched on the internet for a solution, nothing !
Therefore, I posted this question to this thread for your help.
 
Old 02-15-2017, 02:54 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
It's a standard system error. Unbusy your resource. I2C is 0/5V, whereas rs232 is +/-5V, so they don't communicate. Try basic stuff to see if it's active. I'm not up on SMB buses, I don't know what python script you are running, if it calls modules, or even if you have them installed. You haven't said a thing about your hardware, or pc. So you are strictly on your own, because we're not mystics. All you told us was error 16.
 
Old 02-15-2017, 10:25 PM   #5
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Sorry for unclear information.

I show information of my system.

I am using a board from Variscite.
https://www.google.com.vn/?gws_rd=ss...dt6customboard
Datasheet for that board: http://www.variscite.com/images/stor...heet_v_1_2.pdf

On this board, OS is Yocto Jethro.

My I2C device is Real Time Clock (RTC) chip on board. This chip datasheet: https://www.intersil.com/content/dam...1/isl12057.pdf

I need to access to RTC via I2C protocol.

For SMBus and its error.

I installed SMBus already. As I list in /dev/, there are three i2c devices named: 'i2c-0', 'i2c-1', 'i2c-2', but I do not know which i2c is connecting to my RTC. Therefore, I tried initializing all three of them like so smbus.SMBus(0), smbus.SMBus(1), smbus.SMBus(2). But I get the error as I showed you before "IOError: [Errno 16] Device or resource busy". This error occurs when I access to RTC via SMBus.
Actually, there are 2 kinds of error if I try three i2c.

1. IOError: [Errno 16] Device or resource busy
2. IOError: [Errno 5] Input/output error

But I am suspecting error 1. related to my RTC device.

For Python code, I use it from https://github.com/switchdoclabs/RTC_SDL_DS1307

In this code, I modified smbus.SMBus(x) at testSDL_DS1307 file.

Code:
ds1307 = SDL_DS1307.SDL_DS1307(x, 0x68) #x=0,1,2
Error when write_now() is invoked.

Code:
ds1307.write_now()
SMBus installed already. It is proved by "import smbus" in SDL_DS1307 file does not cause any error.

This is all of my system and its error.

Thank you for your support!
 
Old 02-16-2017, 05:29 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
OK, the input/output error is what you get if you unplug something and then write to it, or if it's otherwise not connected. Those i2c ports aren't connected. I would expect error 5 on 2 i2c ports, and error 16 on one. That's connected. Is your rtc a ds1307? The ds1307 is not a new chip; I remembered the number & I got out of electronic hardware in 2006. It is probably i2c version 1.

SMB buses are 2 wire. They are SCL & SDA, clock & data. I imagine data transfer is on clock low, when scl can be seen as an earth. There is version 1, 1.1, 2 & version 3 of the protocol, and voltage levels are different. Current levels are low and the wrong pull up resistor can bugger it up. I'm vague here.

SMB is not I2C, although the devices may talk to each other. If the devices use different voltage levels, you could have issues. The pc smb bus I imagine is on 3.3V, the ds1307 on 5V. Current is also low. Have you been on http://www.smbus.org/? There's an email for tech questions that may prove rewarding.

Your error 16 could well be voltage levels.
 
1 members found this post helpful.
Old 02-16-2017, 09:58 PM   #7
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
I would expect error 5 on 2 i2c ports, and error 16 on one. That's connected
Yes, you are correct. Error 5 is on two i2c ports, and error 16 is on one i2c.

Quote:
Is your rtc a ds1307?
My RTC is ISL12057, not DS1307, datasheet of that RTC https://www.intersil.com/content/dam...1/isl12057.pdf

But I checked DS1307 datasheet before. It is same as ISL1207 (use I2C protocol, slave address 0x68). There are no python library to access to ISL12057, but for DS1307, there is a library from Switchdoclabs.

Library from Switchdoclabs uses SMBus to access to DS1307. I also thought I can use this library to access to my ISL12057 because 2 chips are same (as I mentioned above).

Quote:
The pc smb bus I imagine is on 3.3V, the ds1307 on 5V
I use voltage meter to measure voltage of my ISL12057. It is 3.3V. But I do which version of SMBus I am using (version 1, 1.1, 2 & version 3 as you sait). As the information here, I installed version 3.1.1, but I am not sure whether it is version 1, 1.1, 2 & version 3!

https://layers.openembedded.org/laye.../recipe/43443/

Quote:
Current levels are low and the wrong pull up resistor can bugger it up. I'm vague here.
Sorry, as above explanations, is it clear for unclear point that you are vague?
If it is not enough, please tell me which point that I need to do for more information.

Quote:
Have you been on http://www.smbus.org/? There's an email for tech questions that may prove rewarding.
Thank you so much. I have not visited this forum so far. Let me contact them for further concern!

Quote:
Your error 16 could well be voltage levels.
I may contact with http://www.smbus.org/ for which version of SMBus I am using.
It may come from voltage levels.
 
Old 02-17-2017, 05:13 AM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
There's a lot of ifs, buts and equilalents in your setup, so it may work, or may not. IIRC, the DS1307 is an old chip(i2c version 1, I imagine), and the 12507 is a copy also on i2c version 1? Date of release will probably tell you.

I would not hold out much hope for version 1 talking to version 3, but will await the outcome with smbus.org. In the meantime, you may find this useful.
pdfserv.maximintegrated.com/en/an/AN95.pdf

Just thinking here, your ds1307 is nearly certainly i2c version 1. ISL12507 could be i2c v. 1 - v3.When it was released might give you a clue, or it's datasheet. There's a difference in voltage thresholds.

Last edited by business_kid; 02-17-2017 at 05:17 AM.
 
1 members found this post helpful.
Old 02-18-2017, 10:04 PM   #9
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you Mr.business_kid for your enthusiasm and strong support!

As our discussion, I understood that the difference between I2C protocol of my device and my using SMBus version causes the error 16.

I checked your link (http://pdfserv.maximintegrated.com/en/an/AN95.pdf). It is useful!

I emailed to http://www.smbus.org/ to ask about the difference between my SMBus voltage and I2C device voltage. Hopefully, I will receive their good answer! I surely post their answer to this thread as a solution for my issue.
 
Old 06-23-2017, 07:40 AM   #10
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
I know the reason of error 1. IOError: [Errno 16] Device or resource busy

In my case, it is a driver loaded for RTC at address 0x68. Each time I use "i2cdetect -y 2", it returns "UU".
As manual from Linux, here, "UU" means.

"UU". Probing was skipped, because this address is currently in use by a driver. This strongly suggests that there is a chip at this address.

I would share this experience for anyone who may meet the same problem like this.

I contacted http://www.smbus.org/. They were very enthusiasm to answer my question but they did not give me a correct answer, because it is not easy to know the detail error in a specific system, I think.
 
Old 06-23-2017, 12:27 PM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
What does
Code:
sudo cat /proc/ioports |grep rtc
report?
 
Old 06-26-2017, 01:53 AM   #12
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Code:
cat /proc/ioports | grep rtc
It returns to nothing.

I am trying to remove the device driver at address 0x68 of I2C-2 to check whether my RTC can be detected at 0x68 or not. In other words, it must be 0x68 when I use "i2cdetect -y 2", not "UU".

Last edited by jackbk; 06-26-2017 at 01:59 AM.
 
Old 06-27-2017, 05:35 AM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by jackbk View Post
Code:
cat /proc/ioports | grep rtc
It returns to nothing.
You are joking. Are you running linux? Did you try as root? That indicates NO rtc at all.
Try
Code:
sudo cat /proc/ioports
look for the rtc entry and paste it in.
 
Old 06-27-2017, 06:33 AM   #14
jackbk
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
You are joking. Are you running linux? Did you try as root? That indicates NO rtc at all.
No, Sir. I am telling the truth. This topic was created to ask a problem that I met, so I must tell the truth to get help from you or someone.

I am running Linux. "sudo" command is not available in my system but normal linux command is as a root permission. So "sudo cat /proc/ioports" is same as "cat /proc/ioports"

Please refer to the following attached file.

I understood your concern. I said there is a driver at 0x68 but "cat /proc/ioports | grep rtc" returns nothing. It likes a joking but you can check my attachment.

I do not understand that why "cat /proc/ioports | grep rtc" returns nothing. It is very strange, but I have no experience about this.

So far, I have tried "i2cdetect -y 2", and "UU" is at address 0x68. As the explanation, "UU" means a driver is at 0x68, so I thought that it is a root cause of IOError: [Errno 16] Device or resource busy.

I am finding a way to remove the driver at 0x68 of I2C-2 to check whether the error still occurs or not(IOError: [Errno 16] Device or resource busy), but I am not successful now.

I also attach another attachment. It may have some information that related to RTC. Could you take a look?
Attached Thumbnails
Click image for larger version

Name:	ioerror.png
Views:	24
Size:	6.4 KB
ID:	25333   Click image for larger version

Name:	other_ioerror.png
Views:	14
Size:	8.4 KB
ID:	25334   Click image for larger version

Name:	ioerror1.png
Views:	14
Size:	8.0 KB
ID:	25335  
 
Old 06-27-2017, 09:15 AM   #15
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Code:
bash-4.3$ sudo cat /proc/interrupts |grep rtc
  8:          1          0   IO-APIC   8-edge      rtc0
bash-4.3$ sudo cat /proc/ioports |grep rtc
  0070-0077 : rtc0
bash-4.3$ ls /sys/bus/i2c/devices
i2c-0  i2c-1  i2c-2  i2c-3  i2c-4  i2c-5  i2c-6  i2c-7
bash-4.3$ ls -l /sys/bus/i2c/devices
total 0
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-0 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-0
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-1 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-1
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-2 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-2
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-3 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-3
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-4 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-4
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-5 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-5
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-6 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-6
lrwxrwxrwx 1 root root 0 Jun 26 15:32 i2c-7 -> ../../../devices/pci0000:00/0000:00:1f.3/i2c-7
That;s how my laptop looks. Are you running standard hardware? Give us your board spec - not a model number, but a list of the essential specs including the chipset. Any sane driver allows 8 bytes for any i/o device. The output of my last command would also be good to see.

It's unwise and insecure if every user has root privileges, and you are much better off employing the protection of running as a lower privileged user, and only employing root privileges when you need them. That way you savt tidying up after the inevitable typos like
Code:
rm -rf /  <something>
which deletes / AND <something> if it's not already gone; and every hacker who gets in is not gifted root privileges.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:52 AM
Fix For "[ao_alsa] Playback Open Error: Device Or Resource Busy. No coding!! Frank64 Linux - Hardware 2 03-03-2008 05:28 PM
Wireless RT2500, "Device or resource busy" in Ubuntu puggers Linux - Hardware 2 10-22-2006 02:18 PM
gnomemeeting crashed, now i got "video0: Device or resource busy" B sirpelidor Linux - Hardware 0 01-10-2005 04:02 AM
nvidia insmod: "Device or resource busy" w/GeForce 4 MX KeithSpook Linux - Hardware 4 03-03-2004 01:21 PM

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

All times are GMT -5. The time now is 09:10 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration