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
2 votes
1 answer
94 views

What does LSB mean in PWM?

I have this PWM exam preparation question in Computer Engineering where it says "What is one V_LSB?". However we've discussed nothing about LSB in the PWM section. What does it means?
user avatar
1 vote
1 answer
74 views

Simple AVR interrupts in C - How to cleanly stop and restart "INT0"?

I'm trying to use an ATTiny84's INT0 pin to detect a falling edge event on a 1 kHz signal. What is the correct way to temporarily halt this interrupt INT0, and then resuming it at a later time, ...
user avatar
0 votes
2 answers
69 views

Why my timer1 not working?

My purpose is to measure phase angle between 2 square wave as below(yellow represent voltage ZCD and blue represent current ZCD passing through ACS712 hall effect current sensor) Below is my circuit ...
user avatar
  • 437
0 votes
1 answer
38 views

Does interrupt service routine in PIC16F877A work with other self-defined variables?

On internet can seen countless simple example like the one below void __interrupt() isr() { if(TMR1IF) {Do something} } But does it work on self-defined ...
user avatar
  • 437
1 vote
2 answers
76 views

Cannot configure timer to 10µs on STM32F401 device

I'm using an STM32F401CCU6 microcontroller and am trying to generate a timer interrupt of 10 us with TIMER3. The timer is a update event timer. The formula I'm using is: ...
user avatar
1 vote
0 answers
121 views

Problem with Arduino exercise

I have to do the following exercise: An 8-bit binary number is input to Port D of the ATMEGA328. Show on two 7-segment displays the independent value of bits 4,3,2,1 on the display. Note: Set keys ...
user avatar
0 votes
1 answer
42 views

Does the frequency of APB1 on stm32f4 have to stay at 42 MHz?

I'm trying to configure the clock of my stm32 board. And I'm wondering if I always have to make the SYSCLK 168 MHz and APB1 42 MHz. If the APB1 is not 42 MHz, I get a weird result when using uart. I ...
user avatar
6 votes
2 answers
783 views

Problems casting a uint8_t array to a struct

I'm having problems casting an array of uint8_t to a struct in C using a Silicon Labs MCU (EFM32GG11B120F2048GQ64). The byte array is the received data from a UART, and I want to cast it to a struct ...
user avatar
  • 197
3 votes
1 answer
60 views

How to determine phase sequence of the unbalanced three phase grid?

Let's say I have three phase voltage grid which is unbalanced (three phase utility grid). The phase voltages are sampled by the adc (suppose that the analog channel is properly designed from the hw ...
user avatar
  • 845
1 vote
2 answers
83 views

How to decompose the three phase unbalanced grid into the symmetrical components?

Let's I have three phase voltage grid which is unbalanced. The phase voltages are sampled by the adc and I would like to determine in the C language software the positive sequence, negative sequence ...
user avatar
  • 845
0 votes
0 answers
50 views

Blocking Task when calling vTaskDelay

I'm running some tasks in esp32, my problem is when im calling vTaskDelay() from a task, an other task start executing, wich is something i dont want, so how to make vTaskDelay() a blocking function ...
user avatar
2 votes
0 answers
78 views

STM32F107 CAN software driver does not work

I am using ST drivers to use CAN bus on an STM22F107 according to the code below. It does not work. The code is as below and is available here. ...
user avatar
  • 113
0 votes
1 answer
69 views

Sequence on MSP430 C code skipping certain flags [closed]

I am developing some code for the MSP-EXP430FR5994, specifically code using the MSP430's ADC. My plan for the ADC is to run a dual-channel ADC capture. However, I have only been able to run the code ...
user avatar
0 votes
1 answer
40 views

MSP430 ADC, using a different memory slot other than MEM0

I'm working with the MSP430Ware Sample Code for a basic ADC on the MSP-EXP430FR5994 development board. On the code, it uses MEM0 and the supporting infrastructure such as flag 0 to convert. The one ...
user avatar
0 votes
1 answer
144 views

Control LEDs with 74HC595 shift register through SPI

I'm currently working on a project for which I need to control 16 white LEDs with two shift registers 74HC595 in cascade. I work on a ...
user avatar
  • 11
2 votes
1 answer
57 views

What is the proper way to handle a status led when HardFault_Handler or any error is raised?

I am trying to implement a very basic status indicator using an STM32 - Basically I would like to toggle a RED LED when a fault is triggered by the MCU. Naively I added a toggle LED function in the ...
user avatar
  • 185
0 votes
3 answers
99 views

A question about memory address in microcontroller vs PC [closed]

