Questions tagged [c]

C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language. from http://en.wikipedia.org/wiki/C_(programming_language)

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Live variable view using openOCD and VScode

I really like using VScode + cortex debug extension + openOCD over Keil or Eclipse in embedded projects. Although i wasn't able to figure out how to set up live variable view, which you can set up ...
8
votes
2answers
730 views

PIC12F675 GP4 doesn't work

I'm using a PIC12F675 for a project, and everything works fine except one thing. GP4 does not work as digital IO. I've looked at the configs and the code a lot, but couldn't find anything. Config: <...
1
vote
2answers
91 views

Assigning a 16 bit number to two bytes of a buffer

Currently I have this out buffer that I am assigning values to like this: ...
1
vote
1answer
55 views

serial monitor error/crash

After typing C, microcontroller responds with # Next, I type k, microcontroller responds with #INFO: TWI master enabled Next, I type !, microcontroller responds with C after typing in the next ...
2
votes
1answer
44 views

PIC12F675 ADC not working properly

I wrote a code that takes an analog input from a potentiometer and controls the frequency of a clock pulse. So, the idea is to increase the frequency when I increase the pot and decrease the frequency ...
-1
votes
0answers
30 views

MSP432 write data to serial port using CCS

I am trying to to write data to the serial port COM5 but i am not sure how to do it. Using energia/ardunio IDE you could easily type in: Serial.print("EXAMPLE") ...
-1
votes
2answers
41 views

Converting signed hex integer to display negative decimal integer on terminal in C code

I am trying to take a signed hex number and display it on the terminal as a negative decimal number so that it can be easily read. I am having a hard time working through the logic on how to make this ...
0
votes
0answers
40 views

Error executing Application from BootLoader in STM32L475 (IoT Board)

The bootloader should jump to the Application after some verification. For now lets assume it straightaway jumps there. I am working on B-L475E-IOT01A2 device, which uses ARM M4 Cortex. I am using ...
6
votes
6answers
2k 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
votes
2answers
64 views

Why polling works rather than interrupts [closed]

I have several devices like for example connecting with ESP8266. I have tried to use the SPI with it with STM32F4. First I have tried to work with SPI interrupts, the result of the communication is ...
-1
votes
0answers
28 views

Different battery measurement value with power USB cable/Battery with ESP32

I'm doing IOT project and need measure battery voltage. Using lipo battery 4.2v Max. run voltage divider 100k-->measure here-->27k-->Ground. ~097v at measure point. then i use internal 1.1v reference ...
1
vote
0answers
88 views

Programming PIC12F675: Not Working Properly

I'm new to embedded systems and I want to program a PIC12F675 for a project. So, the idea is that there is a switch. If the switch is off, the microcontroller normally outputs a clock signal, which ...
5
votes
3answers
1k views

Implementing an absolute value function in C

I am implementing a function to find the absolute value like this: uint16_t absolute_value(int16_t n) { int16_t mask = n >> 15; return ((n+mask)^mask); } ...
2
votes
1answer
82 views

Using Pointers to implement a filter

I'm trying implement a fairy basic filter, and right now I have just some simple test code for me to enter in values. It errors out on the line when it gets to where I call the function I have written....
1
vote
1answer
45 views

Lighting up LEDS via I2C Bus of a NeoTrellis 4x4 RGB Led Matrix

Many attempts to write to an i2c slave to make rgb leds light up have failed. The hardware in question is found at: https://learn.adafruit.com/adafruit-neotrellis There is an arduino library and a ...
-1
votes
2answers
127 views

STM32F4 series: what does the '->' operator? [closed]

Reading some C files related to programming an STM32F4 series Arm controller, I found the following instruction: ...
1
vote
2answers
46 views

How to put a breakpoint to after last line of a loop in GDB?

Consider the following loop: ...
0
votes
0answers
24 views

How to include new path in compiling qmk project

