Questions tagged [c]

For questions pertaining to compiling C programs on the Raspberry Pi.

Filter by
Sorted by
Tagged with
0
votes
2answers
36 views

WiFi packet sniffer for RPi in c++

We are currently working on a project, where we want to see the packets sent over WiFi. We are using an RPi zero w as a sniffer, and we have managed to use ioctl calls to get ssid and other ...
1
vote
1answer
35 views

Writing to GPIO 1 (ID_SC) witth Pigpiod C interface

I am writing a general-purpose stepper motor driver C shared library for the Raspberry Pi using PIGPIO (pigpiod C interface) for 4 to 7 motors using A4988 drivers. I designed an interface board (...
0
votes
0answers
19 views

C++ programming - Class for Motor rotation and control for washing machine embedded system device layer error?

#include <iostream> using namespace std; int main() { // declaring variables: int MotorControl; int MotorRotation; MotorControl = on; MotorControl = off; // process motor control and ...
2
votes
0answers
28 views

More than 2 SPI slaves

I like to connect more than two SPI slaves to the Raspberry. Just want help how to configure my Raspberry Pi Zero.
1
vote
0answers
23 views

If I want to program I2S by bit-setting the PCM registers manually, do I need to disable any kernel settings (eg snd_bcm2835)?

(I'm not with my board at the moment - if I need to share my code, I'll have to edit this post or post a new one at a later time) I didn't realize how complicated I2S setup on the Pi is. I've been ...
0
votes
0answers
42 views

Initializer element is not constant serialOpen WiringPi

I'm getting an error when trying to run some code on my raspberry pi. Here is the source code: /* SimpleReceive This sketch displays text strings received using VirtualWire Connect the Receiver data ...
1
vote
1answer
85 views

How to develop an own operating system for the raspberry pi 4 in c

I've seen the Baking Pi tutorials, but they seem to be outdated, because it says they haven't been updated for the pi 2 yet. Also, they only use assembly language, and I would like to use C instead. ...
0
votes
1answer
46 views

polling gpio raspberry 2 doesn't work

i'm writing a library for my raspberry pi 2 for gpio control. I'm trying to test a function for read a gpio driven by interrupts with sysfs but i can't do that my function stops in poll() function. ...
0
votes
0answers
28 views

GPCLK: my CLK_CTRL register has the right bit assignments, but my CLK_DIV register is wrong and my program keeps crashing

I can't figure out what about my code is wrong. I've been using the BCM2385 Manual (particularly pages 107 and 108) and this GPCLK guide. I'm using a Pi 3 Model B right now, so based on this it sounds ...
-1
votes
1answer
36 views

What if I flash the ARM processor with some random firmware

As Pi users, we know that our boards are driven by an ARM processor. We can find these processors in tons of devices such as routers, modems, cellphones etc. An ARM developer will use C language and ...
2
votes
3answers
95 views

How to know if time is synced?

I'm writing a software in C and it is running as a systemd service. I need the service to run after time has synced or alternatively, I need a way for my C program to identify if time has synced. I'm ...
0
votes
0answers
58 views

“Couldn't find matching render driver” error [LIBVLC][LIBSDL2][RPi3 B]

I am trying the simple libvlc demo with libsdl2 from LibVLC Sample Code SDL but I am having issues when running the compiled binary. I get a "Couldn't find matching render driver" error from ...
1
vote
1answer
47 views

Print the amount of vibration on the screen in C

I am able to detect a vibration when I am using 801s vibration sensor module sensor How to measure and print the amount of vibration level on the screen in C? I am checking now only state: HIGH and ...
1
vote
0answers
25 views

New to Pi I need to connect a device via serial communication, how do I teach myself?

I've been asked to connect and control a finger-sensing device to a Raspberry PI. There is a protocol to respect called OSDP. It supposes a serial connection on top of RS485. I'm a seasoned C/C++ ...
1
vote
0answers
92 views

Godex RT863i label printer - can't find drivers for ARM architecture

I have a Godex label printer, model RT863i. https://godexprinters.co.uk/desktop/rt863i I tried to connect with my Raspberry Pi 3B+, but it turned out to be complicated. On the Godex site I found a ...
3
votes
1answer
93 views

Pi locking up trying to use rising/falling edge detection

I have a B+ v1.2, with a motor controller and 2 quadrature encoders setup. It's running Arch: 4.19.69-2-ARCH armv6l. It's completely locking up, requiring a plug-pull when either of the encoders ...
1
vote
0answers
102 views

Strange segfault after several hours of running program

I created a program fairly closely related to hello_pi/hello_video.c. And for some reason after several hours of running the program I get these very strange segfaults that I cannot for the life of me ...
0
votes
1answer
271 views

Is default pwm frequency 19.2Mhz in raspberry 3+?

But when i set clock to 1920 and range 200, I got the frequency 5KHz rather than 50HZ from oscilloscope, does anyone explain that, what's the problem. Thanks my code as below: #include<stdio.h>...
-2
votes
1answer
74 views

How can I reproduce arduino's shiftOut( ) fonction on a raspberry pi 3+ in C langage?

Can someone help me to reproduce arduino's shiftOut( ) fonction on a raspberry pi 3+ in C langage? Preferably using bcm2835 library.
2
votes
2answers
545 views

What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals

I'm implementing a pascal library to deal with RPI3 peripherals. My goal is to control GPIO pins' functions, pins' logical levels, pins' pull resistors, I2C and PWM, at least. To achieve this I'm ...
2
votes
0answers
47 views

Waveform not cancelling out hardware PWM

I've run into problems using pigpio's wave generator in combination with hardware PWM. Currently I'm working on a motion control with acceleration/sustain/deceleration phases. The phases are saved ...
0
votes
1answer
583 views

How to create a master clock using a Raspberry Pi B+?

I'm trying to enable on an AD9833 (it's a DDS that can generate waves) using a Raspberry Pi 3 B+. I just want to know how to create a clock or master clock from the GPIO4 (GPCLK) of a Raspberry Pi B+...
0
votes
1answer
60 views