In context of embedded C, considering the following line: *((volatile uint32_t *) 0x48000414) |= 1UL<<12; Now 0x48000414 can be a memory pointer to a ...
user avatar
  • 1,283
0 votes
2 answers
164 views

How does STM32CubeIDE locate the header file in such case?

I created a C/C++ project in STM32CubeIDE as follows: In the main.c I had to write the include as follows: #include "..\Inc\myRandom.h" otherwise if I ...
user avatar
  • 1,097
0 votes
1 answer
58 views

HAL_SPI_Transmit does not send the bit pattern expected way

As a beginner, to test HAL_SPI_Transmit function for this Nucleo board, I wanted to send 0b10101010 on MOSI line and observe it on scope. But I don't see that bit pattern on scope, instead I see the ...
user avatar
  • 1,419
1 vote
1 answer
47 views

problem in echoing 8 bytes in STM32 SPI slave

Linux SPI master sends 8 bytes data of these every 1 second: ...
user avatar
12 votes
2 answers
3k views

Why does modulo operation consume more power?

I mainly use Cortex-M4F or Cortex-M0/0+ devices such as: STM32L4, G4 STM32L0, G0 I sometimes see blogs like this one saying "Avoid Modulo" for lower power consumption. Comparing these two ...
user avatar
0 votes
0 answers
26 views

problem with sd card video door phone

I'm working on the code of a video door phone and I'm trying to improve it. with 16 GB SD card the pictures that the camera takes can be seen on the LCD but when I connect the SD card to PC using a SD ...
user avatar
0 votes
3 answers
195 views

Why are MSPs in STM32 HAL defined as callback functions?

Please see my edit: I asked this question stackoverflow and no one answered. In STM32CubeMX MSP stands for MCU Support Package and of all here is what it basically about: MSPs are user callback ...
user avatar
  • 1,097
0 votes
0 answers
125 views

Why are the servo motors not working when I am supplying power through external power supply?

I am making a robotic arm made up of 3 SG90 servo motors and programming them through an arduino uno. The project is inspired from the one made by Ryan Chan as shown here. The setup made by me is ...
user avatar
3 votes
1 answer
130 views

Byte concatenation for SPI Transmit (STM32)

I want to transmit data to EEPROM via SPI but I can not concatenate command bytes and data bytes. In my scenario, I need to transmit 3 bytes of command and 64 bytes of data. How can I send this data ...
user avatar
1 vote
1 answer
106 views

FreeRTOS scheduler is not triggering the TASK

I am programming an STM32F103 for my project and recently switched from bare-metal to RTOS (FreeRTOS to be specific) without using CubeMX (code attached below.) For now, I am simply running an LED ...
user avatar
  • 307
1 vote
1 answer
104 views

SSD1327 OLED-driver C-library

Since a pre-made I2C C-lib for the SSD1327 does not exist anywhere, I'm trying to create one by hand for the STM32 HAL without ...
user avatar
2 votes
3 answers
99 views

STM32 on Registers Setting Up PLL, WWDG fault, Parameter/Setup Issue

STM32F746-Disco, Win 10, Cube 1.8.0; CMSIS-only (no HAL). C. I've been messing around with STM32F746 and learning to do various stuff directly via registers (interrupts, dma no problem). I left ...
user avatar
  • 3,286
0 votes
1 answer
34 views

TM4C123GXL Tiva launchpad: Hardware Fault when debugging in Keil Microvision

I got a weird problem last night. Here is a simple program that uses pin PA7 to drive a LED: ...
user avatar
1 vote
1 answer
61 views

AVR-libc `uart_putchar` implementation

In AVR-libc page 143 the implementation of the function uart_putchar() is typical as the following: ...
user avatar
  • 488
0 votes
1 answer
224 views

SPI communication problem between Raspberry Pi and STM32

I've spent a couple of days to find answer to my problem. Currently I'm working on a project where an STM32L432KC microcontroller board and a Raspberry Pi 3B need to communicate over SPI. The OS on ...
user avatar
  • 11
0 votes
1 answer
79 views

PIC18 UART interrupt priority problems

I am completely new to microcontroller programing. Just started my journey with PIC18F24K22 and now I am on the UART interrupt stage. I have been reading the datasheet meticulously and it really took ...
user avatar
0 votes
0 answers
30 views

RL-TCPnet crash when send and get at the same time

I'm working on a web service with RL-ARM libraries. I want to send some parameters with AJAX as .cgx file and at the same time I want to create a socket and then send a lot of data to the destination. ...
user avatar
0 votes
0 answers
73 views

