bigtreetech / BTT-Pi

120 stars 20 forks source link

Enable 1-wire #20

Open Puzzl88 opened 9 months ago

Puzzl88 commented 9 months ago

How do enable 1-wire on the BTT-Pi, specifcally for the DS18B20 sensor?

mdvorak commented 9 months ago

Please see https://github.com/bigtreetech/CB1/issues/65#issuecomment-1740552051 for the answer.

Puzzl88 commented 9 months ago

Please see bigtreetech/CB1#65 (comment) for the answer.

biqu@BTT-CB1:~/w1-gpio-cl$ sudo make install install -m644 w1-gpio-cl.ko /lib/modules/uname -r/kernel/drivers/w1/masters install: cannot stat 'w1-gpio-cl.ko': No such file or directory make: *** [Makefile:95: install] Error 1

mdvorak commented 9 months ago

Hmm, maybe I forgot a package, I'll take a look, thanks

Puzzl88 commented 9 months ago

Hmm, maybe I forgot a package, I'll take a look, thanks

I understood what's the problem. After LN -s/Lib/Modules/Uname -r/Build/Include/Linux W1, you need to execute a command make.

Thanks for the help! image

mdvorak commented 9 months ago

ah, great, I'll update the guide, thanks!

wmetnitz commented 9 months ago

sorry, i'm a unix newbe - i get the following error:

biqu@voron:~/w1-gpio-cl$ sudo make NOTE: ./w1 symlink is already set and will not be updated. Remove it and restart the compilation process in case you want to re-run the kernel sources examination. NOTE: gen-mast.h was generated make -C /lib/modules/5.16.17-sun50iw9/build M= modules make[1]: Entering directory '/usr/src/linux-headers-5.16.17-sun50iw9' make[2]: No rule to make target 'arch/arm64/tools/gen-cpucaps.awk', needed by 'arch/arm64/include/generated/asm/cpucaps.h'. Stop. make[1]: [arch/arm64/Makefile:173: archprepare] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.16.17-sun50iw9' make: *** [Makefile:13: all] Error 2

mdvorak commented 9 months ago

Hmm, that is wierd error :-)

mdvorak commented 9 months ago

I've managed to reproduce it with latest packages, maybe it was caused by some recent system update, I'll investigate it.

mdvorak commented 9 months ago

@wmetnitz Found it. make needs to be run without sudo, for some reason, it messes up env vars and compilation fails to find some files. Also for the compilation itself, sudo should not be really needed. I was originally running it all directly as a root, so I did not encounter this problem.

Guide updated.

note: sudo -E make seems to work fine too.

wmetnitz commented 9 months ago

Hi, i don’t know, what goes wrong ☹

The installation seams ok, but:

==> sudo echo 'options w1-gpio-cl m1="gdt:71"' > /etc/modprobe.d/w1-gpio-cl.conf

got permisssion denied.

Now i created this file manually.

==> sudo modprobe w1-gpio-cl

-rw-r--r-- 1 root root 31 Oct 4 17:47 w1-gpio-cl.conf

@.***:/etc/modprobe.d$ sudo modprobe w1-gpio-cl

modprobe: ERROR: could not insert 'w1_gpio_cl': Exec format error

@.***:/etc/modprobe.d$ sudo modprobe w1-gpio-cl m1="gdt:71"

modprobe: ERROR: could not insert 'w1_gpio_cl': Exec format error

What goes wrong?

Many thanks,

Werner

@.***:~/w1-gpio-cl$ sudo -E make

NOTE: ./w1 symlink is already set and will not be updated. Remove it and restart the compilation process in case you want to re-run the kernel sources examination.

NOTE: gen-mast.h was generated

make -C /lib/modules/5.16.17-sun50iw9/build M=/home/biqu/w1-gpio-cl modules

make[1]: Entering directory '/usr/src/linux-headers-5.16.17-sun50iw9'

CC [M] /home/biqu/w1-gpio-cl/w1-gpio-cl.o

MODPOST /home/biqu/w1-gpio-cl/Module.symvers

LD [M] /home/biqu/w1-gpio-cl/w1-gpio-cl.ko

make[1]: Leaving directory '/usr/src/linux-headers-5.16.17-sun50iw9'