What does “ ad9833.c:36:2: warning: implicit declaration of function ‘bcm2835_gpio_fseL’ [-Wimplicit-function-declaration] ” mean?

I'm trying to generate signals using an AD9833 and a raspberry pi 3 model B+ but each time I build my programme I have this error message: ad9833.c:36:2: warning: implicit declaration of function ‘...
4
votes
1answer
381 views

AddressSanitizer on Raspbian

I am trying to use AddressSanitizer on Raspbian. I use the following to compile my program: gcc -fsanitize=address -fno-omit-frame-pointer -g prog.c -o prog Even for the simplest program (just a ...
1
vote
0answers
33 views

I want to know about printing NFC tag time out

I used libnfc and nfc-poll command. I get a UID and something else can I get a information about NFC tag time and print it out?
3
votes
1answer
889 views

Cross compiling for RPi - error while loading shared libraries

I'm trying to compile a simple program on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (...
1
vote
1answer
108 views

SPI sending function

I'm currently reworking a project from someone who graduated a few years back and I'm supposed to change the function of his work for a bit. I have trouble understanding these few lines from SPI ...
1
vote
3answers
620 views

Errors compiling C program with time.h library

I am facing some problems in my raspberry Pi 3 B+ when I compile this simple program that uses time library: #include <stdio.h> #include <time.h> int main(int argc, char** argv) { ...
0
votes
0answers
403 views

hcitool does not find devices despite GUI showing multiple

I'm trying to better understand C (and bluetooth) using a Raspberry Pi 3 b+ as the testing grounds. I started by writing a C program that uses BlueZ to scan for bluetooth devices (script pretty common ...
0
votes
2answers
150 views

Connecting multiple DHT11 sensors using WiringPi and C

For my internship I need to get measurements of multiple dht11 sensors and send them to a database using a REST API. I decided to go with WiringPi and C. I followed this tutorial: http://www....
0
votes
0answers
54 views

Converting C driver to NodeJS

I am looking for a bit of guidance. I am attempting to convert a Arduino LCD driver to nodejs. LCD:https://www.dfrobot.com/product-1737.html - spec PDF after bottom. I have researched I2C protocol, ...
0
votes
1answer
371 views

Programming Raspberry Pi Camera with C instead of terminal commands

Disclaimer: not so advanced here! Let me explain why I am looking for C code because the motivation itself maybe flawed. If I want to transport my Raspberry Pi project to the realm of customized ...
-1
votes
1answer
207 views

Pigpio Wiegand timeout

I have an RFID keypad linked to my Raspberry Pi. It sends out a Wiegand 26 signal when someone presses a key or presents a card/fob. The code is based on http://abyz.me.uk/rpi/pigpio/examples.html I ...
2
votes
1answer
155 views

Generating fast rise PWM signals using software GPIO

I want to use my Raspberry Pi 3 Model B (rev 1.2) as a source for fast rise PWM signal generation. The idea is to utilize RPi as part of a cheap TDR (time-domain reflectometry) setup. For anyone ...
1
vote
1answer
360 views

How to access to I2C software with wiringpi library-

I want to use I2C software instead hardware I2C. Because a buggy parto of the I2C related with clock stretching. I can enable in boot.txt adding this: dtoverlay=i2c-gpio,bus=3 It would create a /...
0
votes
1answer
71 views

RaspberryPi getting error after reading some serial Input, using rs232 and C Language

my raspberry keep getting error after reading some serial input, like this: i'm using Library wiringPi with this sample code: #include <stdio.h> #include <string.h> #include <errno.h&...
1
vote
1answer
188 views

Imprecise result after bitwise operation on GPIO registers

I am using a Raspberry Pi(Model 1 B+) and an oscilloscope in order to program SPI with C. I am doing this by using direct access to the GPIO register. Like this: https://elinux.org/...
-1
votes
1answer
977 views

Showing an image on HDMI (DSI, HDMI screens connected)

I have a Raspberry Pi 3B device connected to a LCD '7 (7 inches LCD, its a touch screen I believe that's called DSI not sure) and also a HDMI screen. By default Raspbian considers the LCD as the ...
0
votes
0answers
167 views

