Skip to main content

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
1 answer
72 views

Reading multiple push-button switches on a raspberry pi using an mcp23017 over C++

Having followed various tutorials on the web (i.e. 1,2), I have made the following connections: To enhance clarity, I post another picture depicting the connections on the mpc23017 using a cropped ...
cestpasmoi's user avatar
0 votes
1 answer
31 views

Remapping PD1 to be a GPIO STM32Duino

I would like to remap the PD1 PD1-OSC_OUT pin on the STM32F103C8 running arduino framework. Originally on bluepill these pins ...
ManeGote's user avatar
0 votes
1 answer
50 views

Programmer is not responding error

I currently am running into problems with my new Arduino board. The complete details are here with log info and other troubleshooting steps https://forum.arduino.cc/t/programmer-is-not-responding-...
Jason Crosby's user avatar
0 votes
1 answer
73 views

Why are GPIO Expander Registers Being Rewritten?

I'm using an LPC1768 microcontroller (mbed) and 4 GPIO expanders (MCP23017). I am trying to write to the expanders to enable the pull up resistors and some other functions, but am getting strange ...
Nate.Olson's user avatar
0 votes
1 answer
91 views

Fake content in serialized array

I have network structures and a container structure (nvs) that holds the number of networks and a pointer chain for each network. I would like to serialize this container and then store it in Non ...
Franziee's user avatar
  • 101
0 votes
0 answers
159 views

How do I control the brightness of a TFT LCD through SPI (No Backlight Pin)

I recently purchased a TFT LCD (GMT020-02 VER1.1) The screen uses the ST7789V LED Driver and does not include a backlight control pin, So Originally I though that it was impossible to control it (i.e ...
Trippy 741's user avatar
0 votes
0 answers
70 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
177 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 ...
user avatar
1 vote
2 answers
279 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
51 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
149 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
230 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 ...
lucenzo97's user avatar
  • 2,442
0 votes
0 answers
145 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
782 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
2 votes
2 answers
371 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
2 answers
142 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
202 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
152 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
120 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
2 votes
2 answers
166 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
423 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
  • 473
0 votes
3 answers
433 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
8 votes
1 answer
688 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
  • 349
4 votes
2 answers
858 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
111 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
314 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,062
2 votes
0 answers
331 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
  • 783
1 vote
0 answers
1k 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
55 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
384 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
73 views

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

I coded this: ...
KaffeMitMilf's user avatar
5 votes
1 answer
129 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
737 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
429 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
520 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
431 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
351 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
622 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
181 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
355 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
721 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
111 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
209 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
494 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
15 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
  • 904

1
2 3 4 5