Compiling the Circuit Simulator kTechLab

I was searching for a circuit simulator for Linux and found kTechLab.

There is not a built package for Ubuntu (I’m using Ubuntu 16.04) then I compiled it from source code:

$ git clone
$ cd ktechlab/
$ sudo apt-get install libqt4-dev
$ sudo apt-get install kdelibs5-dev
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

Then I just execute:

$ ktechlab

And kTechLab starts in all its glory!

How to get the machine origin with LINUXCNC

Today I tested the LinuxCNC controlling all 3 stepper motors (one for each axis) connected on TB6560-4V3 board.

Everything worked as expected, but zeroing the HOME axes manually is very boring. Then I decided to search how to do it automatically.

I found this nice post exampling the process:

I will need to connect the switches limiters (end-stoppers) to my CNC first to get it working. BTW I decided to post about it with the link to original post because it could be useful for other people.

CNC: Wire Limit Switches

I’m finishing my CNC building and now I need to wire the Limit Switches (End-stops).

My CNC initially will be controlled by TB6560-4V3 board, then searching for more information about how to connect the end-stops I found this nice tutorial:

Their TB6560 board is a little-bit different from mine (they are using older model), but almost all (if not all) information could be applied to my board as well.

So, let me go ahead and stops these motors at its end!

NuttX 10 Years!

Tomorrow 07 Feb 2017 NuttX RTOS will complete 10 years as an Open Source project. The projects was published in the SourceForge on 07 Feb 2007.

From 2007 to 20017 NuttX evolved a lot. Maybe you don’t know, but NuttX is used by many companies. If you have a Moto Z Phone and got a Snap cover that Snap run NuttX!

Other example is Sony (that company that inspired Steve Jobs to create great products) is also using NuttX and even did a publish presentation about the benefits of using NuttX:

I discovered about NuttX in 2010. My friend Marcelo Barros pointed about an article in the Linux Jornal. Since then I have used NuttX in many projects as you can find on my old posts.

Also I created a YouTube channel dedicated to NuttX, called NuttX Channel:

NuttX is evolving fast and will be a Linux companion on “Embedded Arena”.

There is no other RTOS good like NuttX, you can spend your time searching. There are more than 200 available:

Thank Greg Nutt for this incredible RTOS called NuttX.

More here:

Is the SanDisk Ultra microSD with oemid “PT” a counterfeit card?

I’m writing a SD/MMC NuttX driver for LPC43xx and today a bought a SanDisk Ultra 16GB microSD to do some test because my old SD Cards are slow and counterfeited cards.

First let put it on Linux and see what we get:

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/cid 

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/csd

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/date

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/erase_size

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/fwrev

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/hwrev 

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/manfid 

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/name 

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/oemid

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/scr

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/serial 

$ cat /sys/class/mmc_host/mmc0/mmc0\:0007/type 

At first I noted the oemid 0x5054 (“PT”) a little bit strange.
Then searching for it I found this thread:

Then decided to test using flashbench:

$ sudo apt-get install flashbench

$ sudo flashbench -a /dev/mmcblk0 --blocksize=1024
align 4294967296	pre 1.33ms	on 1.65ms	post 1.35ms	diff 308µs
align 2147483648	pre 1.34ms	on 1.66ms	post 1.36ms	diff 308µs
align 1073741824	pre 1.33ms	on 1.65ms	post 1.34ms	diff 312µs
align 536870912	pre 1.35ms	on 1.65ms	post 1.35ms	diff 306µs
align 268435456	pre 1.35ms	on 1.64ms	post 1.35ms	diff 290µs
align 134217728	pre 1.34ms	on 1.67ms	post 1.34ms	diff 324µs
align 67108864	pre 1.34ms	on 1.64ms	post 1.34ms	diff 298µs
align 33554432	pre 1.34ms	on 1.67ms	post 1.36ms	diff 316µs
align 16777216	pre 1.35ms	on 1.64ms	post 1.36ms	diff 287µs
align 8388608	pre 1.32ms	on 1.68ms	post 1.36ms	diff 342µs
align 4194304	pre 1.36ms	on 1.64ms	post 1.37ms	diff 278µs
align 2097152	pre 1.36ms	on 1.6ms	post 1.35ms	diff 241µs
align 1048576	pre 1.36ms	on 1.6ms	post 1.34ms	diff 250µs
align 524288	pre 1.36ms	on 1.61ms	post 1.36ms	diff 250µs
align 262144	pre 1.36ms	on 1.59ms	post 1.35ms	diff 238µs
align 131072	pre 1.32ms	on 1.59ms	post 1.34ms	diff 261µs
align 65536	pre 1.34ms	on 1.6ms	post 1.35ms	diff 252µs
align 32768	pre 1.35ms	on 1.59ms	post 1.33ms	diff 253µs
align 16384	pre 1.35ms	on 1.58ms	post 1.35ms	diff 227µs
align 8192	pre 1.36ms	on 1.47ms	post 1.37ms	diff 108µs
align 4096	pre 1.36ms	on 1.58ms	post 1.36ms	diff 222µs
align 2048	pre 1.38ms	on 1.39ms	post 1.37ms	diff 8.03µs

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=1 --random
4MiB    4.43M/s 
2MiB    3.5M/s  
1MiB    14.1M/s 
512KiB  2.97M/s 
256KiB  2.9M/s  
128KiB  3.44M/s 
64KiB   2.53M/s 
32KiB   1.76M/s 
16KiB   1.65M/s 

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=2 --random
4MiB    7.37M/s 
2MiB    4.01M/s 
1MiB    13.9M/s 
512KiB  3.56M/s 
256KiB  3.3M/s  
128KiB  2.77M/s 
64KiB   2.26M/s 
32KiB   2.14M/s 
16KiB   1.86M/s 

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=4 --random
4MiB    4.88M/s 
2MiB    4.57M/s 
1MiB    7.14M/s 
512KiB  3.26M/s 
256KiB  2.98M/s 
128KiB  2.66M/s 
64KiB   2.7M/s  
32KiB   2.16M/s 
16KiB   1.8M/s  

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=8 --random
4MiB    5.31M/s 
2MiB    3.93M/s 
1MiB    11.8M/s 
512KiB  3.18M/s 
256KiB  3.03M/s 
128KiB  2.74M/s 
64KiB   2.57M/s 
32KiB   2.25M/s 
16KiB   1.86M/s 

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=9 --random
4MiB    3.37M/s 
2MiB    3.7M/s  
1MiB    12.2M/s 
512KiB  3.2M/s  
256KiB  2.92M/s 
128KiB  2.87M/s 
64KiB   2.58M/s 
32KiB   2.27M/s 
16KiB   1.87M/s 

$ sudo flashbench -O /dev/mmcblk0 --open-au-nr=10 --random
4MiB    3.34M/s 
2MiB    3.12M/s 
1MiB    3.86M/s 
512KiB  1.99M/s 
256KiB  1.31M/s 
128KiB  663K/s  
64KiB   285K/s  
32KiB   135K/s  
16KiB   67.4K/s 

I got a little bit better results, but still bad results.

It doesn’t make any sense Sandisk put a Class 10 label in a microSD card that can’t sustain 10MB/s write speed.

If Sandisk insist it is original, then I suspect Sandisk is doing the same Kingston’s game: it is delivering low quality card to “black” market, see:

Too bad for a Sandisk Ultra microSD (here in Brazil I paid about U$ 15.00).