I have a running qmk project. I have used msys2 to produce the .hex file.Now I am trying to add MIDI functionality . when i add library folders such as MIDI . when I add include "midi.h" inside a ...
2
votes
1answer
42 views

How to include paths for the C compiler in atmel studio?

I have a folder project and it consists of multiple folder and .c and .h files what is the best way to include them all without including the individual folders?
2
votes
2answers
48 views

Problem in Clock Gating Control with ARM Tiva C

When I access a peripheral register (such as a GPIO port) just after enabling the clock gating of the peripheral, a hard fault happens. For example: This code doesn't work (generates a hard fault): <...
0
votes
2answers
28 views

How can Qsys component configuration be accessed in software?

I'm designing a Qsys component which I want to be user-configurable. It has config parameters which are defined in the TCL file. For example, for a GPIO bank component I would write: ...
3
votes
1answer
128 views

Compiler optimization prevents code from running

I was trying to upload a simple code to my board Tiva C EK-TM4C123GXL but it didn't work. I found out that when I turn the optimizer off, the code works fine. This is the code for blinking the on-...
0
votes
1answer
86 views

Embedded Software Reliability Metric is short-term or long-term in time

If I test an embedded software (and the product based on this software) today and it fulfills all the customer requirements successfully at this point in time then I can safely say that this software ...
2
votes
2answers
63 views

Persistent RAM variables in NIOS II

I would like to define a C variable in RAM which can survive a CPU reset in NIOS II IDE. Something like __persistent in PIC world or ...
0
votes
1answer
43 views

JSON for GSM Comm on STM32

I am making a remote monitoring system using STM32F1 MCU in which there are few digital and analog sensors attached and I would send their readings to a remote server periodically. Can I use JSON ...
2
votes
3answers
157 views

Bare minimum FreeRTOS

My only requirement is time triggered cooperative scheduler. I heard they are more reliable and predictable. If I want to use only the 'cooperative scheduler' of FreeRTOS for STM32F103 then is it ...
0
votes
1answer
37 views

Tasks inside Interrupt Handler

Is there any schedular that exists for STM32F103 in which the 'tasks' are run at the ISR() level while the Schedular() code runs in the main() thread?
0
votes
1answer
46 views

Blocking code in Task of FreeRTOS

Today is my first day on FreeRTOS. I want to use it in STM32F103 for simple task handling as reading data from analog sensor and sending remotely using GSM module. I want to know what are the do's ...
1
vote
0answers
50 views

How to properly implement I2C communication between two or more STM32s?

I have a master board with STM32F030R8 and two daughter boards with STM32F030C6. The objective is to communicate parameters between the boards periodically and also on-demand. With some effort I ...
0
votes
1answer
73 views

Storing values in the internal flash memory

I want to reserve a space in the internal flash memory of my microcontroller (STM32L4) to store the latest 100 measured values by a sensor (in a circular FIFO Fashion) and be able to load them again ...
0
votes
3answers
122 views

PIC understanding the sign of the integer that is in the register

I am getting current data from CANBus, they send me the value as a signed number. The problem is even if the number is supposed to be negative if(current<0) is ...
11
votes
3answers
1k views

Variable declaration with @ in C

I am reading some C code and came across this declaration in the program: unsigned char serv_ctr @0x0002; Can someone point me to documentation, or explain what ...
2
votes
0answers
51 views

Address Sent bit is not set on STM32F4 Disco

I am trying to interface my STM32F4 Discovery board with a sensor that works over i2c, since the sensor required a specialized i2c protocol, I decided to implement my functions using registers. But ...
2
votes
1answer
65 views

gcc __attribute__ section not working?

I'm working on a Zynq Ultrascale+ MPSoC and trying to play around with the on and off chip memories. In the following program, I'm trying to place only variable 'x' into OCM (on-chip-memory) where ...
-1
votes
1answer
56 views

LPC1768 - Green LED when LDR sees light, Red LED when LDR is covered

