Sending Pager POCSAG message

I’m using MMDVM as Hat/shield on Raspberry Pi 0 W to send POCSAG message to pager.

Frequency is configured to 433.450.000 and after running MMDVMHost I run:

$ sudo RemoteCommand 7642 page 1000001 “Teste”

On computer with a RTLSDR dongle I run the “gqrx” interface and configure to 433.450.000Hz and enable UDP button:

In other terminal I run this command to decode POCSAT:

$ nc -l -u 7355 | sox -t raw -esigned-integer -b16 -r 48000 – -esigned-integer -b16 -r 22050 -t raw – | multimon-ng -t raw -a SCOPE -a POCSAG512 -a POCSAG1200 -a POCSAG2400 -f alpha –

When the RemoteCommand above is executed on Raspy board I see it:

POCSAG1200: Address: 1000001 Function: 3 Alpha: Test<NUL>


Useful links about pagers

These are nice references to Motorola Pagers (mainly Motorola Advisor) using POCSAG protocol:

Graphics libraries for embedded systems

This is a small list of GUI for embedded system, mainly for microcontrollers, but some for Linux as well.





Nano-X (previously known as Microwindows) :





Using MMDVM Hat board to send Pager message

While searching for ways to transmit Pager messages I found this nice post:

There are many ways to transmit to pager using the POCSAG protocol, but I decided to buy a MMDVM Raspberry Pi Hat board:

I bought the model “MMDVM OLED CASE” without the “Raspi 0 W” because I already have one! Then I spent around U$ 30,00 with free shipping, very good!

When it arrived I mounted it over my Raspi board running Raspbian 11.

Basically I cloned and compiled the MMDVMHost and its dependencies like WiringPi and “ArduiPi OLED”.

After compiling and installing I moved the file MMDVM.ini to /etc/ and edited it to enable POCSAG protocol and “Remote Control”.

Unfortunately while running the “RemoteCommand 7642 page 1000001 Ola Mundo” it was returning this error message:

“Received a NAK to the SET_FREQ command from the modem”

It was fixed changing RXFrequency, TXFrequency and POCSAG Frequency to 433450000.

Unfortunately many forums has this issue but nobody explain the root cause, some report the issue was caused by incompatible MMDVM_HS firmware version, duplex config enable for this board that doesn’t support duplex, etc. The only place where I found the right root cause was here:

Because of it I spent time testing many configurations, updating firmware, etc. At least I’m now using a more updated firmware, from MMDVM_HS_Hat-v1.4.17 to MMDVM_HS_Hat-v1.5.2

Compiling pic30-gcc on Linux

Some people don’t know, but Microchip uses GCC compiler on their MPLAB, they are using it for more than 15 years and never contributed back to mainline. Even worst: they have some non-free optimization that they don’t release as open-source. But don’t worry, Darwin is implacable, they are losing marketing share year after year (even after spent Billions to buy Atmel).

Now the good news is someone created some script to compile pic30-gcc to Linux (or Cygwin) with the patches that Microchip was obligated to release as open-source because the GPL license and put it here: but it is outdated for about 11 years.

Even so I decided to try to compile it and after some small modifications I succeeded, these are the steps:

