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

No, that won't be possible. As such, ARM CPUs inside the Raspberry pi SoC are slaves to the videocore. They cannot even go out of reset until the videocore executes the right firmware which allows them to start. Broadcom may have proprietary debugger tools which interface the videocore and start ARM CPUs at will. Even if they exist, such tools are unlikely ...


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 ...


2

timedatectl will show if synced Local time: Tue 2019-11-19 09:59:09 AEDT Universal time: Mon 2019-11-18 22:59:09 UTC RTC time: n/a Time zone: Australia/Sydney (AEDT, +1100) System clock synchronized: yes NTP service: active RTC in local TZ: no /var/lib/systemd/timesync/clock ...


1

Baking Pi tutorials are outdated if you want to play on Raspberry pi 4 but "it's a free course on building a very simple operating system for the Raspberry Pi in assembly language", the author Liz Upton said. However, the "jsandler18's tutorial" which hosted on github - Building an Operating System for the Raspberry Pi might be helpful. You are ...


1

Since systemd 239 there is a systemd-time-wait-sync.service available that you can just use in your systemd service to start After=systemd-time-wait-sync.service. For further information look at How can I delay the startup of systemd services until the datetime is set (no RTC on the Raspberry Pi). Raspbian Buster comes with systemd 241. The problem is that ...


1

If you install ntpd instead of timesyncd, you can check out the first line of the output of ntpstat: $ ntpstat | head -n1 unsynchronised ... later on .. $ ntpstat | head -n1 synchronised to NTP server (10.5.26.10) at stratum 2 Inside a script or a C program, use the return code: ntpstat returns 0 if clock is synchronised. ntpstat returns 1 if clock is ...


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

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