Questions tagged [c]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
21 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++ ...
0
votes
0answers
30 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
44 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
67 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
134 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
37 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
173 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
39 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
205 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
35 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
158 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
25 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
472 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
90 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
260 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
116 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
99 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
48 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
199 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
144 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
103 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 ...
0
votes
0answers
202 views

GPIO Open drain and open source setting while using the pin as input

I found this document. It says: Open Drain and Open Source Sometimes shared signals need to use "open drain" (where only the low signal level is actually driven), or "open source" (where ...
0
votes
0answers
39 views

Generating multiple square waves simultaneously

I'm trying to generate 2 simultaneous square waves (50% duty cycle PWM signals) to step two stepper motors (STEP signal to separate motor drivers) on the Raspberry Pi Zero W. I use GPIO12 and GPIO19, ...
1
vote
1answer
205 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
48 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
156 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
659 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
130 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
58 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
115 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
444 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
74 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
171 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
445 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
329 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
571 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
246 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
385 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
844 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
vote
1answer
3k views

Where is -lEGL -lGLESv2

I'm trying to install an OpenVG library, but when I start to make it I get the error. ... gcc -L/opt/vc/lib -lEGL -lGLESv2 -ljpeg -shared -o libshapes.so oglinit.o libshapes.o /usr/bin/ld: cannot ...
0
votes
1answer
496 views

Rotary encoder is giving less PPR reading

I am testing 400 PPR(Pulses Per Revolution) rotary encoder using code.I am rotating it by using the hand. I have connected Phase A and Phase B and also, ground and Vcc properly. The code is giving ...
2
votes
2answers
2k views

Size of serial port read size in c

I have a Raspberry Pi 3 and I'm currently use read(2) system call to read data from serial port. At this moment, I'm reading byte by byte from port with; rc = read(uart_fd, &byte, 1); I'm ...
3
votes
1answer
393 views

Does select/multithreading make sense when dealing with multiple DS18B20 and GPIO reads simultaneously?

As you may know, DS18B20 is not the quickest sensor and answers after around 750ms delay but, afaik, 1-wire is a relatively quick bus. I have multiple sensors connected to the board, which means if I ...
2
votes
1answer
514 views

How to run a persistent program at boot which prints to console?

I have program built for a drone project where my pi needs to start reading when the pi is booted up. I have substituted a simple C program instead call myloopprogram located at the root folder ~. It ...
1
vote
2answers
1k views

C library for controlling 16x16 ws2812b led matrix using Raspberry Pi

Where can I find a C/C++ library to control a 16x16 ws2812b led matrix using a Raspberry Pi? There exists a C code for Unicorn HAT HD here but the unicorn HAT HD uses four GPIO pins as data pins (pin ...
1
vote
0answers
4k views

PWM with wiringPi library and C in order to blink an LED at a given frequency

I am working with the wiringPi library with C on a Raspberry Pi 3 Model B and attempting to understand and develop a model so that I can predict the blinking behavior of an LED connected to GPIO #18, ...
1
vote
1answer
126 views

UART program on RPI 3 is not waiting for response

#include <stdio.h> // perror #include <sys/mman.h> // mmap #include <sys/types.h> // fd open #include <sys/stat.h> // fd open #include <fcntl.h> ...
1
vote
1answer
92 views

Magmatic sensor's error in MPU9150

I coded the following program to get the acceleration, gyro, and magnetic sensor values by using a MPU9150 that is connected to a Raspberry Pi 2 via I2C. I can get the proper acceleration and gyro ...
2
votes
1answer
541 views

Can GPIO mode be changed at once for more than one pin?

I'm currently trying to understand the pigpio library and I found it supports reading from and writing to more than one GPIO pin at once. However can it do the same with pin mode? I'm asking the ...
0
votes
1answer
258 views

Text overlay over video stream when saving to file system

I'am using raspberry pi zero as controller which communicate over UART with external board with five sensors. What I need is a way to save video stream from raspicam to filesystem with embedded text (...