Read more

#Raspberry Pi: The N-queens Problem! (benchmark) Preempt-RT vs. Standard Kernel!

The N-Queens Problem/Puzzle is a well-known problem that consists of placing N chess queens on an N × N chessboard so that no two queens attack each other. For example, one possible solution to the N-queens problem for N = 4 is the following:

N-queens problem (N=4)
Fig. 1: N-queens problem example (N = 4). Source: Google Optimization Tools

As you can see, no two queens are on the same row, column or diagonal. Usually the problem consists to find all possible solutions, rather than one optimal solution.

I wrote a script in Python that calculates the number of all possible solutions. This script can be used as Benchmark for e.g. the Raspberry Pi.

Many people use the N-queens problem to test the performance of a defined solver. But this can be cheated. In my case, the solver (script) is not optimal (I implemented the backtracking way based on this solution), but it works, and it helps me to compare different configurations of the Raspberry Pi (kernel, model B & B+ etc.). I solved the N-queens problem for N=12, in single (ST) and multi-thread (MT) configurations and repeated the tests 45(ST)/100(MT) to check the result variances.

All the data, scripts and notebooks are available here:

Python Code: https://github.com/lemariva/rPI-Tests

Read more

#Rapberry Pi: Preempt-RT Kernel Performance on Rasbperry PI 3 Model B+

The Raspberry Pi 3 Model B+ (Fig. 1) is now on sale and I bought one two weeks ago. The main modifications are the followings:

  • A 1.4GHz 64-bit quad-core ARM Cortex-A53 CPU
  • Dual-band 802.11ac wireless LAN and Bluetooth 4.2
  • Faster Ethernet (Gigabit Ethernet over USB 2.0)
  • Power-over-Ethernet support (with separate PoE HAT)
  • Improved PXE network and USB mass-storage booting
  • Improved thermal management
Raspberry Pi 3 B+
Fig. 1: Raspberry Pi 3 Model B+

The Raspberry Pi uses now the LAN2515 chip from Microchip instead of the LAN9514 for Ethernet and the USB Ports.

If you are looking for some Benchmarking of the new model, Gareth Halfacree has some nice graphics on his website.

If you are planning to use a heatsink on the new model, please check that the new SoC packaging has a hole, and you shouldn't cover it. Some people are writing that the heat spreader (metal bit on the Fig. 1) reaches to dissipate the heat generated and you don't need an extra heatsink. But, if you are like me, and you are using the Raspberry Pi for (near) real-time applications, with data processing, you should use some additional cooling system. It goes really hot!. The PXE Ethernet Hat, which is coming soon, has a fan. It could be an option!

As usual on my last posts, I compiled the last version of the Preempt-RT Patched Kernel to test its performance on this new model.

Rpi rt kernel tittle min

Read more

#Raspberry Pi: Preempt-RT Kernel 4.14.y on Raspberry Pi

The forked rpi-4.14.y-rt repo by TiejunChina is now a branch under the official Raspberry Pi repo. That means you need to type the following to clone the Preempt-RT patched Kernel

~/rpi-kernel$ git clone https://github.com/raspberrypi/linux.git
~/rpi-kernel$ cd linux
~/rpi-kernel/linux/ git checkout rpi-4.14.y-rt

Then, you can follow the tutorial from here.

RPI Zero Preempt-RT

Read more

#Raspberry PI Zero W: Preempt-RT Kernel Performance (updated: 18.03.2018)

Today I patched the kernel of a Raspberry Pi Zero W with Preempt-RT. I used the repo TiejunChina.

Update 18.03.2018: The official Preempt-RT patched Rasbian repo is here.

~/rpi-kernel$ git clone https://github.com/TiejunChina/linux.git # update 18.03.2018: old repository
~/rpi-kernel$ git clone https://github.com/raspberrypi/linux.git # update 18.03.2018: new repository
~/rpi-kernel$ cd linux
~/rpi-kernel/linux$ git checkout rpi-4.14.y-rt  # today the kernel version is 4.14.22
                                                # with rt17 resulting in 4.14.22-rt17+

You can find a complete tutorial for patching a Raspbian kernel 4.14.y here.

Check the options for Raspberry Model A(+), B(+), Zero W.

(perfomance tests and problems inside!)

Wemos & MicroPython

Read more

#Tutorial: Installing dependencies on MicroPython

While I was reading my getting stated tutorial about MicroPython again, I noticed that I've forgotten to tell something about dependencies or packages.

Here is possible to find some MicroPython packages. On the WeMos or the ESP8266, it is possible to install these packages using the upip package manager. The WiPy doesn't have the package.