$ git clone
$ cd c30-linux
$ git am /path/to/0001-Fix-pic30-linux-compilation-on-Ubuntu-21.10.patch
$ ./configure
$ make
$ sudo make install
$ sudo cp -a /usr/local/pic30/* /usr/local/

I don’t have plans to use it and I suggest you to avoid using it. It is better to use a microcontroller with a well supported GCC compiler from a company that contribute back to the open-source community.

Note: the above patch can be downloaded from here:

Understanding the semaphore leak on ESP32/ESP32C3’s NuttX WiFi Driver

The initial issue was “fixed” with a workaround using a NuttX feature (or hook) that enables some function to be called during the task exit (when CONFIG_SCHED_ONEXIT is enabled). More info:

Unfortunately this workaround stopped to work few days ago when on_exit() function was moved from kernel side to user side:

Then my colleague Gustavo decided to fix this issue with a proper solution:

He also gave a detailed explanation about the root causes of the issue:

The Wi-Fi library creates a new semaphore for every thread that performs connection operations, so we cannot have a global pointer.
Since these semaphores are thread-local, this motivated the initial implementation based on pthread_key_t, so that the semaphores were being stored in Thread Local Storage, and then could be destroyed on thread termination. The solution here was based on the one implemented for ESP-IDF, which works as expected.
But on NuttX it resulted in the semaphores not being destroyed. I'll try to explain why.
The Wi-Fi library operates in a dedicated Kernel Thread, named wifi. But the pthread_key_t and the destructor for the semaphores were allocated to the Thread Local Storage of the init thread.
Every network-related request from the application will be handled by the wifi kernel thread and its child pthreads. The issue is that those child pthreads do not belong to the same Task Group from the init thread, which is the one whose TLS area contains the semaphore destructor.
So the catch here is that NuttX provides this process-like abstraction which segregates pthreads created from different tasks. So a pthread created from Task B won't be able to share keys of type pthread_key_t with another pthread from Task A.

That is it, now the leakage is fixed!

Recording audio call on Android

recorder = new MediaRecorder();
try {
} catch (IllegalStateException e) {
} catch (IOException e) {

Source: msg# 504
Update: according to it should use VOICE_CALL instead of MIC.

Testing Pascal on NuttX

These are the steps to test Pascal VM ( on NuttX:

$ cd nuttxspace/nuttx
$ cd ../apps/
$ ln -s /home/alan/nuttxspace/Pascal pascal
$ ls -l
total 112
-rw-rw-r-- 1 alan alan 8588 mar 22 20:35
drwxrwxr-x 1 alan alan 68 mai 9 14:32 boot
drwxrwxr-x 1 alan alan 126 mai 9 14:31 builtin
drwxrwxr-x 1 alan alan 158 mai 9 14:32 canutils
drwxrwxr-x 1 alan alan 90 mai 9 14:32 crypto
-rw-rw-r-- 1 alan alan 2000 mar 22 20:35
-rw-rw-r-- 1 alan alan 1415 mar 22 20:35 DISCLAIMER-WIP
drwxrwxr-x 1 alan alan 2374 mai 9 14:32 examples
drwxrwxr-x 1 alan alan 178 mai 9 14:32 fsutils
drwxrwxr-x 1 alan alan 84 mai 9 14:32 gpsutils
drwxrwxr-x 1 alan alan 178 mai 9 14:32 graphics
drwxrwxr-x 1 alan alan 54 mar 22 20:35 import
drwxrwxr-x 1 alan alan 246 mar 22 20:35 include
drwxrwxr-x 1 alan alan 78 mai 9 14:32 industry
drwxrwxr-x 1 alan alan 156 mai 9 14:32 interpreters
-rw-rw-r-- 1 alan alan 60749 mar 22 20:35 LICENSE
-rw-rw-r-- 1 alan alan 3273 mar 22 20:35 Make.defs
-rw-rw-r-- 1 alan alan 6640 mar 22 20:35 Makefile
drwxrwxr-x 1 alan alan 74 mai 9 14:32 math
drwxrwxr-x 1 alan alan 86 mai 9 14:32 mlearning
drwxrwxr-x 1 alan alan 136 mar 22 20:35 modbus
drwxrwxr-x 1 alan alan 464 mai 9 14:32 netutils
-rw-rw-r-- 1 alan alan 161 mar 22 20:35 NOTICE
drwxrwxr-x 1 alan alan 1132 mai 9 14:31 nshlib
lrwxrwxrwx 1 alan alan 28 mai 9 14:32 pascal -> /home/alan/nuttxspace/Pascal
drwxrwxr-x 1 alan alan 112 mai 9 14:32 platform
-rw-rw-r-- 1 alan alan 10377 mar 22 20:35
drwxrwxr-x 1 alan alan 672 mai 9 14:32 system
drwxrwxr-x 1 alan alan 282 mai 9 14:32 testing
drwxrwxr-x 1 alan alan 202 mar 22 20:35 tools
drwxrwxr-x 1 alan alan 124 mai 9 14:32 wireless
alan@dev:~/nuttxspace/apps$ cd ../nuttx
$ ./tools/ sim:nsh
Copy files
#configuration written to .config

$ make menuconfig

$ make

In file included from ./libexec_runloop.c:45:
/home/alan/nuttxspace/apps/pascal/insn16/include/libexec.h:61:4: error: #error CONFIG_PASCAL_POINTERSIZE must be 8
61 | # error CONFIG_PASCAL_POINTERSIZE must be 8
| ^~~~~
ERROR: cc failed: 1


Application Configuration —>
Pascal Support —>
Target Machine Description —>
(8) Size of a pointer

$ make
LD: nuttx
CC: -x c allsyms.tmp
/usr/bin/ld: nuttx.rel: in function libexec_FloatOps': /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:315: undefined reference tosqrt'
/usr/bin/ld: /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:324: undefined reference to sin' /usr/bin/ld: /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:333: undefined reference tocos'
/usr/bin/ld: /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:342: undefined reference to atan' /usr/bin/ld: /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:351: undefined reference tolog'
/usr/bin/ld: /home/alan/nuttxspace/Pascal/insn16/libexec/libexec_float.c:360: undefined reference to `exp'
collect2: error: ld returned 1 exit status


Library Routines —>
[*] Standard Math library

$ ./nuttx
login: admin
User Logged-in!

NuttShell (NSH) NuttX-10.3.0-RC0
MOTD: username=admin password=Administrator
nsh> ?
help usage: help [-v] []

. cd echo hexdump mkfatfs ps sleep uname
[ cp exec kill mkrd pwd source umount
? cmp exit losetup mount readlink test unset
basename dirname false ln mv rm time usleep
break dd free ls poweroff rmdir true xd
cat df help mkdir printf set truncate

Builtin Apps:
dumpstack gpio hello nsh prun sh