All Questions
28 questions
0
votes
1
answer
81
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 ...
1
vote
1
answer
207
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 ...
4
votes
2
answers
890
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 ...
-1
votes
1
answer
378
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: ...
0
votes
2
answers
718
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 ...
0
votes
2
answers
403
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 ...
0
votes
4
answers
766
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 ...
0
votes
0
answers
112
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 ...
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 ...
0
votes
0
answers
217
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 ...
4
votes
2
answers
3k
views
Why use const variables instead of preprocessor directives when programming embedded with C++
I read on here that when programming with C++, const variables are better than preprocessor directives, ie #define, for declaring constants. I'm confused about why that is the case.
I understand that ...
0
votes
1
answer
396
views
Two stepper motors at different speeds using potentiometer and Arduino
I am trying to control two different motors using an Arduino and some drivers. The problem I have is that using millis() (I need to use a timer without ...
1
vote
1
answer
148
views
How do I give several classes access to the single RTC on my MCU
I'm writing my first large-ish C++ embedded program on a STM32F413. I've become a reasonably firm believer in object oriented coding but am not particularly knowledgeable. The STM32F413 has one RTC ...
2
votes
2
answers
1k
views
Interrupts using member function
I am trying to use a member function in an interrupt. The function uses member variables so I created a global instance of that class to use it in a static function.
The problem is that I created a ...
9
votes
6
answers
3k
views
Concept of the static keyword from the perspective of embedded C
static volatile unsigned char PORTB @ 0x06;
This is a line of code in a PIC microcontroller header file. The @ operator is ...
1
vote
1
answer
851
views
SAM Timer counter / atmel ASF
I'm trying to implement function call after having timeroverflow or comparison of counter registers.
Chip: SAM4E
...
1
vote
1
answer
858
views
Reading byte array in C++ [closed]
I have following code in C++
...
2
votes
2
answers
5k
views
Combine C and C++ in STM32 application development [closed]
Generally, developing embedded systems applications is based on abstraction. We expose some functions from lower layers that can be used in the application layer. My question is: Can I develop the ...
0
votes
2
answers
571
views
Map file analysis
I have been writing a software for an embedded controller in C++. I have noticed
that I have some problems with ram memory (I have probably run out of the
available memory). I have decided to inspect ...
-1
votes
1
answer
332
views
Understanding LED chaser code for PIC18F4550
I want to make a LED chaser from right to left in PIC18F4550 microcontroller. Here is a section of the code from a program which I am unable to understand:
...
1
vote
4
answers
484
views
What features of C++ lead to extra resource usage that I should be aware of when developing for an embedded system?
Some features of C++ have implied run-time cost or can lead to significant code size increases. Which features should I consider avoiding when developing for a bare-metal resource constrained ...
0
votes
2
answers
3k
views
Embedded Systems Programming using Java [closed]
Is Java good-to-learn-next language for an embedded software engineer who mainly develops firmwares and drivers? If not so useful, why?
Which language is more for that purpose, C++ or Java? I read on ...
0
votes
2
answers
772
views
Compiling C++ on EFM32 microcontrollers
I would like to use some high-level libraries written in C++ for my EFM32 microcontroller. Unfortunately the Simplicity Studio IDE for the EFM32 does not seem to support C++.
I am a bit confused ...
3
votes
0
answers
559
views
Using C++ in resource constrained environments [closed]
In the past I've been using C (or ASM) to develop microcontroller firmware. It's what I learned during my EE studies. It seems though, that the job market here has a high demand for C++ developers in ...
4
votes
1
answer
1k
views
New C++ (C++11) and embedded electronics
I wonder if the new C++ (which called C++11) works well with the embedded electronics and programming them. Do the new features fit well if working with uC? Like R-Values and so on? Or should be ...
6
votes
2
answers
427
views
How can I instruct my compiler to use 8 bit bytes instead of 16 bit integers?
I have the following code in my microcontroler program:
...
9
votes
1
answer
644
views
While loop optimized away
I have the following code in my microcontroler program:
// Wait for ADC conversion to complete
while ( ( ADCSRA && _BS( ADSC ) ) == _BS( ADSC ) ) {}
...
186
votes
16
answers
104k
views
Is C++ suitable for embedded systems?
A common question, here and elsewhere. Is C++ suitable for embedded systems?
Microcontrollers? RTOSes? Toasters? Embedded PCs?
Is OOP useful on microcontrollers?
Does C++ remove the programmer too ...