User avatar
theoriginalxbrav
Posts: 41
Joined: Sun May 12, 2013 7:16 pm

Re: Source code to w1-therm?

Thu Dec 05, 2013 2:37 pm

Thank you! I'm sure a lot of people will appreciate it!
Projects:
Raspberry Pi Weather Camera and weeWX: http://reboot.us.com/local-weather/
Daily Timelapses: https://www.youtube.com/playlist?list=PLi1er5S-VzV8d2t21zT0U_aBInl1_Ojkf

xylerk
Posts: 5
Joined: Tue Dec 03, 2013 10:15 pm

Re: Source code to w1-therm?

Fri Dec 06, 2013 8:18 pm

Hi,

How can I get this patch? I don't find the goog url...

Thanks

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Fri Dec 06, 2013 9:20 pm

xylerk wrote:Hi,

How can I get this patch? I don't find the goog url...

Thanks
Hi,
what is your version of Raspbian kernel ? ... in this thread you will found pre compiled kernel module for 3.6.y and 3.10.y, also if you plane to compile your own version in thread is source diff for version 3.6.y and cource of w1-gpio.c file for version 3.10.y .

Hope that help.

Regards,
Dubravko Penezic

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Mon Dec 30, 2013 10:49 am

Just to close this thread and inform current and future readers .
From Raspbian 2013-12-20 , system include configuration option for setting GPIO pin for 1-wire slave devices.

It is little bit different then first suggestion, but work nice :).

How to do that :
!!! Pin nubmer is real GPIO pin number not pin position on GPIO pin header !!!

edit like root user /boot/cmdline.txt and add config parameter bcm2708.w1_gpio_pin=<GPIO_pin_number> (for example bcm2708.w1_gpio_pin=25).

Reboot RPi.

Everything else is same like any other RPi/1-wire devices instruction (w1-gpio, w1-therm, /sys/bus/w1/devices)

Regards,
Dubravko Penezic

User avatar
theoriginalxbrav
Posts: 41
Joined: Sun May 12, 2013 7:16 pm

Re: Source code to w1-therm?

Mon Dec 30, 2013 5:45 pm

Oh, you are amazing! I was wondering why the code wasn't committing as before. I'll give it a try. Thanks!
Projects:
Raspberry Pi Weather Camera and weeWX: http://reboot.us.com/local-weather/
Daily Timelapses: https://www.youtube.com/playlist?list=PLi1er5S-VzV8d2t21zT0U_aBInl1_Ojkf

User avatar
theoriginalxbrav
Posts: 41
Joined: Sun May 12, 2013 7:16 pm

Re: Source code to w1-therm?

Tue Dec 31, 2013 7:28 am

Ok, the code change seems to work. However, it's killing the camera module again. Here's the verbose output:

Code: Select all

raspistill Camera App v1.3.5

Width 2592, Height 1944, quality 85, filename (null)
Time delay 5000, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Link to latest frame enabled  no
Full resolution preview No
Capture method : Single capture

Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
This only happens after running "modprobe w1-gpio". It was working with the previous kernel patch. Any ideas?

*EDIT*

It might be getting buggered up by the below duplicate lines. I'm no kernel expert, but can you confirm?

In bcm2708.c

Line 264:

Code: Select all

#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
static struct w1_gpio_platform_data w1_gpio_pdata = {
        .pin = W1_GPIO,
        .is_open_drain = 0,
};
Line 769:

Code: Select all

#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
        w1_gpio_pdata.pin = w1_gpio_pin;
        platform_device_register(&w1_device);
#endif
Projects:
Raspberry Pi Weather Camera and weeWX: http://reboot.us.com/local-weather/
Daily Timelapses: https://www.youtube.com/playlist?list=PLi1er5S-VzV8d2t21zT0U_aBInl1_Ojkf

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Tue Dec 31, 2013 10:23 am

Hi,
bcm2708.c is O.K. ... unfortunately i dont have camera so i will try to help you by guessing what may be a problem ...

First i have information in private message that :
One thing that is known is that loading w1-gpio messes up the i2c bus 1 (or whatever is named, i2cdetect -y 1). One trick to load w1-gpio last. Want to try my hand at things by fixing this corruption.
I didnt ask much about that, because i dint have issue like this one , but it is look like w1-gpio isnt very clear written solutions.

In bcm2708.c is just set of global variable, so i dont think it has anything with your issue, did you try to download latest source and compile kernel by yourself ... maybe is something in compilation configuration.

Did you check follow URL ?
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=44491
http://www.wurst-wasser.net/wiki/index. ... mera_Setup

Regards,
Dubravko Penezic

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Tue Dec 31, 2013 10:36 am

Hi theoriginalxbrav,
Like i was spouse it is w1-gpio issue :) https://github.com/raspberrypi/linux/issues/435

How ever i didnt read all thread, and I have I2C and 1-wire on same device, and realy dont know which order is used load modules, but everything work correctly.

My guess is that we have issue with Raspbian system and third party source code.

If you need help with this issue please open new thread and we may work together to fix that.

Regards,
Dubravko Penezic

User avatar
theoriginalxbrav
Posts: 41
Joined: Sun May 12, 2013 7:16 pm

Re: Source code to w1-therm?

Tue Dec 31, 2013 5:15 pm

Good morning Dubravko,

