Skip to main content

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

Should I use a PIC24EP128MC202 or PIC10F200 for input detection?

I want to know if I can use either one of them (or both) to detect an input from a pin and according to that, set an output to another pin (or to the same pin - optional.) I made an attempt to program ...
I have no enemies's user avatar
1 vote
2 answers
43 views

Is this EEPROM write procedure on STC microcontrollers correct? Any alternative?

I'm working on a STC15W204S microcontroller, a small, cheap and capable 8051 microcontroller. So far, with the flexibility of SDCC, using the provided STCAI-ISP software and the datasheet (which is ...
fpp's user avatar
  • 183
0 votes
0 answers
77 views

STM32 and Fortran opinions [closed]

In the hope that this question will be accepted by this forum (since it is not very technical), I am asking for your personal opinion. I am a junior electronics engineer and I currently program ...
KaleM's user avatar
  • 473
0 votes
1 answer
61 views

Stop Mode 2 (deep sleep) doesn't work with STM32l053R8T6 MCU

I am working with my custom PCB with STM32L053R8T6. My code works just fine when I run it in debug without any stop mode (deep sleep). It enters to the RTC and button interrupts perfectly. However, ...
Nicat Ali's user avatar
0 votes
1 answer
43 views

SPI flash memory (AT26DF161A) with PIC16F883 write wrong data in memory and Manufacturer ID is wrong

I'm working on a product with a TFT display and I want to save the screens in a flash memory. I had available an AT26DF161A memory, so I build a prototype in order to test it with a PIC16F883. I wrote ...
Hernan Couto's user avatar
0 votes
0 answers
39 views

Set interrupt pending in STM32H563ZI

