We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

4

This type of "clock" support isn't C99 but POSIX. Try removing -std=c99 from your compilation command and compile your code. If that doesn't work, Add #define _POSIX_C_SOURCE 199309L to your code and compile it. Refer this man page for more details. Reference


4

Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI. This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run ...


3

The Raspberry Pi does not have any analog input PINs. Thus you will not be able to interpret analog input signals without some additional hardware. In order to be able to read not only HIGH or LOW levels from your sensor, you need to use an analog-to-digital converter (ADC), e.g. in the form of a ADC-HAT extension for the Rasperry Pi. Then you can connect ...


3

Solution: Add: dtoverlay=gpio-no-irq to /boot/config.txt. Previously the kernel would automatically disable interrupts when you set one of rising/falling edge detection methods but that apparently stopped happening, causing a kernel panic. See this post for more details.


2

The error generally means that you have called a function that does not have a prototype. In this case I think you mistyped the function, capitalizing the 'L' where you should have lower case 'l'. Note the difference between the one that you commented out and the ones that follow, copying from your code in the question: //bcm2835_gpio_fsel(uint8_t pin, ...


2

Basically libasan can not guarantee correct work if it's not the first loaded library (which is e.g. the case when /etc/ld.so.preload is not empty). There were several cases when preloaded libraries caused Asan misbehaviors and this check -- ==1966==ASan runtime does not come first in initial library list; you should either link runtime to your application ...


2

You need to refer to the BCM2835 ARM Peripherals document. It specifies many of the Pi's hardware interfaces. In this case SPI appears to be the main SPI device documented from page 148. *ptr = (3<<4) | (1<<7); // 1 *(ptr +SPI_FIFO) = udata2>>8; // 2 *(ptr +SPI_FIFO) = udata2; // 3 while (!(*ptr & (1 <&...


2

The crystal oscillator is 19.2 MHz on all Pi models earlier than the Pi4B. The Pi4B is based on the new BCM2711 which has a 54 MHz oscillator. It is likely that all future BCM2711 based Pis will also be 54 MHz. Don't use balanced PWM if you want a particular frequency, use mark space. Balanced will try to achieve the desired duty cycle as "smoothly" as ...


1

/dev/gpiomem only gives access to the GPIO register addresses. To gain access to the PWM registers you need to use /dev/mem which requires root access. If you try to access hardware PWM with wiringPi you need to be running as root. If you run the program without being root it will crash. Have a look at Minimal GPIO Access for an example of accessing the ...


1

Short answer. As per the man pages for clock_gettime you probably need to set a minimum value for _POSIX_C_SOURCE in your code: #define _POSIX_C_SOURCE 200809L #include <stdio.h> #include <time.h> int main( int argc, char** argv ) { struct timespec now; clock_gettime( CLOCK_REALTIME, &now ); printf( "Nsecs %d \n", now.tv_nsec )...


1

Change the code so that DHTPIN is a parameter rather than a constant. Call the code for each DHT11 passing the GPIO number as the parameter.


1

The base memory address of the hardware peripherals changed between the earlier and later Pi models (to accommodate the extra memory). The early models (ARMv6) use 0x20000000. The later models (ARMv7/ARMv8) use 0x3f000000.


1

I got 2D vector graphics library working, using it from C Language, currently with a 128x128 OLED display on a headless Raspberry Pi 3B, using the following recipe. Note: X-Windows (X11) is not installed (e.g. Raspian lite edition). As for performance considerations, OpenVG's claim to fame is that it utilizes available HW acceleration layer(s) rather than ...


1

On recent versions of Raspbian, you can use a cron job for this. Run crontab -e and select your favorite editor when prompted, then add the following to the bottom of the file: @reboot /path/to/executable


Only top voted, non community-wiki answers of a minimum length are eligible