How to change the provisioning state on esp32

ESP documentation sates: If provisioning state needs to be reset, any of the following approaches may be taken : the associated part of NVS partition has to be erased manually main application must ...
user avatar
  • 113
3 votes
0 answers
102 views

Why won't DS3231 Real Time Clock continue ticking when powered only from VBAT?

I've got a custom STM32 board that uses a DS3231 RTC for date/time stuff. When the board is fully powered I can communicate with the DS3231 over i2c and write and read the time/date. Once the power is ...
user avatar
  • 561
1 vote
1 answer
30 views

STM32F7 Two Timer Channels Share One DMA Channel

I am trying to write a driver that sends DShot commands to an ESC. I am using an STM32F722 MCU. The DShot protocol is similar to addressable LEDs where 1/3 duty cycle represents a 0 and a 2/3 duty ...
user avatar
0 votes
2 answers
130 views

How many times can a register bit be changed in AVR?

I am writing a program for an ATmega328P. I have a while loop inside which I am enabling the UART receiver complete interrupt flag using the command ...
user avatar
1 vote
2 answers
184 views

How to string compare const uint8* in a ESP32 microcontroller chip

I'm sending data from an ionic app (typescript) to an ESP32chip. Data from the app uses protocol buffer format. Here's the code: ...
user avatar
  • 113
0 votes
0 answers
49 views

I2C via MCU works with FLAG_WRITE_READ but not FLAG_READ

I'm reading the date from an RTC via I2C using a SiLabs MCU. There are two different flag options, but only the 2nd one works. I'm new to implementing I2C, what is happening on the wire that works ...
user avatar
  • 776
0 votes
1 answer
72 views

Making duty cycle with CTC mode in AVR without using interrupt

I am writing a program to make an output with a 30% duty cycle and a frequency of 3 kHz using an ATmega32 microcontroller. My controller's frequency is 8 MHz and I am going to decrease it to 1 MHz by ...
user avatar
  • 53
-1 votes
1 answer
118 views

A question on handles in embedded C [closed]

Regarding handle concept in C the following is stated: The term handle is sometimes confused with a pointer. A handle is a reference to a system resource. Access to the resource is provided through ...
user avatar
  • 1,097
0 votes
0 answers
383 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 ...
user avatar
2 votes
1 answer
114 views

stm32f051 - Config Timer14 to Interrupt only by counter overflow, not by counter initialization

I'm new to the world of embedded and I'm implementing a short, long and two-click on a button logic in my project on a stm32f051 I'm having a problem with the timer interrupt, I want it to generate ...
user avatar
0 votes
0 answers
78 views

Why do magnetometer values change when I move PCB?

I have an MPU9250 on my PCB and I use an AHRS system with a Madgwick filter to get yaw angle. But for some reason - I can't get normal Euler angles (SO question). But I guess, I understood why. When I ...
user avatar
1 vote
1 answer
83 views

What is the best approach to learning hardware design? [closed]

I am a self taught software developer who has recently become interested in embedded systems. I am interested in learning how to design PCBs and learn about the electrical components the PCBs house. I ...
user avatar
1 vote
1 answer
139 views

STM32F103: Custom bootloader weird behaviour with stack pointer

So, I am trying to use this USB mass storage bootloader for the STM32F103C8 (64kB flash): https://github.com/sfyip/STM32F103_MSD_BOOTLOADER To compile .hex files for it, I've already set the flash ...
user avatar
  • 773
1 vote
2 answers
112 views

How to interpret this line in binary for this STM32 HAL function?

The following line of code sets(to logic 1) pin 12 of port D in an STM32 microcontroller: The middle argument of the above HAL function is GPIO_PIN_12 and when I hover on it shows: ...
user avatar
  • 1,097
1 vote
0 answers
75 views

When I move same commands into function program stops and while loop not working in STM32F0

I am developing library of LCD1602 for STM3232F030, I have header file like this: LCD1602A.h ...
user avatar
1 vote
0 answers
105 views

How to implement header files into my VScode embedded C project?

Sorry if this is a noobie question but I've been trying to get this set up for a few days and I'm still struggling. I haven't done embedded C in a couple of years and I'm trying to get back into it. I'...
user avatar
  • 133
1 vote
1 answer
128 views

STM32 matrix keyboard scanning gets random keypresses

I am trying to implement a keyboard with STM32 controller (since I managed to burn all my ATMegas and STM32 was all I have). It uses two matrices of keys (it was supposed to be a split keyboard, but ...
user avatar

1
2 3 4 5
31