Questions tagged [c]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
18 views

UART - wiringSerial.h vs standard Linux open/close

I'm making an application that uses the UART port from the 40pin headers and I found online that there's a library called wiringSerial.h I was wondering what's the difference between wiringSerial.h ...
1
vote
1answer
73 views

popen() vs netcat

I'm writing a RPi based surveillance solution that, among other things, starts video feeds on demand. In my very first attempt I wrote a pretty simple TCP server that listen for a connection collect ...
0
votes
1answer
42 views

Raspberry Pi 4 - BCM2835 Library - SPI1 - data mode 1

I use the BCM2835 library to communicate in SPI with an ADC. The SPI0 interface is already used by a touch screen (https://www.pi-shop.ch/pitft-plus-480x320-3-5-tft-touchscreen-fuer-raspberry-pi-model-...
0
votes
0answers
17 views

Can't get to toggle leds with WiringPi library in C

So I got my python code to run that basically just toggles the LED, but now I tried enabling the GPIO via WiringPi library in C but it doesn't work. Considering python code runs, there isn't really ...
0
votes
0answers
19 views

Graphing out the sensor data in a C-based application

So my setup basically includes STM32 as an MCU to which a temperature sensor and an nrfl2401 radio module are hooked. On the receiving end, I am thinking of having a Raspberry pi as an MCU hooked to ...
0
votes
2answers
272 views

How can Rpi change Neo-6M GPS update rates?

Hi i'm tryng to change the update rate of my gps tracker(neo 6m ublok) i know the byte that i need to send are 0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A i've tried echo -e &...
0
votes
0answers
20 views

I2C (and SPI) - Byte-by-byte

I would like to read multiple bytes from an I2C device but only one byte at a time. For example, to read 10 bytes from an I2C real time clock I would issue a single read command (send device code ...
0
votes
0answers
20 views

How to prevent libvlc from opening a new window for every mp4 in playlist?

My requirement is that a list of mp4 files play sequentially in the same window. The aim is to produce a simple animated face, specific characteristics being added programmatically to the list. ...
0
votes
1answer
18 views

code gets stock in keypad function

i am doing this project where i want to put a keypad and take in password from a user and then open the door or not. i used C but every time i call the keypad function in my code the code will not ...
0
votes
1answer
21 views

Can't compile i2c_smbus_write_byte on Raspberry Pi 4

Has anybody tried using the i2c_smbus_write_byte or any similar function on Raspberry Pi 4? I can't get it compile it fails at the linking with not finding it. I'm using it as described here: http://...
0
votes
0answers
36 views

Cannot get the exact wireless protocol at a raspberrypi 4b using header wireless.h

I've created a programm in C that runs on raspberry pi4B in order to get the wifi protocol that is supported. The version of raspbian is : Distributor ID: Raspbian Description: Raspbian GNU/Linux ...
0
votes
1answer
37 views

I want to mmap the GPIO on Raspberry Pi 4b+ but get invalid argument. (Running Raspbian Buster)

// The c code shown here works: int fd = open("/dev/gpiomem", O_FLAGS); printf("fd = %d\n", fd); long int* addr = mmap(0, 0x1000, PROT_RDWR, ...
2
votes
1answer
58 views

How to write 16 bit data to device address using the i2c wiringpi lib

I am trying to write 16 bit data to i2c device . As there are no registers specified to write to the slave device, I am not able to use the built-in wiringPiI2CWriteReg16 Api. Can some one guide me ...
0
votes
1answer
48 views

Program won't continuously read a value from a function

I'm in the midst of a school project and having trouble with reading ADC values from an MCP3004. I have it done in two different ways but one of them won't work. Using wiringPi.h and mcp3004.h, all ...
0
votes
2answers
215 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
45 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
22 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
32 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
25 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
57 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
155 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
95 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
36 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
40 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
206 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
72 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
49 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
110 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
139 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
125 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
347 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
98 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
863 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
53 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
738 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
69 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
588 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
35 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
1k 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
118 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
864 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
503 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
187 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
57 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
510 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 ...
0
votes
1answer
235 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
191 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
450 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
76 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
2 3 4 5