Why does my RPi UART0 (ttyAMA0) freezes when bluetooth disabled? - raspberry-pi

I have a raspberry pi 3 model b (Raspbian GNU/Linux 10 (buster)) and I want to disable the Bluetooth module connected to UART0 (pins 8 and 10) to make use of UART0. When I add the dtoverlay=disable-bt to the end of /boot/config.txt and connect a UART device, the raspberry pi freezes or signs me out.
Does anyone have an idea as to why this may be happening?
I have uninstalled the application that uses Bluetooth as well.
I've ran the following commands:
sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service
My /boot/config.txtb file looks like this:
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
# Enable UART
enable_uart=1
Any help is appreciated.

I figured out that adding unnecessary spaces in the /boot/config.txt was causing my error.
I had written:
dtoverlay = disable-bt
instead of:
dtoverlay=disable-bt
Also, it helped to go to Pi > Preferences > RPi Configurations > Interfaces to make sure that the serial ports were enabled.

Related

Raspberry Pi I2c IOError: [Errno 121] Remote I/O error

I know there is already the same question as this, but I'm still gonna post this.
I'm trying to display some text to my I2c Lcd using my raspberry pi, I installed the driver from Github using gitclone "git clone https://github.com/the-raspberry-pi-guy/lcd.git) but the problem is every time I run the demo code which is this:
import drivers
from time import sleep
# Load the driver and set it to "display"
# If you use something from the driver library use the "display." prefix first
display = drivers.Lcd()
# Main body of code
try:
while True:
# Remember that your sentences can only be 16 characters long!
print("Writing to display")
display.lcd_display_string("Greetings Human!", 1) # Write line of text to first line of display
display.lcd_display_string("Demo Pi Guy code", 2) # Write line of text to second line of display
sleep(2) # Give time for the message to be read
display.lcd_display_string("I am a display!", 1) # Refresh the first line of display with a different message
sleep(2) # Give time for the message to be read
display.lcd_clear() # Clear the display of any data
sleep(2) # Give time for the message to be read
except KeyboardInterrupt:
# If there is a KeyboardInterrupt (when you press ctrl+c), exit the program and cleanup
print("Cleaning up!")
display.lcd_clear()
I keep getting the IOError: [Errno 121] Remote I/O error, i've already tried every fix I find from the internet, starting from enabling the i2c in the raspi-config, checking the connection, reinstalling drivers and changing i2c LCD etc. but the error still keep from coming up, please help me with this one I don't know how to fix this.

U-Boot won't take keyboard input from serial Raspberry Pi Model 3 B

I already have a working config for a compute module 3+. As I need the same setup on a raspberry Pi Model 3 B I tried bringing the config over.
Everything is compiled in a buildroot environment. U-Boot v2020.10 is used.
After some small changes regarding the device tree and dtoverlays I managed to get U-Boot to print on the serial console(as expected), but it ignores all keyboard input.
The following output is produced by U-Boot on serial console.
EDIT
I used the term serial very loosely here. I'm connected to the serial console with a serial-USB adapter and picocom. I applied the miniuart-bt overlay to restore /dev/ttyAMA0 respectively UART0 on gpio pins 14/15.
Lastely I configured U-Boot with PL011.
I left out support for mini-uart as this would break the output too.
This configuration works just fine on the compute module, but doen't register input on the model 3B.
EDIT
I moved the working u-boot.bin from the cm 3 to the model B to see what happens. It seemingly works as both are close enough. But the same problem occurs. The other way around though it does not work. So it is potential not a problem with U-Boot but with the Model B configuration.
1 Isa-Boot>·
2
3 U-Boot 2020.10 (Mar 24 2022 - 12:18:38 +0000)
4
5 DRAM: 924 MiB
6 RPI 3 Model B (0xa02082)
7 MMC: mmc#7e202000: 0, sdhci#7e300000: 1
8 In: serial
9 Out: vidconsole
10 Err: vidconsole
11 Hit any key to stop autoboot: 0·
Neither can I stop autoboot nor can I use the shell to complete the boot script.
I tried what feels like a million configurations and I'm out of ideas what could be the reason for this behavior. I also never experienced this with the cm module.
RPi setup config.txt:
enable_uart=1
start_file=start.elf
fixup_file=fixup.dat
kernel=u-boot.bin
gpu_mem=100
dtoverlay=miniuart-bt
dtparam=spi=on
device_tree=bcm2710-rpi-3-b.dtb
dtoverlay=sc16is750-spi0-ce0
U-Boot defconfig:
CONFIG_ARM=y
CONFIG_ARCH_CPU_INIT=y
CONFIG_ARCH_BCM283X=y
CONFIG_SYS_TEXT_BASE=0x00008000
CONFIG_TARGET_RPI_3_32B=y
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x4000
CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
CONFIG_DISTRO_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_SYS_STDIO_DEREGISTER=y
CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SYS_PROMPT="Isa-Boot> "
CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
CONFIG_CMD_FS_UUID=y
CONFIG_OF_EMBED=y
# CONFIG_ENV_IS_IN_FAT is not set
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
# CONFIG_NET is not set
CONFIG_DM_MMC=y
# CONFIG_MMC_HW_PARTITIONING is not set
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_BCM2835=y
CONFIG_DM_ETH=y
CONFIG_PINCTRL=y
# CONFIG_PINCTRL_GENERIC is not set
# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
# CONFIG_BCM283X_MU_SERIAL is not set
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_DM_VIDEO=y
# CONFIG_VIDEO_BPP8 is not set
# CONFIG_VIDEO_BPP16 is not set
CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_OF_LIBFDT_OVERLAY=y
From U-boot documentation, "U-boot Environment Variables":
bootdelay: After reset, U-Boot will wait this number of seconds before it executes the contents of the bootcmd variable. During this time a countdown is printed, which can be interrupted by pressing any key.
Set this variable to 0 boot without delay. Be careful: depending on the contents of your bootcmd variable, this can prevent you from entering interactive commands again forever!
Is this value 0 in your case?