I have been trying to achieve a task I am working on and I believe I am almost there. It successfully changes colors whenever I cover it but when it does, the red LED keeps blinking instead of it ...
0
votes
2answers
93 views

Post build flashing of configuration data in embedded systems

I need to implement a mechanism by which I should be able to update the configuration data of some of the modules in a post-build fashion. To describe, consider I have the following files: ...
1
vote
2answers
129 views

STM32F7 device freeze: cannot access registers

I am encountering random freezes with the STM32F7. This issue is difficult to debug as any debug session launched in Eclipse crashes when trying to halt the core, which makes it impossible to see ...
0
votes
1answer
52 views

Configuring ADC on Nucleo-F401RE in Arduino IDE gives erratic values for input freq greater than 100Hz

I want to configure ADC on STM32(Nucleo-F401RE) using Arduino IDE and transmit the values through SPI to Basys 3 FPGA(End Goal). The ADC works for input signal frequency only below 100Hz. How do I ...
0
votes
1answer
71 views

Serial port reading: data format unclear

I am trying to read serial data from this OEM barcode scanner module: https://www.barcodescannermodule.com/sale-11330019-lv3085-mini-barcode-scanner-module-usb-ttl232-interface-for-pdas-tablets.html ...
0
votes
0answers
41 views

Cannot Disable AVR ATmega32 Watchdog

I'm writing a code to enable and disable the watchdog timer in ATmega32. I'm using the function in the datasheet that disables the wdt. Also, I'm toggling led in the beginning of the code to know if ...
0
votes
1answer
62 views

Where to begin with programming an audio interface driver?

I'm designing my own mic/line preamp (the analog portions) and would like to have it interface with a computer in a send-return fashion as well (like any typical audio interface). I've noticed that ...
0
votes
0answers
33 views

Not getting reading back from HC-SR04 with PIC18F45k50 MCU

Hello I'm trying to measure the distance with HC-SRO4 ultrasound sensor PIC18F45k50 micro-controller however, I'm not reading any value on the LCD screen. Here is the following code that I have ...
0
votes
1answer
69 views

STM32 interrupt from Matlab Code

I'm using the STM32 MAT plugin and embedded coder for Simulink to generate C-Code out of my models to compile them onto an STM32F4. As IDE I use TrueStudio and for my MCU Configuration I use CubeMX. ...
2
votes
6answers
212 views

Memory allocation in embedded software development

In embedded systems, the use of dynamic allocation is strongly discouraged. MISRA C do not allow using malloc and calloc because of their unexpected behaviour. My question is: How do you handle memory ...
3
votes
3answers
1k views

PIC mathematical operations weird problem

I am trying to display the voltage value on my specific GPIO pin. I use PIC18F26K83. I can read ADC value. ( I tested it and it gives correct results.) ADC_read() ...
1
vote
0answers
38 views

Go from LPRUN mode to RTC standby in Nucleo L053R8

I want a Nucleo L053R8 to be in standby mode for some time and then wake up to enter low power run mode, execute a routine, and then exit low power mode and go back to standby again. For that, I have ...
1
vote
1answer
72 views

PIC16F884 keeps resetting even though WDT should be off

I just bought a PIC16F884 and put a simple C program on it using MPLAB: ...
1
vote
2answers
135 views

How can I determine how much memory a function occupies?

How can I view how much program memory a function is occupying ? I am currently at 95% program memory usage and do not have a licence to enable optimization. I am looking to find out which functions ...
4
votes
3answers
424 views

How to properly use STM32 flash memory as an EEPROM?

I have to save certain parameters to the flash memory and these values should be non-volatile. But my program will change these parameters and I want the changes updated to the flash. I understand to ...
0
votes
0answers
26 views

atmega128 doesnt return from function even if Extended.M103 fuse bit is disabled

Hi I know i should n't be using atmega128 but it will take some time to replace besides there are 100's of PCB already in making. my problem is, if you look at the main() i have declared each function ...