Flashing NuttX on STM32LDiscovery board

The STM32LDiscovery board is powered by STM32L152R8T6 microcontroller. There is also the STM32L152C-Discovery board, the is exactly the same board but using the STM32L152RCT6 that comes with 256KB Flash and 32KB RAM.

This is the command to flash the nuttx.bin on it:

$ openocd -f interface/stlink-v2.cfg -f target/stm32l1.cfg -c init -c “reset halt” -c “flash write_image erase nuttx.bin 0x08000000”

The serial console is on UART1 (PA9 is TX output and PA10 is RX input)

Using rsync to create backup

rsync is mostly used to synchronize files between Internet servers, but this powerful tool also can be used to create local backup.

I have an external harddisk for backup. Instead just using copy command to save my computer file to the external harddisk I want to verify first if the file saved there is exactly the same I have in the computer. Case the files are different I want to save a newer version and rename the older version.

It is easy to do using rsync:

rsync --suffix="_`date +%Y.%m.%d.%H.%M`" -bacH localdirtobackup /media/user/external_harddisk/

If the file exist in the external harddisk, but its content is different then it will be renamed to filename_YEAR.month.day.Hour.Minute

It also could interesting to know when some file was corrupted in the computer or external harddisk, or if some virus is changing your files.

AER: Corrected error received: 0000:00:1d.6

I was getting these errors:

[ 1089.225561] pcieport 0000:00:1d.6: AER: Corrected error received: 0000:00:1d.6
[ 1089.225586] pcieport 0000:00:1d.6: PCIe Bus Error: severity=Corrected, type=Data Link Layer, (Transmitter ID)
[ 1089.225593] pcieport 0000:00:1d.6: device [8086:a336] error status/mask=00001000/00002000
[ 1089.225597] pcieport 0000:00:1d.6: [12] Timeout

Unfortunately these error are repeating too fast and avoiding other messages to be shown in the dmesg command.

The solution is easy, just add “pci=noaer” to GRUB_CMDLINE_LINUX_DEFAULT in the /etc/default/grub to include it on Linux kernel command line when grub boots Linux:

$ vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pci=noaer”

$ sudo update-grub

The reboot and the above message will desappear

Source: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1521173

Windows 10 only see 2MB partition on USB Flash Drive

I created a boot disk using Ubuntu “startup” program to install Linux on other computer, it worked fine, but when I put the USB Flash Drive on my computer that is running Windows 10 it only show 2MB.

It happens because the boot disk has two partitions and Windows only see the FAT partition. Fortuntately I found an way to fix it:

C:\> diskpart
DISKPART> list disk
DISKPART> select disk 1 (make sure its the right one)
DISKPART> clean (if it complains about permission, just type clean again)

It removed the partitions, but now I need to create other partition:

DISKPART> create partition primary

Then after removing and inserting the disk I format it and everything worked fine.

Source: https://askubuntu.com/questions/586118/16gb-pen-drive-showing-2mb-space-after-formatting-on-windows-7

Testing Mozilla DeepSpeech

These are the steps to test deepspeech 0.4.1 on Linux Ubuntu 18.04:

Install libsox and fake it as libsox2:

$ sudo apt-get install libsox-dev

$ ln -s libsox.so.3.0.0 libsox.so.2

Record your voice:

$ rec -c 1 -r 16000 -b 16 recording.wav

Alternatively download the audio from google translator and convert to wav 16bit 16khz mono:

$ ffmpeg -i the_quick_fox_jump_over_the_lazy_dogs.mp3 -acodec pcm_s16le -ac 1 -ar 16000 recording.wav

Test it:

$ ./deepspeech --model ../deepspeech-0.4.1-models/models/output_graph.pbmm --alphabet ../deepspeech-0.4.1-models/models/alphabet.txt --lm ../deepspeech-0.4.1-models/models/lm.binary --trie ../deepspeech-0.4.1-models/models/trie --audio recording.wav
TensorFlow: v1.12.0-10-ge232881
DeepSpeech: v0.4.1-0-g0e40db6
the quick brown fox jump over the lazy dog