SMBus device access
Hi!
I am trying to access a SMBus device that is supposed to be connected to SMBus.
The hardware uses a SiS96x chipset SMBus controller and the SiS SMBus driver loads fine, SMBus is detected properly.
My SMBus device is supposed to listen to address 0x92 which is quite obviously a 10-bit address. The device is a custom programmed PIC controller that controls a small display. By writing byte values to the PIC it will display something on the display.
All my tries failed so far. I have to admit that I only tried a userspace approach, i.e. through i2c-dev.
Everything I get is "Operation not permitted".
My test application is attached if anyone wants to have a look at the nonsense I am trying ;)
I have looked the kernel i2c drivers up and down and cannot find any hint why the write call fails, especially with the above error.
Oh yes, I am using a vanilla 2.6.7 kernel, i.e. no additional patches applied.
Any hint is greatly appreciated since I am quite desperate by now.
Many thanks in advance!
Regards
nils faerber
Signature · 11 lines
kernel concepts Tel: +49-271-771091-12 Dreisbachstr. 24 Fax: +49-271-771091-19 D-57250 Netphen Mob: +49-176-21024535 -- -------------- next part -------------- A non-text attachment was scrubbed... Name: pictest.c Type: text/x-csrc Size: 1467 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040910/435b7e91/pictest.bin
Thank you very much for the fast reply!
More below...
Am Fr, den 10.09.2004 schrieb Jean Delvare um 13:43:
Quoted 5 lines
On Fri, 10 Sep 2004 12:00:12 +0200, Nils Faerber wrote
Quoted 4 lines
I am trying to access a SMBus device that is supposed to be connected to SMBus. The hardware uses a SiS96x chipset SMBus controller and the SiS SMBus driver loads fine, SMBus is detected properly.
Quoted 7 lines
Quoted 4 lines
My SMBus device is supposed to listen to address
0x92which is quite obviously a 10-bit address. The device is a custom programmed PIC controller that controls a small display. By writing byte values to the PIC it will display something on the display.First of all, we don't support 10-bit addresses. So if your device really uses a 10-bit address, no wonder you can't get it to work.
Oh, is this still true?
I thought this to be some old comment since the ioctl() for switching to ten bit mode is already there ;)
And if it still is not supported, is this true for user-space and kernel-space or for user-space only?
Because if the assumed 10-bit address is indeed valid I would be in deep trouble, i.e. I would have to add 10-bit support to the whole i2c subsys?
Quoted 5 lines
However, I doubt that this is the case. We never saw any device using a 10-bit address. My guess would be that your documentation is bogus and advertises an address of
0x92while the actual address is0x49(0x92>> 1). This is a common mistake due to the fact that the 7 bit address is left-aligned and completed with the read/write bit when sent over the bus.
This might be the case, good hint!
The spec I have (under NDA, sorry) looks like some very coarse documentation done in a midday break :(
Quoted 10 lines
Quoted 4 lines
All my tries failed so far. I have to admit that I only tried a userspace approach, i.e. through i2c-dev.
Everything I get is "Operation not permitted".
You should first try to see if you can detect your device. Use i2cdetect for that. You may try the -r flag if the device doesn't show by default. If it still doesn't show, I'd guess that it isn't properly wired (or doesn't answer to read byte commands nor quick commands with data 0, aka "quick write"). The documentation should tell you which commands the device understands.
The docuentation is not very specific about SMBus or I2C things. It mostly describes the internal regsiters the PIC supports and what they mean. Not much more about the external interface :(
And I did not try i2cdetect more extensively since I thought the device to be on a 10-bit address...
Oh well... I fear I have to send some more emails to Taiwan to get more detailed specs :(
[...testing while writing...]
Ha!!!
You are right, it is 0x49!!!
And suddenly at least i2cset work (nut not my test program but I will find that bug myself, I think :)
Thank you so much, great help and so quickly!
Perfect!
Quoted 1 line
Hope that hepls.
Best wishes!
nils faerber
Signature · 4 lines
kernel concepts Tel: +49-271-771091-12 Dreisbachstr. 24 Fax: +49-271-771091-19 D-57250 Netphen Mob: +49-176-21024535 --
Oh, and while we are at it ;)
The PIC I have hanging to the SMBus not only has a display connectoed to it but also some push buttons, i.e. user input.
It is not perfectly clear to me how I should best query those buttons. Is it possible for the SMBus to generate interrupts on button presse or do I have to poll those?
At least at first glance it seems that the SIS96x does not use interrupts at all...
Thanks again!
Regards
nils faerber
Signature · 4 lines
kernel concepts Tel: +49-271-771091-12 Dreisbachstr. 24 Fax: +49-271-771091-19 D-57250 Netphen Mob: +49-176-21024535 --
On Fri, 10 Sep 2004 12:00:12 +0200, Nils Faerber wrote
Quoted 8 lines
I am trying to access a SMBus device that is supposed to be connected to SMBus. The hardware uses a SiS96x chipset SMBus controller and the SiS SMBus driver loads fine, SMBus is detected properly.
My SMBus device is supposed to listen to address
0x92which is quite obviously a 10-bit address. The device is a custom programmed PIC controller that controls a small display. By writing byte values to the PIC it will display something on the display.
First of all, we don't support 10-bit addresses. So if your device really uses a 10-bit address, no wonder you can't get it to work.
However, I doubt that this is the case. We never saw any device using a 10-bit address. My guess would be that your documentation is bogus and advertises an address of 0x92 while the actual address is 0x49 (0x92 >> 1). This is a common mistake due to the fact that the 7 bit address is left-aligned and completed with the read/write bit when sent over the bus.
Quoted 4 lines
All my tries failed so far. I have to admit that I only tried a userspace approach, i.e. through i2c-dev.
Everything I get is "Operation not permitted".
You should first try to see if you can detect your device. Use i2cdetect for that. You may try the -r flag if the device doesn't show by default. If it still doesn't show, I'd guess that it isn't properly wired (or doesn't answer to read byte commands nor quick commands with data 0, aka "quick write"). The documentation should tell you which commands the device understands.
Hope that hepls.
Signature · 3 lines
Jean Delvare http://khali.linux-fr.org/ by just
Quoted 7 lines · Rudolf Marek
Quoted 2 lines
The spec I have (under NDA, sorry) looks like some very coarse documentation done in a midday break :(
I'm just curious how did you solved the that they allow you to provide source code? Our project under GPL so your source code must be available for anyone on demand.
No. The source code must be made available _to anyone to whom he provides a (modified) binary version_.
http://www.fsf.org/licenses/gpl-faq.html#TOCDevelopChangesUnderNDA
"Does the GPL allow me to develop a modified version under a nondisclosure agreement?
Yes. For instance, you can accept a contract to develop changes and agree not to release your changes until the client says ok. This is permitted because in this case no GPL-covered code is being distributed under an NDA.
You can also release your changes to the client under the GPL, but agree not to release them to anyone else unless the client says ok. In this case, too, no GPL-covered code is being distributed under an NDA, or under any additional restrictions.
The GPL would give the client the right to redistribute your version. In this scenario, the client will probably choose not to exercise that right, but does have the right."
Signature · 11 lines
Cory T. Tusar
Embedded Systems Engineer
Videon Central, Inc.
2171 Sandy Drive
State College, PA 16801
(814) 235-1111 x316
(814) 235-1118 fax
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." --Brian W. KernighanQuoted 3 lines
The spec I have (under NDA, sorry) looks like some very coarse documentation done in a midday break :(
I'm just curious how did you solved the that they allow you to provide source code? Our project under GPL so your source code must be available for anyone on demand.
Thanks
Regards
Rudolf
Aha, clever, I missed 1:1 relation.
Thank you.
Regards
Rudolf
Hello Nils:
Quoted 6 lines · Nils Faerber
Oh, and while we are at it ;)
The PIC I have hanging to the SMBus not only has a display connectoed to it but also some push buttons, i.e. user input.
It is not perfectly clear to me how I should best query those buttons. Is it possible for the SMBus to generate interrupts on button presse or do I have to poll those?
If you want your SMBus slave to generate an interrupt, you'll need to have a third wire which is an optional part of the spec: #SMBALERT. You can read about it on page 55:
http://www.smbus.org/specs/smbus20.pdf
Unfortunately, the lm_sensors project I2C stack doesn't have support for this. But you could add it... :)
Quoted 2 lines
At least at first glance it seems that the SIS96x does not use interrupts at all...
This is a separate issue. The SIS96x bus driver does not use interrupts to drive the bus, even though it could. Whether or not it could support the optional #SMBALERT mechanism - I don't know, because I don't have a datasheet for it (only a similar one).
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]