Skylake hardware brightness changes too granular

I'm having a problem with Skylake i7-6700 HQ laptop display (HD 530 graphics) brightness changes:
If the value changes by 20 it works.
If the value changes by 19 it only works in multiple-hundred jumps.
If the value changes by <19 there is no brightness change at all.
However on my old Ivybridge laptop i7-3630 QM (HD 4000 graphics) brightness successfully changes in steps of 1.
Here is the script for testing:
#!/bin/bash
# Test all brightness levels from 1 to max_brightness
# For Intel i7-6700 HQ HD 530 graphics:
# - When change is 18 steps brighhness doesn't change at all.
# - When change is 19 steps brightnesss changes on multi-hundred point jumps.
# - When change is 20 steps each change applied as expected.
# For Intel i7-3630QM steps of 1 work fine!
if [[ $(id -u) != 0 ]]; then
echo >&2 "$0 must be called with sudo powers"
exit 1
fi
cd /sys/class/backlight/*/
max=$(cat max_brightness)
save=$(cat brightness)
for (( i=1; i < max; i=i+20)); do
echo $i > brightness
echo setting brightness level: $i
sleep .005
done
echo $save > brightness
echo resetting brightness level from $max back to: $save
exit 0
I think my skylake is working fine other than weird temperatures reported for pch_skylake sensor:
$ paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/...$/.0°C/'
INT3400 Thermal 20.0°C
SEN1 56.0°C
SEN2 52.0°C
SEN3 57.0°C
SEN4 61.0°C
pch_skylake -44.0°C
B0D4 50.0°C
x86_pkg_temp 52.0°C
Other than that Linux intel micro-code is definitely activated on old laptop (Ubuntu 16.04) but may not be loaded on new laptop (Ubuntu 16.04.5).
Edit: Rebooted with Ubuntu 18.04.1 LTS, Kernel 4.15.0-36 and the same behaviour is witnessed.
Confirmation: I wonder if others have a Skylake laptop and can confirm hardware brightness works the same way.
Question: For the app I'm developing, do I have to put in a feature for each user to test smallest granular brightness change supported?
Backlight brightness is separate from the GPU proper; the iGPU that's part of the CPU chip just produces pixel data for the LCD, e.g. as a DisplayPort output. (Or in laptops, often an eDP lower-voltage signal).
Note that in a desktop, you can't adjust the backlight brightness with software; there's no connection from the normal GPU hardware / drivers with the backlight.
The software backlight control in laptops is pretty much separate from the iGPU, and has nothing to do with whether it's a Skylake or IvyBridge. The backlight control is a separate hardware device with separate I/O ports (or memory-mapped IO registers or whatever).
Finer granularity backlight adjustment is a property of the laptop design, not the CPU. Specifically of the backlight technology and controller hardware.
(This is my understanding, but I haven't actually looked at GPU or backlight / ACPI driver code in enough detail to be 100% sure this is accurate.)
I have no idea if it's possible for software to query the true / meaningful granularity; this answer is only to point out the misconception that it's dependent on the GPU or GPU drivers.

Where does dev_dbg writes log to?

In a device driver source in the Linux tree, I saw dev_dbg(...) and dev_err(...), where do I find the logged message?
One reference suggest to add #define DEBUG . The other reference involves dynamic debug and debugfs, and I got lost.
dev_dbg() expands to dynamic_dev_dbg(), dev_printk(), or no-op depending on the compilation flags.
#if defined(CONFIG_DYNAMIC_DEBUG)
#define dev_dbg(dev, format, ...) \
do { \
dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
} while (0)
#elif defined(DEBUG)
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG, dev, format, ##arg)
#else
#define dev_dbg(dev, format, arg...) \
({ \
if (0) \
dev_printk(KERN_DEBUG, dev, format, ##arg); \
})
#endif
dynamic_dev_dbg() and dev_printk() call dev_printk_emit() which calls vprintk_emit().
This very same function is called in a normal mode when you just do a printk(). Just note here, that the rest functions like dev_err() will end up in the same function.
Thus, obviously, the buffer is all the same, i.e. kernel intrenal buffer.
The logged message at the end is printed to
Current console if kernel loglevel value (can be changed via kernel command line or via procfs) is high enough for certain message, here KERN_DEBUG.
Internal buffer which can be read by running dmesg command.
Note, data in 2 is kept as long as there still room in the buffer. Since it's limited and circular, newer data preempts old one.
Additional information how to enable Dynamic Debug.
First of all, be sure you have CONFIG_DYNAMIC_DEBUG=y in the kernel configuration.
Assume we would like to enable all debug prints in the built-in module with name 8250. To achieve that we simple add to the kernel command line the following 8250.dyndbg=+p.
If the same driver is compiled as loadable module we may either add options 8250 dyndbg to the modprobe configuration or to the shell command line when do it manually, like modprobe 8250 dyndbg.
More details are described in the Dynamic Debug documentation.
The "How certain debug prints are automatically enabled in linux kernel?" raises the question why some debug prints are automatically enabled and how DEBUG affects that when CONFIG_DYNAMIC_DEBUG=y. The answer is lying in the dynamic_debug.h and since it's used during compilation the _DPRINTK_FLAGS_DEFAULT defines the certain message appearence.
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
you can find dev_err(...) in kernel messages. As the name implies, dev_err(...) messages are error messages, so they will definitely be printed if the execution comes to that point. dev_dbg(...) are debug messages which are more generously used in the kernel driver code and they are not printed by default. So everything you have read about dynamic_debugging comes into play with dev_dbg(...).
There are several pre-conditions to have dynamic debugging working, below 1. and 2. are general preconditions for dynamic debugging. 3. and later are for your particular driver/module/subsystem and can be .
Dynamic debugging support has to be in your kernel config CONFIG_DYNAMIC_DEBUG=y. You may check if it is the case zgrep DYNAMIC_DEBUG /proc/config.gz
debugfs has to be mounted. You can check with sudo mount | grep debugfs and if not existing, you can mount with sudo mount -t debugfs /sys/kernel/debug
refer to dynamic_debugging and enable the particular file/function/line you are interested

Yocto: Can't get my beagleboard working: no framebuffer device

I have a beagleboard BB-MB-000 Rev. C4 and build a core_image_sato with Yocto and a uImage 4.4.9 from the meta-ti-layer using the recipe linux-ti-staging_4.4.bb.
I tried to boot my Beagleboard from nand, because I cannot boot it from mmc. But that's not the problem now.
Because of the missing fb0 device the xserver cannot start:
[ 3.320000] VAUX3: disabling
[ 3.330000] VDAC: disabling
[ 3.330000] VMMC1: disabling
[ 3.340000] VUSB1V5: disabling
[ 3.340000] VUSB1V8: disabling
[ 3.350000] VUSB3V1: disabling
[ 3.350000] hsusb2_vbus: disabling
[ 3.520000] jffs2: Empty flash at 0x01606f10 ends at 0x01607000
[ 5.220000] jffs2: notice: (1) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and.
[ 5.240000] VFS: Mounted root (jffs2 filesystem) on device 31:4.
[ 5.240000] devtmpfs: mounted
[ 5.250000] Freeing unused kernel memory: 420K (c085d000 - c08c6000)
[ 5.260000] This architecture does not have kernel memory protection.
INIT: version 2.88 booting
Error opening /dev/fb0: No such file or directory
Starting udev
[ 6.990000] udevd[798]: starting version 3.1.5
[ 7.450000] random: udevd urandom read with 17 bits of entropy available
bootlogd: cannot allocate pseudo tty: No such file or directory
ALSA: Restoring mixer settings...
INIT: Entering runlevel: 2
/usr/sbin/alsactl: load_state:1735: No soundcards found...
Because of the missing framebuffer device xinit ends up with an Error:
X.Org X Server 1.18.0
Release Date: 2015-11-09
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.2.0-1-amd64 x86_64
Current Operating System: Linux beagleboard 4.4.9-gba05e8fda2 #4 SMP Tue May 17 20:56:11 CEST 2016 armv7l
Kernel command line: console=ttyO2,115200n8 root=/dev/mtdblock4 rw rootfstype=jffs2 mpurate=auto buddy=zippy
camera=lbcm3m1 vram=12M omapfb.mode=dvi:1280x1024MR-16#60
Build Date: 12 May 2016 05:40:39AM
Current version of pixman: 0.32.8
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri May 20 16:53:51 2016
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Bad file descriptor
xinit: server error
Here comes the kernel-config-part, that maybe relevant for framebuffer:
#
# Graphics support
#
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
# CONFIG_IMX_IPUV3_CORE is not set
CONFIG_DRM=y
CONFIG_DRM_MIPI_DSI=y
CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_KMS_FB_HELPER=y
CONFIG_DRM_FBDEV_EMULATION=y
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_TTM=m
CONFIG_DRM_GEM_CMA_HELPER=y
CONFIG_DRM_KMS_CMA_HELPER=y
#
# Frame buffer Devices
#
CONFIG_FB=y
# CONFIG_FIRMWARE_EDID is not set
CONFIG_FB_CMDLINE=y
CONFIG_FB_NOTIFY=y
# CONFIG_FB_DDC is not set
# CONFIG_FB_BOOT_VESA_SUPPORT is not set
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYS_FOPS=y
# CONFIG_FB_SVGALIB is not set
# CONFIG_FB_MACMODES is not set
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_MODE_HELPERS=y
# CONFIG_FB_TILEBLITTING is not set
#
# Frame buffer hardware drivers
#
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
CONFIG_FB_ARMCLCD=y
# CONFIG_PLAT_VERSATILE_CLCD is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_OPENCORES is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I740 is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_SMSCUFX is not set
# CONFIG_FB_UDL is not set
# CONFIG_FB_IBM_GXT4500 is not set
# CONFIG_FB_DA8XX is not set
# CONFIG_FB_VIRTUAL is not set
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
# CONFIG_FB_BROADSHEET is not set
# CONFIG_FB_AUO_K190X is not set
CONFIG_FB_SIMPLE=y
# CONFIG_FB_SSD1307 is not set
# CONFIG_FB_SM712 is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=m
# CONFIG_LCD_L4F00242T03 is not set
# CONFIG_LCD_LMS283GF05 is not set
# CONFIG_LCD_LTV350QV is not set
# CONFIG_LCD_ILI922X is not set
# CONFIG_LCD_ILI9320 is not set
# CONFIG_LCD_TDO24M is not set
# CONFIG_LCD_VGG2432A4 is not set
CONFIG_LCD_PLATFORM=m
# CONFIG_LCD_S6E63M0 is not set
# CONFIG_LCD_LD9040 is not set
# CONFIG_LCD_AMS369FG06 is not set
# CONFIG_LCD_LMS501KF03 is not set
# CONFIG_LCD_HX8357 is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BACKLIGHT_GENERIC=y
CONFIG_BACKLIGHT_PWM=y
# CONFIG_BACKLIGHT_PM8941_WLED is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_LM3630A is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_LP855X is not set
# CONFIG_BACKLIGHT_PANDORA is not set
CONFIG_BACKLIGHT_AS3711=y
CONFIG_BACKLIGHT_GPIO=y
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
CONFIG_BACKLIGHT_LED=y
# CONFIG_VGASTATE is not set
CONFIG_VIDEOMODE_HELPERS=y
CONFIG_HDMI=y
After days of trying around with yocto and searching the internet I have no idea anny more. Could someone help me?
Remove x11 and wayland in local.conf:
DISTRO_FEATURES_remove = "x11 wayland"
You must "release" in the U-boot uEnv.txt also.
Are you using Qt5?