Solve the problem that the new kernel of Raspberry Pi can't use 18b20 and no sound

Source: Internet
Author: User

Now the new version of the Raspberry Pi kernel because to be compatible with Raspberry Pi 2 and Raspberry Pi B + and other previous versions, the use of the original different kernel operating mode, using the device tree, more flexible. However, because it may not be used in this way and not much related to the introduction, causing many users to update the kernel after the emergence of such as 18B20 can not read the device information, and Raspberry Pi no sound output problem.
Here the attentive user will find in the new kernel boot partition more than a overlays folder, there are many DTB files, these are actually Raspberry Pi device tree, open the Readme, you can know how to use.

Here are the words from the Readme:

Introduction
============
This directory contains Device Tree overlays. Device Tree makes it possible
To support many hardware configurations with a single kernel and without the
Need to explicitly load or blacklist kernel modules. Note that this isn ' t a
"Pure" Device Tree configuration (c.f. mach_bcm2835)-Some on-board devices
Was still configured by the board support Code, but the intention was to
Eventually reach that goal.
On Raspberry Pi, Device Tree usage is controlled from/boot/config.txt. By
Default, the Raspberry Pi kernel boots with device tree enabled. You can
Completely disable DT usage (for today) by adding:
Device_tree=
To your config.txt, which should cause your Pi to revert
Doing things after a reboot.

If you want to disable the device tree, simply write the device_tree= in Boot/config.txt and save the restart.
So how do we use the device tree? Take the Enable W1 to read the 18B20 data, the Readme has such a paragraph:

Using Overlays
==============
Overlays is loaded using the "dtoverlay" directive. As an example, consider the
Popular Lirc-rpi module, the Linux infrared Remote Control driver. In the
PRE-DT World This would is loaded from/etc/modules, with an explicit
"Modprobe lirc-rpi" command, or programmatically by LIRCD. With DT enabled,
This becomes a line in Config.txt:
Dtoverlay=lirc-rpi
This causes the FILE/BOOT/OVERLAYS/LIRC-RPI-OVERLAY.DTB to be loaded. By
Default it'll use GPIOs (out) and (in), but the can be modified using
DT Parameters:
Dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13
Parameters always has default values, although in some cases (e.g. "W1-gpio")
It's necessary to provided multiple overlays on order to get the desired
Behaviour. See the list of overlays below for a description of the parameters and their defaults.

That is, in the use of Config.txt to add dtoverlay= "Device tree name" to start the device tree, also can be specified here to load the device tree parameters, in fact, this operation and the previous kernel in the system to add a module similar, but here is the kernel when the boot load, The previous one was loaded after the system started.
Then we can copy add W1 to config.txt inside and then restart read 18b20, Readme also has relevant parameter description:

Name:w1-gpio
Info:configures the W1-gpio OneWire interface module.
Use the overlay if you *don ' t* need a GPIO-drive an external pullup.
Load:dtoverlay=w1-gpio,<param>=<val>
Params:gpiopin GPIO for I/O (default "4")
Pullup Non-zero, "on", or "Y" to enable the parasitic
Power (2-wire, Power-on-data) feature
Name:w1-gpio-pullup
Info:configures the W1-gpio OneWire interface module.
Use the overlay if you *do* need a GPIO to drive an external pullup.
Load:dtoverlay=w1-gpio-pullup,<param>=<val>,...
Params:gpiopin GPIO for I/O (default "4")
Pullup Non-zero, "on", or "Y" to enable the parasitic
Power (2-wire, Power-on-data) feature
Extpullup GPIO for external pullup (default "5")

Here to provide more parameters to choose, if you intend to use the parasitic connection method here also provides the parameters to implement the internal pull, of course, if you want to retain the original connection circuit mode does not make the circuit changes, then we set up:
in Config.txt Insert the following:
Dtoverlay=w1-gpio-pullup,gpiopin=4
So that you can connect to the original circuit connection 18b20, save the reboot after the same load W1-gpio and w1-therm can be read to 18B20 data.
If you want to enable the Raspberry Pi audio, add a line of
Audio=on, the new kernel disables audio because the Raspberry Pi PWM and audio use the same interface, possibly between many people want to use the Raspberry Pi hardware PWM reason, So flexible design so that everyone has more freedom to use the space.
Readme text for audio and PWM:

He Overlay and Parameter Reference
===================================
N.B. When editing this file, please preserve the indentation levels to make it simple to parse
Programmatically. NO hard TABS.
Name: <the Base dtb>
Info:configures the base Raspberry Pi hardware
Load: <loaded automatically>
Params:
Audio Set to ' on ' to enable the onboard ALSA audio
Interface (default "off")

====================

Name:pwm
Info:configures a single PWM channel
Legal pin,function combinations for each channel:
pwm0:12,4 (Alt0) 18,2 (ALT5) 40,4 (Alt0) 52,5 (ALT1)
pwm1:13,4 (Alt0) 19,2 (ALT5) 41,4 (Alt0) 45,4 (Alt0) 53,5 (ALT1)
N.B.:
1) Pin available on all platforms, and
It is the one used by the I2S audio interface.
Pins and might is better choices on an A +, B + or Pi2.
2) The onboard analogue audio output uses both PWM channels.
3) So is careful mixing audio and PWM.
4) Currently the clock must has been enabled and configured
By the other means.
Load:dtoverlay=pwm-2chan,<param>=<val>
Load:dtoverlay=pwm,<param>=<val>
Params:pin Output Pin (default)-see table
Func Pin function (default 2 = ALT5)-See above
Clock PWM clock frequency (informational)
Name:pwm-2chan
Info:configures both PWM channels
Legal pin,function combinations for each channel:
pwm0:12,4 (Alt0) 18,2 (ALT5) 40,4 (Alt0) 52,5 (ALT1)
pwm1:13,4 (Alt0) 19,2 (ALT5) 41,4 (Alt0) 45,4 (Alt0) 53,5 (ALT1)
N.B.:
1) Pin available on all platforms, and
It is the one used by the I2S audio interface.
Pins and might is better choices on an A +, B + or Pi2.
2) The onboard analogue audio output uses both PWM channels.
3) So is careful mixing audio and PWM.
4) Currently the clock must has been enabled and configured
By the other means.
Load:dtoverlay=pwm-2chan,<param>=<val>
Params:pin Output Pin (default)-see table
Pin2 Output PIN for other channel (default 19)
Func Pin function (default 2 = ALT5)-See above
Func2 Function for pin2 (default 2 = ALT5)
Clock PWM clock frequency (informational)

Read more about/boot/overlays/readme

Resolving problems with 18b20 and no sound in the new Raspberry Pi kernel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.