Can't find c library for libxml2

I am trying to compile a C program that uses libxml2, it compiles OK (so the C headers are present) but the link fails with the message cc test.o -llibxml2 -lm -o test /usr/bin/ld: cannot find -...
0
votes
1answer
74 views

Blink doesn't work (code in C)

I am newbie to Raspberry Pi. Here is the script I want to see work: #include <stdio.h> #include <wiringPi.h> #define LED 0 int main (void) { wiringPiSetupGpio() ; // also tried ...
-1
votes
2answers
131 views

C Interrput every rsing edge 100kHz

i've a 100kHz signal and i want to detect every rising edge. I'm using ISR but edge isn't detected and when detected it's 46µs after the edeg. How to do? [EDIT] Here's the code with pigpio library: ...
0
votes
1answer
577 views

How to run a C program at boot time [duplicate]

I have a project and it is running a c program on the PI. The program is meant to start running at startup. So far I have tried to do this with rclocal, but this is depricated. Afterwards I tried ...
0
votes
3answers
93 views

Pi freezes after softPwm

I'm building a robot car as a beginner project with a Raspberry Pi 3 Model B. It was easily possible to control the motors with help of the wiringPi library in C. To adjust the speed of my car I want ...
0
votes
0answers
212 views

How to read data from PIR sensor which is controlled by relay i2c?

There are my first steps with RPi and i2c. I use expander pcf8574 and I would like to drive a relay to control LED and PIR sensor. When the state on sensor is HIGH, LED should be turn on. I wrote a ...
0
votes
0answers
599 views

How could I write a C function using the wiringPi SPI library to read the X and Y measurements from this 2-axis inclinometer?

How would one use the wiringPi SPI library (http://wiringpi.com/reference/spi-library/) to get the x and y readings from this SCA100T inclinometer? I understand that the function wiringPiSPIDataRW() ...
0
votes
1answer
403 views

Interface AD7193 with Raspberry Pi

I have been trying to interface an ADC with raspberry Pi namely AD7193 via SPI . For that I have enabled my SPI and installed spidev on my pi. but i dont know what to do next in order to get the ...
1
vote
0answers
699 views

How to Read LDR Input with Raspberry Pi's GPIO Pins in C? [closed]

Using an LDR and the below circuit diagram, I am trying to read the amount of light that the LDR is receiving. My primary goal is to detect a change when an object passes over the LDR to trigger an ...
0
votes
1answer
312 views

AVFrame YUV420P to dispmanx VC_IMAGE_YUV420

I'm using ffmpeg for decoding a video with h264_mmal encoder. And all test videos are in YUV420P color encoding. Also I'm using dispmanx for drawing frames from a video. Only problem which I have is ...
0
votes
1answer
493 views

Cross-compiling with nfs-mount as sysroot fails due to absolute links

I want to cross-compile C++-applications for the raspi using the rpi-tools, CMake and a raspbian sysroot I'm exporting via nfs from a running raspi. My CMake-toolchain-file is OK, header-files and ...
0
votes
1answer
1k views

Playing audio in C?

Every audio engine I've tried (SoLoud, cAudio, openal-soft) hasn't worked on my pi zero. I just want to be able to play audio in a program without too much hassle. I can use a system call like system("...

1
2 3 4 5