I am new to embedded and am trying to learn about interrupts. I want to trigger SysTick (or any other) interrupt by setting the interrupt pending bit in some NVIC register to 1 (read it on the ...
gagan chopra's user avatar
0 votes
2 answers
120 views

Is it normal to get garbage output through UART when resetting the microcontroller?

I have written functioning code for Serial Communication through UART, and when stepping through the code it transmits characters just fine. I have done this using microlib, so I can use printf (I ...
spyduck's user avatar
0 votes
1 answer
103 views

How to pass a pointer to multiple functions [closed]

I'm currently in the process of making my code work for STM32s through a code sample I found online: https://www.exploreembedded.com/wiki/Interfacing_Gas_Sensor_(MQ2)_With_AVR involving an MQ2 gas ...
dreece2498's user avatar
0 votes
1 answer
55 views

Problem initializing PLL as clock NUCLEO-H563ZI

I am trying to initialize the clock with PLL as system clock. The code I used is the following ...
gagan chopra's user avatar
0 votes
0 answers
28 views

N DMA Transfers based on a timer trigger using stm32F429I

I'm trying to use timer 8, stm32f429I, as advanced timer, to do N DMA transfers, that copies data from port D to memory and it does trigger on PC6 after triggering, an N DMA transfers should be shot I ...
Andre's user avatar
  • 67
0 votes
0 answers
14 views

AT32F403AVGT7 how to set CAN baud rate for this controller

I am using AT32F403AVGT7 controller but I am not getting any CAN response due to incorrect baud rate. Does anyone know how to set baud rate for this controller? I will share my code below: ...
AKASH SONKAMBLE's user avatar
0 votes
0 answers
60 views

UART only succesfull on first transmit

I have a STM32 NUCLEO-L031K6 board that I am trying to test some UART on. Following this guide: https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Step3_Introduction_to_the_UART I get TeraTerm to show &...
Borst's user avatar
  • 1
0 votes
1 answer
45 views

STM32CubeIDE crashes - Problem: EXC_BAD_ACCESS (SIGABRT)

I'm using MacOS and I'm trying to build the default code on main.c on the STM32CubeIDE which is below: ...
tadm123's user avatar
  • 155
1 vote
0 answers
45 views

how to set 4 timers on ATMEGA2560 to output signals

I am using proteus and C language to compile the code. I have 8 input signals, 4 timers and using it I need to output 4 signals (PF0-PF3). My pin PF0 refuses to work with T2 timer. I can't understand ...
Lex's user avatar
  • 11
1 vote
0 answers
30 views

Cross-compile and run aac-fdk on Cortext M0+ like the RP2040

I am creating a small device that should be able to input sound from a I2S microphone and to compress this sound using AAC LC compression. In another thread I was recommended a Arm Cortex M for this ...
www.jensolsson.se's user avatar
0 votes
3 answers
97 views

How do I convert a structure's data to the character data type and fill it in an array for UART transmission and reception?

I am trying to solve the following problem where I am supposed to send the data of a structure from one micro-controller to another using UART. The problem statement is as follows: Write a sample ...
missedSemiColon's user avatar
0 votes
0 answers
90 views

NUCLEO-L432KC timer PWM frequency problem: PSC and ARR values not resulting in desired PWM frequency

I have been trying all day to use timer 1 channel 1 of a nucleo-L432KC (with a STM32L432KC MCU) to generate a PWM signal of frequency 50 Hz (pulse width 20 ms). I tried many, many, MANY different ...
Luis Alcantara's user avatar
0 votes
3 answers
66 views

How can I use a global variable in a STM32WB55 BLE application?

I am building a BLE-based application for a STM32WB and the problem I have is that I have two programs, main.c and custom_stm.c and I want to use the same variable in both (the second program ...
Andreiul's user avatar
0 votes
2 answers
143 views

AVR ATmega328P if statement wrongly executed after reset

I have simplified the listing to bare minimum where I can still observe this behaviour. When this program is running, it works as expected. Button press causes LED to show up. The problem exist on ...
smajli's user avatar
  • 940
1 vote
1 answer
138 views

Emulating a defective LCD from a device and use another LCD

I have a device which has a defective LCD that is not produced anymore. Source info: https://www.mpc-forums.com/viewtopic.php?f=1&t=138491&start=30 The socket from the schematic diagram is ...
andre's user avatar
  • 11
0 votes
0 answers
49 views

Passing data on microframe stm32

I am trying to get an 8kHz polling rate mouse (I don't know if polling rate is the right word though), and the only problem I have come a cross is the speed of HID. I am using USB 2.0 HS. My ...
YANNTASTIC5915's user avatar
8 votes
6 answers
3k views

STM32 for loop slows down code too much

I am using an STM32 STM32F103C8T6 running at 48 MHz using ADC DMA and I find that using a for loop for manipulating arrays is much slower than multiple lines of ...
Sujoy Bhattacharya's user avatar
1 vote
1 answer
72 views

Why is no data written to the I2C bus using this PIC12LF1822 code?

I am trying to implement a basic I2C Master write sequence for a PIC12F1822 Microcontroller. I am programming the device using the PICKit 3 programmer. I have heavily simplified the code to isolate ...
BlueShoes's user avatar
0 votes
0 answers
71 views

STM32F4 HAL_BUSY Flag raised, not able to be cleared

I have a LM75A that I communicating with over I2C, using the STM32F4x Hal. I am using a STM32F446RE board. My code is abstracted in multiple layers to allow for some modularity. LM75A_Driver.c and .h ...
Liferafter's user avatar
1 vote
1 answer
45 views

Dynamically change PWM frequency on NRF52810

I'm using a NRF52810 to control an LED load and need to ramp up PWM frequency over the span of 6 seconds, like 0-1s : 6Hz, 1-2s : 7Hz, 2-3s : 8Hz, 4-5s : 9Hz, 5-6s : 10Hz. At the moment, this is how I ...
roaibrain's user avatar
  • 407
0 votes
1 answer
40 views

Is it possible to have a C language model of design in same simulation as the RTL itself and compare their outputs?

Assume that an algorithm exists in C language. It needs to be implemented in VHDL. One way to compare the two is to apply stimulus from file to model using another program or script and then store the ...
gyuunyuu's user avatar
  • 2,103
2 votes
2 answers
119 views

MCU slave receiver I2C shifts incoming data by one bit when replying with ACK

I am communicating with I2C/TWI between a MCU (Atmega328p) as Slave receiver and the raspberry pi 5 as master transmitter. I2C is at 100kHz configuration (the slower the Rpi5 can go). I have an issue ...
Christianidis Vasilis's user avatar
2 votes
0 answers
80 views

STM32f030 Inconsistent clock

I am trying to write my own microsecond delay function for an STM32f030R8t6 by using the counter function on Timer 3. The first time I power the microcontroller up after flashing the delay works ...
Eric14003's user avatar
1 vote
2 answers
140 views

I2C peripheral fails after a single transaction

I am using this library to sample some sensors over the I2C bus using the PRUs on the Beaglebone Black. It seems as if only the first transaction works correctly, after which the library seems to only ...
lrdewaal's user avatar
0 votes
0 answers
86 views

STM32 FreeRTOS StreamBuffer doesn't work

I am testing RTOS's StreamBuffer and it doesn't receive what it sends: ...
KlimDuda's user avatar
0 votes
1 answer
176 views

How to format data properly before using CDC_Transmit_FS?

I am using STM32CubeIDE to program 12 bit ADC(P/N = ADC128s102) which has 8 bit of control register and return 12 bit in MISO. Following is scope result. I am able to return some data which I think it ...
Alia Sana's user avatar
2 votes
1 answer
576 views

STM32 - HAL_UART_Receive first byte is always zero

I am implementing communication between Nucleo-F072RB board and an evaluation board with TI BQ75614 BMS IC. I have succeeded to communicate with the IC using 1 Mbps UART interface, successfully ...
block3r's user avatar
  • 41
1 vote
2 answers
181 views

STM32 USB Full Speed and card reading causes slow USB speed

I-m trying to accomplish best USB speed through STM32H743 MCU to PC. First of all I was testing just receiving data. I was sending sending 8192 bytes from MCU to the pc without any other tasks, and ...
KlimDuda's user avatar
1 vote
1 answer
85 views

STM32F407 PLL config not producing 1ms SysTick

I've a bare metal PLL setup for my STM32F407 which should generate a 168MHz system clock. However for some reason the 1ms SysTick interrupt is orders of magnitude off the grid. The math works out on ...
Michael's user avatar
  • 113
1 vote
1 answer
76 views

Where is SX1268's frequency calculation formula shown in the datasheet?

The SX1261/2/8's datasheet describes the function to calculate the frequency to set the IC: Re-arranging the formula to find out the 4 bytes to send gives: \$ RF_{Freq}= \cfrac{RF_{frequency}*2^{25}}{...
Christianidis Vasilis's user avatar
-1 votes
2 answers
204 views

Possible FPU error

...
user avatar
0 votes
0 answers
64 views

Identifier whose declaration cannot be found. TRISbits

Currently trying to program a PIC32MZ2048EFM144. I'm new to PIC programming, and I'm currently attempting to set pins J7, 3, and K7 as outputs and set them to a high state. However, I'm encountering ...
Sean 's user avatar
  • 21
0 votes
1 answer
80 views

Capture/compare interrupt flag resetting without reading the CCRx

...
user avatar
1 vote
2 answers
156 views

Unable to resolve TRISBbits even with xc.h included

I am new to PIC programming, and I am trying to blink an LED using the PIC32CM MC00. I understand I must declare them as inputs or outputs, but the IDE I am using (MPLAB) keeps giving me an error when ...
Sean 's user avatar
  • 21
0 votes
1 answer
159 views

Trying to read temperature, but always reading 655.000000 from Si7021 sensor connected to STM32 NUCLEO-F746ZG via I2C

I am trying to read temperature and humidity data from the Si7021 temperature and humidity sensor on an STM32 NUCLEO-F746ZG over I2C, and then send it over UART to be viewed on a computer. After ...
p1unge's user avatar
  • 1
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
153 views

Can't debug a PIC24F04KA200 using a MPLAB Snap debugger

I'm working with a PIC24F04KA200 in MPLAB X IDE v6.05 and debugging using a MPLab Snap debugger. Programming in C. I can program the device perfectly fine. When I want to debug the program I need to ...
Royginald's user avatar
0 votes
2 answers
281 views

What does the frequency of a microcontroller mean?

I'm working with STM32 board which a microcontroller is embedded. This MCU seems to work within 72MHz max. Now if I make a C code, does that mean each simple instructions would be done within 72MHz? ...
Classy Fied's user avatar
0 votes
1 answer
80 views

Encoder signal reading Arduino

I have a quadrature encoder both connected to the Interrupt pins on my arduino. I want to read the encoder values in the range of 0-255 with increment in the clockwise direction and decrement in the ...
dreamcoder's user avatar
0 votes
0 answers
46 views

LSM6DS3 gyro raw to degrees per second conversion error

I am using LSM6DS3 for one of my projects with Nordic nrf52840 along with Nordic SDK. I am trying to read the gyroscope and according to my understanding the gyroscope value should not exceed the full ...
EngineeringArtist's user avatar
-1 votes
2 answers
202 views

What's a good way to learn microcontrollers without magic? [closed]

I know software (C, C++, POSIX, assembly) and would like to learn microcontrollers at a low level, down to digital circuits. I don't want to use any tools that obscure the internals, such as Arduino, ...
SRobertJames's user avatar
  • 1,135
1 vote
1 answer
212 views

How do I use CMSIS without a GUI or IDE?

I have a bare metal STM32 C project working on a NUCLEO-F446RE. To learn about MCUs, I did not use any code generators or IDEs, but created a simple Makefile, linker script, start up C code, and <...
SRobertJames's user avatar
  • 1,135
5 votes
2 answers
965 views

Loading LSB first or MSB first?

I am trying to create a delay function similar to builtin __delay_ms() in MPLABX IDE PIC18F4520. The question is if I write the LSB first to the TMR0L register, I ...
Madhan Gasikanti's user avatar
0 votes
0 answers
72 views

Problem in code while interfacing PIC24 with 25AA256 EEPROM

I have been trying to interface a PIC24FJ128GA010 with a 25AA256 EEPROM using Proteus and Serial Peripheral Interface (SPI). I wrote a C code and configured everything and all pins but since I self ...
P-Em's user avatar
  • 13
1 vote
0 answers
31 views

Help in system initialization and clock configuration of MSP430F427A MCU interfaced with custom LCD

When I debug the code, the LCD refreshes rapidly. I am not confident with the correct system clock configuration to use. Moreover, after debugging, in release mode, nothing displays on my LCD nor the ...
Bravo's user avatar
  • 21

1
2 3 4 5
33