RPI RT Preempt Kernel Performance

Read more

#Raspberry Pi: Preempt-RT vs. Standard Kernel 4.14.y

The last week I was working on a real-time application (with a 1 ms sample time) that runs on an ARMv8 Cortex-A53 (Raspberry Pi 3 Model B based board) and I was wondering the differences between latencies on the standard and the Real-Time (RT) Linux kernel. I had some problems with the standard kernel version, then I thought I could analyze the latencies of both kernels, and make some conclusions. Many test are available but with older kernel versions. The tests were performed using the Raspbian Kernel 4.14.21 and the RT-Preempt Patch 4.14.21-rt17!

RPI RT Preempt Kernel

Read more

#Raspberry Pi: Preempt-RT Patching Tutorial for Kernel 4.14.y

There are a lot of tutorials for Raspberry Pi kernel patching using RT-Preempt, but I needed about 15 hours to get it working! I hate Kernel patching! and I have to say, that's not my first time. I have a system working with Ubuntu, RTAI and an Ethercat master. I patched the system more than once. But it is/was always a new thing! and It costs a lot of time! ;)

Then, you have another tutorial here! I only hope that the repo gets official. It could reduce the time to get the RT kernel working, if it is kept updated.

Update: 18.03.2018: The repository is now here! It is a branch from the official Raspberry Pi kernel repository.


Read more

#Photo Gallery: Melbourne

As I promised some photos of Melbourne (Australia). Bangkok photos are coming this week. I don't know if you noticed, but I added two new repositories to GitHub: Both repositories are extensions for PageKit. The first one allows you to add Google Adsense ads to the posts. The second one extends the PageKit blog plugin to add categories and tags to the blog posts. I was/am quite busy these weeks, but I am writing the README files. I need to check them again. Enjoy the photos!

Happy New Year!

Read more

Happy New Year!

Out with the old, in with the new! Happy 2018!

This time something without electronics. I took the title photo! You should read "Happy New Year" ;). Thanks to my brother who wrote it in the air! Nice!

As you may notice, I use his music on the videos. If you want to hear more great music, here you find the links:

Wipy2.0 Xmas-lights

Read more

#Micropython: Merry Xmas & Happy New Year!

It has been a while since my last post! Sorry, I was a little bit busy and then I was on a business trip in Melbourne for the CDC2017 and then I had a week holiday in Bangkok. I will be posting some photos on the next days!

It's been a year now since I started this blog. It's a hard job to maintain it up-to-date but I still have fun writing and coding for this purpose! So let us start!

The first video that I published a year ago was using the Wipy2.0 and a WS2812b led strip for some Christmas lights (click here). Now, this time I bought a WS2812b panel (100 bits or 10x10 pixels -or leds- see fig. 1) and as we have/had christmas again, so I wrote some code for this panel to make again some Xmas lights! :).

Captive Portal

Read more

#White Hacking: Wemos & Captive Portal using MicroPython

At the beginning of October I wrote a blog article called White Hacking: WeMos and SquirelCrawl!. I used the WeMos (ESP32) and the firmware provided by Hacker Arsenal to do a captive portal. As you known, a captive portal is a web page which is displayed to newly connected users before they are granted broader access to network resources [

This time, I've implemented the captive portal (system) using MicroPython on the ESP32. This implementation allows you to upload more than one file. This means, e.g. you can upload CSS and JavaScript files for better web page style and more interaction with the user (e.g. using jquery). However, you should not forget that the WiFi speed of the ESP32 as an access point is very limited. You should always optimize the web page!

Python Code: https://github.com/lemariva/uPyPortal

Portal optimization is required! This is only a sample and a very beta code. The portal is far away from stable :S, but it works.


I assume no responsibility for the usage of this code and post. I repeat again, the book "The Hacker Playbook 2: Practical Guide to Penetration Testing - Peter Kim" says

Just remember, ONLY test systems on which you have written permission. Just Google the term “hacker jailed” and you will see plenty of different examples where young teens have been sentenced to years in prison for what they thought was a “fun time.” There are many free platforms where legal hacking is allowed and will help you further educate yourself.

Virus Macro

Read more

#Security: Phishing with Macros once again!

And once again! Word files with Macro! But this time, I was the first one to report it to VirusTotal and Hybrid-Analysis! :)

Virus Macro!
Fig 1: VirusTotal report! Just only two: Fortinet sells hardware, and Qihoo-360 is in China (:S)...

Here you have the e-mail. The sender is this time the "BOSS Last Name" (A nice improvement! :P) without address, or something like that!