The solution posted here works! Indeed, it is a loading order. It works with your commits (I changed my pin to 18, don't want to crawl out in the cold and change it!). I'll post my findings in the thread below.

http://www.raspberrypi.org/forums/viewt ... 28&t=61922

Thanks again for all the hard work!
Projects:
Raspberry Pi Weather Camera and weeWX: http://reboot.us.com/local-weather/
Daily Timelapses: https://www.youtube.com/playlist?list=PLi1er5S-VzV8d2t21zT0U_aBInl1_Ojkf

Avoncliff
Posts: 35
Joined: Fri Dec 09, 2011 5:24 pm

Re: Source code to w1-therm?

Sun Feb 16, 2014 11:07 pm

The best place to post it is to the kernel mailing list, also not easy but it is all documented and a real feeling of satisfaction when Greg accepts the patch for the next Linux version.

rylle89
Posts: 2
Joined: Wed Mar 12, 2014 6:10 am

Re: Source code to w1-therm?

Wed Mar 12, 2014 6:30 am

Hello!

I have tried to change the 1-wire bus pin without success. I have read all the posts on this page and also google it a lot and I´m just confused by all the different ways of doing this :(.

Can someone, who managed to change the bus from GPIO4 to another one, please write me an "How To Do" with some easy steps. I´m not a Linux pro so please keep it simple :).

Thanks!

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Wed Mar 12, 2014 7:33 am

Hi,

it works for me :) ... first be sure you have latest raspbian distribution.

Code: Select all

sudo su -
apt-get update
apt-get upgrade
then please read information on follow URL : http://elinux.org/RPi_Low-level_peripherals especially "General Purpose Input/Output (GPIO)" parts. Basically you need to understand that GPIO number in follow step isnt same like pin header position on P5.

Finally please read follow message in this thread http://www.raspberrypi.org/phpBB3/viewt ... 52#p477052 .
For example i like vi editor so step will be :

Code: Select all

sudo su -
vi /boot/cmdline.txt
reboot


After reboot just use follow line :

Code: Select all

sudo su -
modprobe w1-gpio
modprobe w1-therm
ls -al /sys/bus/w1/devices
That is it, some basic steps, other autoconfiguration parameters you may found here on forum, or from other sources in Internet.

Regards,
Dubravko Penezic

rylle89
Posts: 2
Joined: Wed Mar 12, 2014 6:10 am

Re: Source code to w1-therm?

Wed Mar 12, 2014 5:52 pm

Thank you! It worked this time :). I don´t know actually what I did wrong because this was pretty much what I did before without any succes :).

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: Source code to w1-therm?

Wed Feb 11, 2015 12:23 pm

Hi all,

just update latest kernel 3.18.x introduce new way to use many custom HW pins, including pin for 1-wire.

Documentation is available on http://www.raspberrypi.org/documentatio ... ce-tree.md
Slightly more complicated. If you require the external pullup pin, use:
"dtoverlay=w1-gpio-pullup,gpiopin=<x>,extpullup=<y>"
otherwise use:
"dtoverlay=w1-gpio,gpiopin=<x>"
(where <x> and <y> are GPIO pins, obviously).
If you are using the parasitic power (power over data, 2-wire) mode, add ",pullup=1" (or ",pullup=on")
In /boot/config.txt need to be add follow line:

Code: Select all

dtoverlay=w1-gpio,gpiopin=<pin_no>

TomOwens
Posts: 1
Joined: Wed Apr 08, 2015 6:58 pm

Re: Source code to w1-therm?

Wed Apr 08, 2015 7:01 pm

I know it's quite a bit of time after the fact, but I am just now exploring some of these issues for my own projects and I see that the patch is indeed in the latest Raspian distro:

tom@greenhousepi ~ $ modinfo w1_gpio
filename: /lib/modules/3.18.5+/kernel/drivers/w1/masters/w1-gpio.ko
license: GPL
author: Ville Syrjala <syrjala@sci.fi>
description: GPIO w1 bus master driver
srcversion: 74F4A6108BF45E4E328B1F7
alias: of:N*T*Cw1-gpio*
depends: wire
intree: Y
vermagic: 3.18.5+ preempt mod_unload modversions ARMv6
parm: pullup:GPIO pin pullup number (int)
parm: gpiopin:GPIO pin number (int)

jofrefo
Posts: 3
Joined: Thu Jan 14, 2016 10:18 am

Re: Source code to w1-therm?

Thu Jan 14, 2016 10:26 am

I know this is mostly old post , but as I am in process of understanding Kernel compilation and patches. This thread started on the need to modify a source code of a module and then recompile the kernel. But at some point,
TNe-TWo posted:
found a better way to change it without rebuild kernel image
only patch w1-gpio.c
As far as I understand above will modify the source of w1-gpio.c , therefore the kernel mus be rebuilt!

If not, how come?

Thanks a million in advance for ay explanation !

YoungJules
Posts: 14
Joined: Thu Jan 26, 2012 12:13 pm

Re: Source code to w1-therm?

Sat Apr 01, 2017 11:41 am

Always useful to document what you do... 4 years later and I was struggling to get my thermometer working on a custom GPIO pin on a newly-installed pi, suddenly remembered that I'd posted on this forum at the time! :-)
So it's not gpiopin=20, nor 17, nor 18... it's gpiopin=31 (pin 6 on the auxiliary header) ho hum!
Working like a charm now :shock:

Return to “Automation, sensing and robotics”