* Options for adding I2C devices and how-to
@ 2016-10-01 1:23 vibnwis
2016-10-01 1:50 ` Anish Kumar
0 siblings, 1 reply; 5+ messages in thread
From: vibnwis @ 2016-10-01 1:23 UTC (permalink / raw)
To: kernelnewbies
Hi there,
My questions are about the options available for adding I2C devices onto
existing single board computers, such as Panda Board or Raspberry Pi. Later
then I would ask how to get it done.
By far, I have found out the following options. Correct me if I am wrong as
my understanding s still hazy.
1. BitBanging method. That is by connecting it to existing unused GPIOs.
Need to create a Bitbanging client driver for the device with the two GPIOs
for SDA, SCLK respectively
2. Use existing allocated I2C Pins. Assuming the kernel driver for the
device is already available, then simply run make menuconfig to configure
to use the right I2c device. However, if the driver is not available. One
needs to create a new client driver. if up to now I am still not wrong,
then I have a few questions.
a) what address is it and how to specify one for the new device?
would like wise to use the existing allocated addresses which are not being
used due to non-existence of those I2C devices on the system?
b) if somehow, the new I2C device has somewhat similar architecture
with the existing supporter I2C devices, would it wise to use it instead of
developing a new client driver? I am trying to say that would it wise to
trial and error some of the existing supporting driver if they are
compatible. Only after testing then decide if new driver development is
needed. Is it the right thing to do?
3. Writing/using user mode I2c driver.
Feel free to add any comments or suggestions.
Thank you in advance.
Best regards,
Lim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161001/b1aa77be/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Options for adding I2C devices and how-to
2016-10-01 1:23 Options for adding I2C devices and how-to vibnwis
@ 2016-10-01 1:50 ` Anish Kumar
0 siblings, 0 replies; 5+ messages in thread
From: Anish Kumar @ 2016-10-01 1:50 UTC (permalink / raw)
To: kernelnewbies
> On Sep 30, 2016, at 6:23 PM, vibnwis <vibnwis@gmail.com> wrote:
>
> Hi there,
>
> My questions are about the options available for adding I2C devices onto existing single board computers, such as Panda Board or Raspberry Pi. Later then I would ask how to get it done.
>
> By far, I have found out the following options. Correct me if I am wrong as my understanding s still hazy.
>
> 1. BitBanging method. That is by connecting it to existing unused GPIOs. Need to create a Bitbanging client driver for the device with the two GPIOs for SDA, SCLK respectively
Right
>
> 2. Use existing allocated I2C Pins. Assuming the kernel driver for the device is already available, then simply run make menuconfig to configure to use the right I2c device. However, if the driver is not available. One needs to create a new client driver. if up to now I am still not wrong, then I have a few questions.
> a) what address is it and how to specify one for the new device? would like wise to use the existing allocated addresses which are not being used due to non-existence of those I2C devices on the system?
You need to find out the device address of your device.
find out which device is not connected and connect your device on that bus and change the device tree to replace the device address.
> b) if somehow, the new I2C device has somewhat similar architecture with the existing supporter I2C devices, would it wise to use it instead of developing a new client driver? I am trying to say that would it wise to trial and error some of the existing supporting driver if they are compatible. Only after testing then decide if new driver development is needed. Is it the right thing to do?
You mean if the regmap is similar? I don't think that would be the case unless both devices are from the same company with minor revision change.
>
> 3. Writing/using user mode I2c driver.
You can certainly use i2c_detect and i2c_get user space tools to work with your device. However is there is a existing kernel space i2c device on that bus then it will certain lead to bus hogging problems.
>
> Feel free to add any comments or suggestions.
Please add information about your device and kernel version which you are trying to use. May be there is already a driver for it in open source.
Best of luck!!
>
> Thank you in advance.
>
> Best regards,
> Lim
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 5+ messages in thread
* Options for adding I2C devices and how-to
@ 2016-10-01 4:23 vibnwis
2016-10-01 4:44 ` anish singh
0 siblings, 1 reply; 5+ messages in thread
From: vibnwis @ 2016-10-01 4:23 UTC (permalink / raw)
To: kernelnewbies
Many thanks Anish for answering my doubts.
> You need to find out the device address of your device.
> find out which device is not connected and connect your device on that bus
> and change the device tree to replace the device address.
>
Would you elaborate on device tree, please?
> You can certainly use i2c_detect and i2c_get user space tools to work with
> your device. However is there is a existing kernel space i2c device on that
> bus then it will certain lead to bus hogging problems.
>
> Besides i2c_detect and i2c_get user space tools. I think one can also
change two existing GPIOs for SDA and SCLK respectively and using software
logics to drive them as I2C bus. I presume the entire GPIOs are able to be
mapped for user space, is it not?
> Feel free to add any comments or suggestions.
> Please add information about your device and kernel version which you are
> trying to use. May be there is already a driver for it in open source.
>
> I am doing some sort research at the moment. I like to know the whole
picture before putting my hand on. Hence, at the moment it is pure on
papers. However, the kernel version should be 2.6.38 and above.
Nevertheless, since I have Pandaboard rev B , and Raspberry 3, I will
definitely things that available for these two. Does it make sense?
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161001/99414c1b/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Options for adding I2C devices and how-to
2016-10-01 4:23 vibnwis
@ 2016-10-01 4:44 ` anish singh
0 siblings, 0 replies; 5+ messages in thread
From: anish singh @ 2016-10-01 4:44 UTC (permalink / raw)
To: kernelnewbies
On Fri, Sep 30, 2016 at 9:23 PM, vibnwis <vibnwis@gmail.com> wrote:
>
> Many thanks Anish for answering my doubts.
>
>
>> You need to find out the device address of your device.
>> find out which device is not connected and connect your device on that
>> bus and change the device tree to replace the device address.
>>
>
> Would you elaborate on device tree, please?
>
https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf
check page 29/45
>
>
>> You can certainly use i2c_detect and i2c_get user space tools to work
>> with your device. However is there is a existing kernel space i2c device on
>> that bus then it will certain lead to bus hogging problems.
>>
>> Besides i2c_detect and i2c_get user space tools. I think one can also
> change two existing GPIOs for SDA and SCLK respectively and using software
> logics to drive them as I2C bus. I presume the entire GPIOs are able to be
> mapped for user space, is it not?
>
yes. You can do that if those gpio's are not not currently used by any one
else.
Be sure to check if there are any others using it currently or not.
>
> > Feel free to add any comments or suggestions.
>> Please add information about your device and kernel version which you are
>> trying to use. May be there is already a driver for it in open source.
>>
>> I am doing some sort research at the moment. I like to know the whole
> picture before putting my hand on. Hence, at the moment it is pure on
> papers. However, the kernel version should be 2.6.38 and above.
> Nevertheless, since I have Pandaboard rev B , and Raspberry 3, I will
> definitely things that available for these two. Does it make sense?
>
I would recommend to get your hands dirty. Start playing with userspace i2c
tools
to get an idea and also there are many raspberry project out there to get
you started with.
>
> Thanks in advance.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160930/ca69d274/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Options for adding I2C devices and how-to
@ 2016-10-01 4:59 vibnwis
0 siblings, 0 replies; 5+ messages in thread
From: vibnwis @ 2016-10-01 4:59 UTC (permalink / raw)
To: kernelnewbies
>
>
> https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-
> device-tree-dummies.pdf
> check page 29/45
>
>>
>>
> This is awesome. Very helpful.
I would recommend to get your hands dirty. Start playing with userspace i2c
> tools
> to get an idea and also there are many raspberry project out there to get
> you started with.
>
Agreed and thanks for the advice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161001/98c900c2/attachment-0001.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-01 4:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-01 1:23 Options for adding I2C devices and how-to vibnwis
2016-10-01 1:50 ` Anish Kumar
-- strict thread matches above, loose matches on Subject: below --
2016-10-01 4:23 vibnwis
2016-10-01 4:44 ` anish singh
2016-10-01 4:59 vibnwis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).