Questions tagged [c++]

C++ is a compiled general-purpose programming language that adds object-oriented features and other enhancements to the C language, which it is largely a superset of. It is popular for both embedded and PC software development.

Filter by
Sorted by
Tagged with
0 votes
0 answers
44 views

Losing external EEPROM data after power Cycles on ESP32

Sending "1" starts the write operation into the eeprom every 1 second to the next available address, and sending "2" starts reading the written values into the eeprom. When there's ...
walid Bmd's user avatar
1 vote
1 answer
100 views

Input capture and timers

Microcontroller: STM32F401RE Doing input capture on TIM1's channel 1,2,3,4. ARR register value is 65536. The clock is 8Mhz. The 4 input capture channels are connected to 4 microphones. As soon as a ...
rachit juthani's user avatar
1 vote
2 answers
239 views

Can you deliberately damage RAM using pointers?

Can one deliberately cause physical damage to RAM using C++ and its implementation of pointers? What about segmentation faults? Can they cause any damage? Example: trying to access a non-existent ...
ben's user avatar
  • 13
0 votes
1 answer
40 views

Can I write and read a parallel EEPROM content with Analog Discovery 2?

I am wondering if I can read or write the contents of a parallel EEPROM (e.g., 28C64) using Analog Discovery 2. Is C/C++ necessary for this purpose, or is Java sufficient (since AD2 allows scripting ...
Jerzy Przezdziecki's user avatar
0 votes
2 answers
141 views

Planning a University Course: Advantages of modern MCU platforms [closed]

I want to get sincere advice regarding the use of microcontrollers in educational institutes. I am an Engineer at a University in India. We have been using PIC microcontrollers (PIC16 and PIC18) for ...
Zerox's user avatar
  • 33
0 votes
0 answers
116 views

Printf retarget on STM32 with CubeMX

I'm using STM32F7xx for my project where I use VS Code text editor in combination with CMake project build. I also use CubeMX for code generation. For a record I have already examined all the answers ...
MucaGinger's user avatar
  • 2,370
0 votes
0 answers
106 views

Array not initialized properly in STM32Cube IDE

I have a function conv 2D , that takes in 4D and 1D vectors as inputs (inputs, weights,outputs and biases) along with size parameters which are int (filter height, width etc). The function directly ...
satan 29's user avatar
  • 189
0 votes
2 answers
196 views

Error with arduinoFFT library

I'm trying to use the arduinoFFT library (https://github.com/kosme/arduinoFFT) with my ESP32. I made a basic program just to see if the FFT is done correctly. The problem is that I can't compile the ...
C_Cruz's user avatar
  • 1
1 vote
2 answers
119 views

Load bootloader on ESP32

I'm trying to load the bootloader to my esp32 or that's what I think I need, because when I connect it with USB to TTL, and I connect TX with RX, Rx with TX and GND with GND and I reset the micro by ...
Maxpower5859's user avatar
0 votes
0 answers
86 views

Pixel offset in image from FLIR Lepton 3.5 VoSPI

I´m working on my driver for a FLIR Lepton 3.5 thermal imaging sensor attached to an ESP32-S3I want to display the image on an LCD, but the image contains line offsets. I use the following settings ...
Kampi's user avatar
  • 422
0 votes
2 answers
104 views

Can I capture keypad values with an analog pin?

I am building a calculator with an Arduino Uno. The thing is I ran out of pins. The switch membrane has 4 rows and 4 columns resulting in 8 pins it doesn't fit. That is why I plan to do a shift ...
Akko's user avatar
  • 3
2 votes
1 answer
168 views

GP2Y0A21YK0F Sharp IR sensor not counting below a certain distance threshold

I'm building a self-navigating robot that uses IR sensor (GP2Y0A21YK0F model) with Arduino to navigate through a terrain, however during testing phase when I put my hand closer than 7cm it bugs and ...
melonade's user avatar
1 vote
1 answer
124 views

avr-gcc optimization deleting register writes on ATTiny402

I'm using avr-gcc (12.1.0, built with this script: https://github.com/ZakKemble/avr-gcc-build) to compile for the ATtiny402 and encountering problems with code optimization. Specifically, the compiler ...
andy28's user avatar
  • 13
1 vote
1 answer
77 views

arm-none-eabi-g++ can't find cc1plus unless run from gdb?

I am trying to port some simple c++ code to armv7e-m. I have experience compiling c++ for arm but this is my first time setting up the toolchain from scratch. Initially, I was having the following ...
Aaron Linnell's user avatar
0 votes
0 answers
48 views

Pico's I2C blocking 1ms

I am using Raspberry pi pico on Arduino ide. I am using Earle's I2C library here . I want to collect microphone data in analog and adxl345 data. I want to write these datas on sd card. So I wrote a ...
Tryingtogetsome's user avatar
0 votes
0 answers
65 views

ESP32 SCCB communication via I2C peripheral

I've been working on developing some drivers for the OV7725 camera to communicate with the ESP32-WROOM processor. Here's the context of what I'm looking for. I have an operating system that uses a ...
Ahab Devoid's user avatar
2 votes
2 answers
130 views

SPI data format for daisy-chained AD5207 digital potentiometer control

I am working on a project using two daisy-chained AD5207 digital potentiometer ICs controlled by the SPI interface of an STM32 micro. I'm following the directions given on P.9 of the AD5207 datasheet, ...
Emmett Palaima's user avatar
0 votes
1 answer
199 views

Saving a memory address in a variable

If I initialize a variable (in the SRAM), can it happen that its location/position in memory changes each time I simulate or add other variables to the program? Or will it always remain in that ...
KaleM's user avatar
  • 401
0 votes
0 answers
51 views

Why is fread in Vitis HLS reading a bitmap file wrong?

I have a test bench for a Sobel filter in Vitis HLS. This test bench is reading an image via ...
Kampi's user avatar
  • 422
0 votes
3 answers
295 views

Phased Array Antenna simulation coding

I have already coded the phased array antenna radiation pattern for my university project with Matlab. I will probably do this again for my master's thesis (phased array patch antenna). Is there any ...
YIL's user avatar
  • 3
7 votes
1 answer
650 views

Program never goes into interrupt

I used to work with C but I am trying to learn using C++ for embedded programming. I want to do a basic GPIO interrupt example to understand the structure of a class and its usage. My microcontroller ...
Bowman's user avatar
  • 309
4 votes
2 answers
784 views

Embedded C++ and multiple copies of same structure

In embedded programming it is my understanding that we do not use dynamic memory allocation since we are working with a fixed-resources system and the code needs to be compiled for worst case memory ...
Steve4879's user avatar
0 votes
1 answer
35 views

How to code process_state variable which reruns each time process commences?

I am making a bottle filling machine. I am using the YF-S201 water flow sensor to do the same and a 600ltr/min pump. While according to the sensor datasheet I should get the 750ml at 369 pulses, but ...
tiktok's user avatar
  • 127
-2 votes
2 answers
110 views

Drivers in C++ produces bigger assembly [closed]

I'm trying to figure out whether C++ is a suitable language for use in device drivers, like peripherals on Cortex-M3/M4. I started writing some drivers for GPIO and I noticed that it produces bigger ...
blinkbetter's user avatar
1 vote
4 answers
226 views

How to make water flow sensor work to measure flowed water and not flow rate

I am using the YF-S201 water flow sensor. I am using this to fill up bottles. I need to know how to alter the below code in a way that instead of measuring flow rate it measures water passed through. <...
tiktok's user avatar
  • 127
7 votes
2 answers
2k views

What does a function mean that doesn't have "void", "int", etc in front of it mean?

I am following a programming build in Arduino and I came across this code here: ...
Trev347's user avatar
  • 1,032
2 votes
0 answers
255 views

Reading 2 digit 7 segments with ESP32 using TM1650 maybe?

I have been trying to contact a forum member that has done a modification to his pool equipment in order to control it remotely instead of having to go to the box every time and check on the codes. ...
StealthRT's user avatar
  • 731
1 vote
0 answers
901 views

Set brightness of flash lamp/LED with an ESP32

This sketch is to turn on and turn off an LED flash (torch) on board ESP32S camera periodically ...
Muhammad Ikhwan Perwira's user avatar
-1 votes
3 answers
3k views

I have an error saying: expected unqualified-id before 'if'

...
user avatar
0 votes
1 answer
49 views

vivado HLS or SDsoc for use openCV

I want to do an image processing by openCV on FPGA . But I do not know if I should use the SDsoc method or the vivadoHLS method. The size of the images I am going to process is large and I want to ...
tom's user avatar
  • 1
0 votes
3 answers
236 views

Saltwater Measurement via Arduino

This is a strange question, but I'm trying to learn specific uses for all of the Arduino functionalities. If I were to program the Arduino to spit back the result of analog input into serial as seen ...
sprx2's user avatar
  • 1
1 vote
0 answers
70 views

ESP8266 D1 mini pro/ Arduino IOT, no function is getting called

I coded this: ...
KaffeMitMilf's user avatar
5 votes
1 answer
102 views

Is LTC2485 Arduino library missing information?

I'm using LTC2485 and got confused by the provided software code vs. the datasheet. As described in LTC2485 I2C Data Format the LTC2485 ADC is 24 bits + sign ADC so like 25 bits. In the given software ...
ThomLB's user avatar
  • 51
-5 votes
1 answer
552 views

Polling a button and delaying/switching based on the input. Millis? Delay and loop counter? [closed]

So this is the setup: I previously asked a question about this assignment. THIS IS A NEW QUESTION. THIS IS NEW CODE. ONLY THE IMAGES ARE THE SAME. I originally approached this using an interrupt on ...
EmptyAtoms's user avatar
-1 votes
2 answers
379 views

Why is my interrupt so slow/inconsistent? Arduino external interrupt as pedestrian crossing button

So this is the setup; It's a traffic light system with 2 road lights and a pedestrian crossing. The normal sequence is alternating between main road green and secondary road green. It reads these ...
EmptyAtoms's user avatar
3 votes
2 answers
449 views

Detecting the push button outside the loop function in Arduino

I'm new to Arduinos. I made a simple digital clock with an Arduino, a 2 x 16 LCD, and two push buttons to control the digits in the clock, one on the digital pin 10 to increase the digits of the ...
Ahmed Redwan's user avatar
0 votes
0 answers
1k views

Raspberry Pi Pico: Hardware UART Tx not working

I recently got a Raspberry Pi Pico as an evaluation board for the RP2040. When I tried to use hardware UART, I found that it would not send data. To find out what was going on, I used an LED on the Tx ...
A Person's user avatar
-1 votes
1 answer
350 views

How to repeat a task every X ms on STM32F303VCT6 (C++) using timers/interrupts?

My aim is to do the following: 1- Repeat a task every 250ms and when the button is pressed the task is repeated every 500ms, and if the button is pressed again go back to every 250ms. 2- I plan on ...
Electrical_engineer_student's user avatar
-1 votes
1 answer
279 views

Error: Definition of nested anonymous union in packed "" must be __packed

I'm using the ARM DS-5 with the ARM 5 Compiler Toolchain. I'm attempting to use the "mavlink_types.h" (link: https://github.com/mavlink/c_library_v1). However, I've got an error said that: ...
LowK's user avatar
  • 27
0 votes
2 answers
478 views

Embedded C++ save and restore data

I am working on an embedded C++ project. I am dealing with complex and dynamic objects with lots of objects pointing to one another. I need to store and recall these objects to non-volatile memory. In ...
Tim Ressel's user avatar
0 votes
1 answer
145 views

NVM Region not unlocking on SAML21 Flash memory

I am trying to write to a specific address on my SAMR34 which uses SAML21. However, I noticed that despite first erasing the row te address is located in, the data was not being written. So I checked ...
Vincent Kenbeek's user avatar
0 votes
2 answers
280 views

How to load an executable program on an STM32F401 without using an online compiler?

I am a newbie to embedded system. I decided to buy an STM32 board to get started. The problem now is that I would like to know if there is a simple way to write some C++ code in a simple text file ...
RIXS's user avatar
  • 1
0 votes
4 answers
603 views

Handling two interrupts occurring at the same time for different producers

So I have a UART IRQ handler that is fired for each byte sent over UART, which then writes to a Fifo buffer and once the end of the data is detected, a callback is invoked which parses the data and ...
Jazzy's user avatar
  • 137
0 votes
0 answers
105 views

Making sense of an architecture for a FreeRTOS based application

This is more of an architectural design question and any suggestions shall be appreciated. So far, a general idea is that there's a system thread that's like a central task that decides how to ...
Jazzy's user avatar
  • 137
0 votes
0 answers
54 views

Object's members' values change as soon as interrupt is fired

I have a UART class that has instances of Fifo. What I notice is as soon as the UART IRQ handler is fired, the member variables of ...
Jazzy's user avatar
  • 137
0 votes
0 answers
189 views

Interrupt handler starts behaving unexpectedly when scheduler runs

I have an IRQ handler that gets fired upon receiving a character over serial, and everything is fine until I run a FreeRTOS scheduler inside main, and now what I see is IRQ handler still getting ...
Jazzy's user avatar
  • 137
1 vote
0 answers
441 views

How to convert raw ADC value into voltage in volts in software?

Let's say I have a microcontroller with an ADC and my goal is to measure instantaneous values of the line to line voltage of the three phase grid 400 V/50 Hz. I have a voltage instrument transformer ...
Professor Jimatura's user avatar
14 votes
3 answers
1k views

Avr-gcc using repeated addition instead of MULU instructions

I recently compiled some C++ code for the ATmega1284P in Atmel Studio and was analyzing the timings of some routines using my scope. To my surprise, a loop I thought I had optimized was taking longer ...
Hackstaar's user avatar
  • 886
1 vote
1 answer
91 views

mush instead of signal stm32 nucleo-l053r8

Generating a triangular signal. The "printf" line is commented out. If the "printf" line is uncommented, instead of a signal, mush. How to fix it? (stm32 nucleo-l053r8) ...
at0m's user avatar
  • 11
1 vote
1 answer
128 views

My itoa (c++)conversion has a problem

I am receiving a string of data via UART in PIC32, extracting and concatenating two of its bytes, dividing the result by 2, converting the resulting integer to a string and transmitting via i2c to ...
Ahmed's user avatar
  • 171

1
2 3 4 5