Search code examples
linuxreal-timeraspbianpreempt-rt

using BCM2835 with RT-PREEMPT kernel


I am making a project which send out 40khz signal from antenna. I have found the signal is not too accurate so I have decided to try a real-time kernel.

I run Raspbian Jessie on my Raspberry-Pi 2B. After clean install, the script run without any problem. bcm2835_delayMicroseconds could be run.

I follow this tutorial http://www.frank-durr.de/?p=203 compiled and installed the RT kernal. However, the script could no longer be run successfully. After showing "HIGH SLEEP", and it is held up.

This is the code snippet:

fprintf(stdout , "HIGH\n");
bcm2835_gpio_write(PIN, HIGH);
fprintf(stdout , "SLEEP\n");
bcm2835_delayMicroseconds(12);
fprintf(stdout , "LOW\n");
bcm2835_gpio_write(PIN, LOW);
fprintf(stdout , "SLEEP\n");
bcm2835_delayMicroseconds(12);

Do I miss anything when compiling the kernel?


Solution

  • I have just seen and remembered this thread. About half year ago, I want to generate 40khz from a Raspberry. But finally I found I am using the wrong tool. I believe Raspberry cannot handle such a task, since it is running an OS. I switched to Arduino, and the problem is solved immediately without any problem. Using the right tool for your task is very important!