Laser ranging has many applications in production and life, such as ranging, positioning, obstacle avoidance, and so on. Time-of-Flight (ToF) ranging, as a type of laser ranging technology, is often used for real-time object detection in robots, autonomous vehicles, and traffic management because of its accuracy, fast response, and low power consumption. The face detection function of mobile phones also uses this technology. This article will introduce the WisBlock RAK12014 ToF laser ranging sensor module, and use the WisBlock development board to demonstrate how the module works. What is a ToF laser ranging sensor module? A ToF laser ranging sensor module uses laser pulses to measure the distance between itself and a target object. The WisBlock RAK12014 ToF laser ranging sensor module is based on STMicro VL53L0X, the smallest ToF ranging sensor in the world. The WisBlock RAK12014 provides accurate distance measurement and can measure distances up to 2 meters. […]
Linux hardware video encoding on Amlogic A311D2 processor
I’ve spent a bit more time with Ubuntu 22.04 on Khadas VIM4 Amogic A311D2 SBC, and while the performance is generally good features like 3D graphics acceleration and hardware video decoding are missing. But I was pleased to see a Linux hardware video encoding section in the Wiki, as it’s not something we often see supported early on. So I’ve given it a try… First, we need to make a video in NV12 pixel format that’s commonly outputted from cameras. I downloaded a 45-second 1080p H.264 sample video from Linaro, and converted it with ffmpeg:
1 |
ffmpeg -i big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4 -pix_fmt nv12 big_buck_bunny_1080p_H264_AAC_25fps_7200K-nv12.yuv |
I did this on my laptop. As a raw video, it’s pretty big with 3.3GB of storage used for a 45-second video:
1 2 3 4 |
ls -lh total 3.3G -rw-rw-r-- 1 jaufranc jaufranc 40M Aug 5 2011 big_buck_bunny_1080p_H264_AAC_25fps_7200K.MP4 -rw-rw-r-- 1 jaufranc jaufranc 3.3G May 21 15:03 big_buck_bunny_1080p_H264_AAC_25fps_7200K-nv12.yuv |
Now let’s try to encode the video to H.264 on Khadas VIM4 board using aml_enc_test hardware video encoding sample:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
khadas@Khadas:~$ time aml_enc_test 1080p.nv12 dump.h264 1920 1080 30 25 6000000 1125 1 0 2 4 src_url is : 1080p.nv12 ; out_url is : dump.h264 ; width is : 1920 ; height is : 1080 ; gop is : 30 ; frmrate is : 25 ; bitrate is : 6000000 ; frm_num is : 1125 ; fmt is : 1 ; buf_type is : 0 ; num_planes is : 2 ; codec is : 4 ; codec is H264 Set log level to 4 [initEncParams:177] enc_feature_opts is 0x0 , GopPresetis 0x0 [SetupEncoderOpenParam:513] GopPreset GOP format (2) period 30 LongTermRef 0 [vdi_sys_sync_inst_param:618] [VDI] fail to deliver sync instance param inst_idx=0 [AML_MultiEncInitialize:1378] VPU instance param sync with open param failed [SetSequenceInfo:979] Required buffer fb_num=3, src_num=1, actual src=3 1920x1080 Encode End!width:1920 real 0m26.074s user 0m1.832s sys 0m4.883s |
The output explains the parameters used. There are some error messages, […]
Trying out Edge Impulse machine learning platform on XIAO BLE Sense board
I had seen the Edge Impulse development platform for machine learning on edge devices being used by several boards, but I hadn’t had an opportunity to try it out so far. So when Seeed Studio asked me whether I’d be interested to test the nRF52840-powered XIAO BLE Sense board, I thought it might be a good idea to review it with Edge Impulse as I had seen a motion/gesture recognition demo on the board. It was quite a challenge as it took me four months to complete the review from the time Seeed Studio first contacted me, mostly due to poor communications from DHL causing the first boards to go to customs’ heaven, then wasting time with some of the worse instructions I had seen in a long time (now fixed), and other reviews getting in the way. But I finally managed to get it working (sort of), so let’s […]
QEMU 7.0 released with support for RISC-V KVM, Intel AMX, and more
QEMU (Quick EMUlator) is an open-source emulator used to run OS or programs on various architectures such as Arm, RISC-V, and many others when you don’t own specific hardware, or for quick testing. The developers have released QEMU 7.0 a few days ago with over 2500 commits from 225 developers. New features include support for RISC-V KVM and vector extensions, Intel AMX (Advanced Matrix Extension), improved flexibility for fleecing backups, various new features for Arm, and many more. QEMU 7.0 highlights listed by the developers: ACPI: support for logging guest events via ACPI ERST interface virtiofs: improved security label support block: improved flexibility for fleecing backups, including support for non-qcow2 images ARM: ‘virt’ board support for virtio-mem-pci, specifying guest CPU topology, and enabling PAuth when using KVM/hvf ARM: ‘xlnx-versal-virt’ board support for PMC SLCR and emulating the OSPI flash memory controller ARM: ‘xlnx-zynqmp’ now models the CRF and APU control […]
Getting started with Maker Nano RP2040 using CircuitPython: Blinky, RGB LED, and Piezo Buzzer
CNXSoft: This getting started guide was initially posted in Thai language by Suthinee Kerdkaew, and I’ve just translated her work into English with some minor edits. As discussed in an earlier article, Maker Nano RP2040 is a board following the Arduino Nano form factor, but with a more powerful Raspberry Pi RP2040 microcontroller. The board also comes with plenty of LEDs, as well as two RGB LEDs, and a piezo buzzer for audio output. Mr. Jean-Luc Aufranc has just given me a Maker Nano RP2040 board received from Cytron for review. I’ve never used a board before, so it’s my first experience, and in this article, I’ll try to program Maker Nano RP2040 with CircuitPython with three demos: a blinky sample, changing the color of the RGB LEDs, and playing a melody through the piezo buzzer. Let’s see if I can do it. Let’s get started. I first downloaded the […]
Raspberry Pi OS removes default “Pi” username, adds experimental support for Wayland
The Raspberry Pi Foundation has just released a new version of Raspberry Pi OS that removes the default username (pi) for security reasons, adds experimental support for Wayland, and lets people configure their Raspberry Pi with Bluetooth keyboard and mouse. Default username no more The most significant change in the new Raspberry Pi OS is the removal of the default “pi” user as several countries have legislation against default credentials for security reasons. That includes the Product Security and Telecommunications Infrastructure Bill (PSTI) in the UK, and California’s SB-327 IoT devices security law. Those laws mostly target default passwords, but removing a default username can be useful too to prevent force brute attacks. One consequence of removing the default username is that you won’t be able to skip the wizard in both the Desktop and Lite versions of Raspberry Pi OS since a new user needs to be created first. […]
How to get your domain suspended in five easy steps!
Regular readers may have noticed CNX Software was inaccessible for several days, and the reason was that my domain was suspended. I’m a bit late for April Fools’ day, but I’ll show how you can get your domain suspended too in five easy steps! I’ll also provide some background to what happened, and several errors of judgment made along the way What happened? On March 28, as I woke up I noticed I could not access the website and I had also received several emails and mentions on social networks that the website was down. I first tried to restart the LEMP stack of the server nginx, mysql, php, but it did not help. I quickly figured out there was a problem with DNS, so I went to the Cloudflare dashboard which is where I manage the DNS records, but I did not see any problems there. Eventually, I saw […]
Fixing performance issues with Realtek RTL8156B 2.5GbE USB dongle in Ubuntu
A few days ago, I reviewed a USB 3.0 to 2.5 Gbps Ethernet adapter based on Realtek RTL8156B chip in Ubuntu 20.04, and let’s say the reliability and performance were underwhelming. I got some recommendations like changing cables, the MTU size, etc… Playing around with cables did no help, but one comment mentioned the cdc_ncm driver could be the issue, followed by another saying that updating to Linux kernel 5.14 should install the correct r8152 driver… So I just did that:
1 |
sudo apt install linux-oem-20.04d |
This upgraded Linux 5.13 (shipped with Ubuntu 20.04 + HWE) to Linux 5.14, but still no luck as the system kept using the cdc_ncm driver with a half-duplex link:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
jaufranc@cnx-laptop-4:~$ inxi -n Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 IF: enp2s0f1 state: down mac: 98:28:a6:0f:06:07 Device-2: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter driver: ath10k_pci IF: wlp3s0 state: up mac: 70:c9:4e:b7:84:77 Device-3: Realtek USB 10/100/1G/2.5G LAN type: USB driver: cdc_ncm IF: enx1cbfced40321 state: up speed: 2500 Mbps duplex: half mac: 1c:bf:ce:d4:03:21 jaufranc@cnx-laptop-4:~$ uname -a Linux cnx-laptop-4 5.14.0-1022-oem #24-Ubuntu SMP Mon Jan 31 16:00:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
But then I thought I may have to use udev rules to prevent loading the cdc_ncm driver, and there’s indeed 50-usb-realtek-net.rules in r8152 driver to do just that. So I copied the file in /etc/udev/rules.d/ folder. Since I […]