Xubuntu sound popping every few seconds SOLVED

The popping is caused by power saving feature that can cause audible pops when your sound card sleeps and wakes up. So in my desktop I disabled this feature!

My sound card is an HDA-Intel

cat /proc/asound/cards

0 [PCH ]: HDA-Intel - HDA Intel PCH
          HDA Intel PCH at 0xf7f30000 irq 34

To disable power saving and persist this change after reboot:

>>> /etc/modprobe.d/alsa-base.conf <<< add
options snd-hda-intel power_save=0 power_save_controller=N

To test settings (in my case doesn’t work)

sudo sh -c "echo 0 >  /sys/module/snd_hda_intel/parameters/power_save"
sudo sh -c "echo N > /sys/module/snd_hda_intel/parameters/power_save_controller"

REF: https://superuser.com/questions/1493096/linux-ubuntu-speakers-popping-every-few-seconds

Xubuntu 20.04 with LVM on LUKS

Boot Xubuntu installation media, choose “Try”, enter “Terminal emulator” …

First, create three partitions: EFI with 128MB, /boot with 512MB and last with remaining space

sudo fdisk /dev/sda
g

n
1
<ENTER>
+128M
<remove signature>
t
1

n
2
<ENTER>
+512M
t
2
20

n
3
<ENTER>
<ENTER>
t
3
31
Disk model: ST1000VN002-2E41
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: A2C8ED15-47CB-4E4B-929E-E45128441F03
Device Start End Sectors Size Type
/dev/sda1 2048 264191 262144 128M BIOS boot
/dev/sda2 264192 1312767 1048576 512M Linux filesystem
/dev/sda3 1312768 1953525134 1952212367 930.9G Linux LVM
sudo mkfs.fat -F32 /dev/sda1
sudo mkfs.ext2 -m 0 /dev/sda2
sudo cryptsetup luksFormat --hash=sha512 --key-size=512 --cipher=aes-xts-plain64 --verify-passphrase /dev/sda3
sudo cryptsetup luksOpen /dev/sda3 sda3_crypt

sudo pvcreate /dev/mapper/sda3_crypt

sudo vgcreate vg0 /dev/mapper/sda3_crypt

sudo lvcreate -n dskswap -L 16GB vg0
sudo lvcreate -n dskroot -L 100GB vg0
sudo lvcreate -n dskhome -L 100GB vg0
sudo mkswap /dev/mapper/vg0-dskswap
sudo swaplabel -L SWAP_SDA /dev/mapper/vg0-dskswap
sudo mkfs.ext4 /dev/mapper/vg0-dskroot
sudo mkfs.ext4 /dev/mapper/vg0-dskhome

Now, execute “Install Xubuntu 20.04 LTS” with icon on Desktop. Next, next, next… until “Instalation Type”, choose “Something else”

Devicetypemount point
/dev/mapper/vg0-dskhomeext4/home
/dev/mapper/vg0-dskhomeext4/
/dev/mapper/vg0-dskswapswapswap
/dev/sda1fat32/boot/efi
/dev/sda2ext2/boot
Xubuntu 20.04 custom install disk partitions

Device for boot loader installation: /dev/sda

Choose “continue testing”… Now build the chroot environment

Chroot environment

sudo cryptsetup luksOpen /dev/sda3 sda3_crypt
mkdir newpart
sudo mount /dev/mapper/vg0-dskroot newpart
sudo mount /dev/sda2 newpart/boot
sudo mount /dev/sda1 newpart/boot/efi

sudo mount -t proc /proc newpart/proc
sudo mount --rbind /dev newpart/dev
sudo mount --rbind /dev/pts newpart/dev/pts
sudo mount --rbind /sys newpart/sys 
sudo mount --rbind /run newpart/run
sudo chroot newpart

Now, prepare LUKS automount

sudo cryptsetup luksDump /dev/sda3 | grep UUID

>>> /etc/crypttab <<<
sda3_crypt UUID=2945b973-12ea-4f45-9454-8d873da8be9d none luks,discard

Test automount

$ sudo /sbin/cryptdisks_start sda3_crypt
/dev/mapper/vg0-dskroot / ext4 errors=remount-ro 0 1
UUID=45bf98f6-665e-4d9d-9462-e40b017e3881 /boot ext2 defaults 0 2
UUID=662E-6E71 /boot/efi vfat utf8,umask=007,gid=46 0 1
/dev/mapper/vg0-dskhome /home ext4 defaults 0 2
/dev/mapper/vg0-dskswap none swap sw 0 0
apt-get install grub-efi-amd64 efibootmgr

grub-install --target=x86_64-efi /dev/sda

efibootmgr --create --disk /dev/sda --part 1 --loader /boot/efi/EFI/BOOT/BOOTX64.EFI --label "Xubuntu Boot Manager"


## efibootmgr --create --disk /dev/sda --part 1 --loader /boot/efi/EFI/ubuntu/grubx64.efi --label "Xubuntu Boot Manger" --verbose


exit
reboot






# update-grub
# grub-install --recheck /dev/sda
# update-initramfs -u

reboot

Floppy MFM: Raw Research

STM32 GPIO

All GPIO configurations ares controlled by GPIOx_CRL and GPIOx_CRH

GPIO Output

  • push-pull
    • CNF[1:0] = 00
    • MODE[1:0]
      • 00 = reserved
      • 01 = Max. output speed 10 MHz
      • 10 = Max. output speed 2 MHz
      • 11 = Max. output speed 50 MHz
  • open-drain
    • CNF[1:0] = 01
    • MODE[1:0]
      • 00 = reserved
      • 01 = Max. output speed 10 MHz
      • 10 = Max. output speed 2 MHz
      • 11 = Max. output speed 50 MHz

GPIO Input

  • Analog
    • CNF[1:0] = 00
    • MODE[1:0] = 00
  • Input floating
    • CNF[1:0] = 01
    • MODE[1:0] = 00
  • Input pull-up
    • CNF[1:0] = 10
    • MODE[1:0] = 00
    • GPIOx_ODR = 1
  • Input pull-down
    • CNF[1:0] = 10
    • MODE[1:0] = 00
    • GPIOx_ODR = 0

GPIOx_ODR

From bits 0 to 15, each bit corresponds each port going from port 0 to port 15. Upper half word (bits from 16 to 31) are reserved and must be zeroed.

GPIOx_BSRR

The register has two halves: from bit 0 to bit 15 and from bit 16 to bit 31. First half [15:0] is bit set, meaning for each 1 will output high into the corresponding port. Second half [31:16] is bit reset, meaning each 1 will output low into the corresponding port. In second half, bit 16 means port 0, bit 17 means port 1, and so one until bit 31 meaning port 15.

GPIOx_CRL

Configure from port n (0..7) registers CNFn and MODEn. Each port has 4 bits, which means port 0 has bits 3:0, port 1 bits 7:4 and so one until port 7 bits 31:28. This four bits means: CONF[1:0] MODE[1:0].

Example: default value 0x4444.4444 means CNF 01, MODE 00 to all ports from port 0 to port 7

GPIOx_CRH

Almost the same as CPIOx_CRL but for port 8 to port 15.

Configure from port n (8..15) registers CNFn and MODEn. Each port has 4 bits, which means port 0 has bits 3:0, port 1 bits 7:4 and so one until port 7 bits 31:28. This four bits means: CONF[1:0] MODE[1:0].

GPIOx_IDR

  • Bits 31:16 = reserved
  • Bits 15:0 = Ports IDR15..IDR0