@.***:~/w1-gpio-cl$ NOTE: ./w1 symlink is already set and will not be updated. Remove it and restart the compilation process in case you want to re-run the kernel sources examination.

NOTE: gen-mast.h was generated

make -C /lib/modules/5.16.17-sun50iw9/build M=/home/biqu/w1-gpio-cl modules

make[1]: Entering directory '/usr/src/linux-headers-5.16.17-sun50iw9'

CC [M] /home/biqu/w1-gpio-cl/w1-gpio-cl.o

MODPOST /home/biqu/w1-gpio-cl/Module.symvers

LD [M] /home/biqu/w1-gpio-cl/w1-gpio-cl.ko

make[1]: Leaving directory '/usr/src/linux-headers-5.16.17-sun50iw9'

@.***:~/w1-gpio-cl$ sudo make install

install -m644 w1-gpio-cl.ko /lib/modules/uname -r/kernel/drivers/w1/masters

depmod

cd /etc/modprobe.d

Von: Michal Dvořák @.> Gesendet: Mittwoch, 4. Oktober 2023 08:45 An: bigtreetech/BTT-Pi @.> Cc: wm13 @.>; Mention @.> Betreff: Re: [bigtreetech/BTT-Pi] Enable 1-wire (Issue #20)

@wmetnitz https://github.com/wmetnitz Found it. make needs to be run without sudo, for some reason, it messes up env vars and compilation fails to find some files. Also for the compilation itself, sudo should not be really needed. Guide updated.

_note: sudo -E make seems to work file too.`

— Reply to this email directly, view it on GitHub https://github.com/bigtreetech/BTT-Pi/issues/20#issuecomment-1746236412 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BC7SATMH4ZVDML3YGKRRM2TX5UAVZAVCNFSM6AAAAAA5IXWFYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGIZTMNBRGI . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BC7SATOAL4EXEG2CNV6ARTTX5UAVZA5CNFSM6AAAAAA5IXWFYGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTICVZ7Y.gif Message ID: @. @.> >

mdvorak commented 9 months ago

That was entirely mistake on my side, sorry!

echo 'options w1-gpio-cl m1="gdt:71"' | sudo tee /etc/modprobe.d/w1-gpio-cl.conf
echo 'w1-gpio-cl' | sudo tee /etc/modules-load.d/w1-gpio-cl.conf

I needed a tester, thanks

wmetnitz commented 9 months ago

Hi, thanks for your help, but it doesn’t work…

@.***:~/w1-gpio-cl$ echo 'options w1-gpio-cl m1="gdt:71"' | sudo tee /etc/modprobe.d/w1-gpio-cl.conf

options w1-gpio-cl m1="gdt:71"

@.***:~/w1-gpio-cl$ echo 'w1-gpio-cl' | sudo tee /etc/modules-load.d/w1-gpio-cl.conf

w1-gpio-cl

@.***:~/w1-gpio-cl$ sudo modprobe w1-gpio-cl

modprobe: ERROR: could not insert 'w1_gpio_cl': Exec format error

@.***:~/w1-gpio-cl$

Von: Michal Dvořák @.> Gesendet: Mittwoch, 4. Oktober 2023 21:26 An: bigtreetech/BTT-Pi @.> Cc: wm13 @.>; Mention @.> Betreff: Re: [bigtreetech/BTT-Pi] Enable 1-wire (Issue #20)

That was entirely mistake on my side, sorry!

echo 'options w1-gpio-cl m1="gdt:71"' | sudo tee /etc/modprobe.d/w1-gpio-cl.conf echo 'w1-gpio-cl' | sudo tee /etc/modules-load.d/w1-gpio-cl.conf

I needed a tester, thanks

— Reply to this email directly, view it on GitHub https://github.com/bigtreetech/BTT-Pi/issues/20#issuecomment-1747504818 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BC7SATNH6UGDKRY7SHYWDLTX5WZ37AVCNFSM6AAAAAA5IXWFYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGUYDIOBRHA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BC7SATJP3FEYMQJ6VHIZRRDX5WZ37A5CNFSM6AAAAAA5IXWFYGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTIFDHLE.gif Message ID: @. @.> >