Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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)

2
votes
0answers
39 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 ...
-3
votes
0answers
27 views

I2C is Always busy STM32F407

I followed many posts about that issue, when I transmit something thru I2C I get a busy flag always. That happens on board discovery F407VG. I tried the solutions on the stackexchange but nothing ...
2
votes
1answer
43 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
55 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
79 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
118 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
45 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
63 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
34 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
59 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
29 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
46 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
202 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
29 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
62 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
111 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
142 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
24 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 ...
0
votes
0answers
38 views

No data being displayed from ADC0804 in program using FT232RL

I'm attempting to read analogue voltage from a potentiometer by converting it into digital using ADC0804 and then passing the data onto y pc using FT232RL. As it stands the ADC0804 circuit is working ...
0
votes
1answer
33 views

DMA Init code for ADC sampled data

I am trying to figure out how this DMA Initialization code is used to sample following 4 ADC channels and save data in 'adc_data'. ...
1
vote
1answer
67 views

Finding ADC pins from Init code

I am trying to figure out the GPIO Pins that are used for ADC input looking at the following ADC Initialization code for STM32L476RG. ...
0
votes
1answer
48 views

how to enable FPU in cubemx

For STM32F407 Discovery board how do I enable its FPU from CubeMX? The following instruction is used in handwritten code. How can I get it generated from CubeMX? // Enable FPU SCB->CPACR |= ...
0
votes
1answer
19 views

Using port 0 in AT89C52 without pull up resistors

So at my university professor gave us following scheme to program this double 7 segment display on the right. At start I tried to simply adress it using P0=(someData) although it didn't work. Then I ...
1
vote
4answers
107 views

Volatile keyword with ADC, USB interrupt readings

I was just reading an answer about global variables, it also stated that I should use volatile affix whenever a global is used in an interrupt. In my program I am using a 30 byte ADC buffer without ...
0
votes
1answer
70 views

PIC assigning number to a port

I am confused with assigning number to a specific port. When I try: LATA=31; In this example when I check pins when by one, I get this result = 0b00001010. It is ...
0
votes
0answers
51 views

How can I shift bits in order to find the remaining weight on port D in this challenge problem?

So in my intro to embedded systems class I'm supposed to calculate the total weight that three sensors detect and are connected to ports A, B, and C respectively. Then I have to change the bit in PD0 ...
3
votes
0answers
93 views

Weird problem on STM32 ADC with Interleaved Mode

I am sampling a signal on the STM32F3 Discovery board (stm32f303vct6) with two ADCs working in interleaved mode. It works great with a 200kHz 1V sine wave. But when I apply 10kHz 100mV sine wave, I ...
6
votes
2answers
195 views

ATmega328p sine wave generator, frequency capping at 1200Hz

I'm currently implementing sinewave generator on ATmega328p (16MHz). My project is mostly based on this article https://makezine.com/projects/make-35/advanced-arduino-sound-synthesis/. In brief, I ...
0
votes
0answers
62 views

Multiple read ADC STM32

I'm trying to read multiple ADC value one after the other using the continuous scan method. I have fallowed quite a few tutorial and example, but nothing seems to work for me. I am using the ...
2
votes
3answers
145 views

I2C weird data and clock output/input

Hello I am trying to communicate that is using SMBus. So when I try to send a data which was 0x0D and address of the device was 0x16. I see something like that on the data line: And this is how my ...
1
vote
1answer
40 views

Problem understanding some BSRR assignment operations

I'm learning about the STM32F405/415 in my course and having some trouble understanding some applications of the BSRR. Specifically how it's used in this function: ...
0
votes
1answer
79 views

how to display an output variable from a speed sensor to a 7 segment display in C. DSPIC33E

I have just started an electrical engineering degree and been set an assignment to create a closed loop motor speed control system in C programming language. The PIC is a DSPIC33E (BLO032) and the ...
0
votes
2answers
62 views

Setting pins as output Code - micro-controller

So i am using the MSP432 and i am confused on how the code for setting pin to desired function works. so for example from the manual i have found that: ...
0
votes
0answers
47 views

SD card reader using SPI with Atmel SAM G55J

I have a custom board using an Atmel SAM G55J (ATSAMG55J19A-AU) and I'm trying to get the SD card reader to work - which is connected to SPI0. I'm using the SD/MMC ...
1
vote
1answer
112 views

Delays using Timer in stm32

I am currently trying to achieve delay of 1 uS using timer in stm32 for my application purpose. SYSCLk is set to 16MHZ LSI and define same for timer clock. Timer used is a 16 bit timer. The logic I ...
0
votes
0answers
29 views

Keypad changing ports for usage of Timers

I want to use timers of ATmega 32 ( PD4 and PD5 ) for pwm mean while i'm using Port D for keypad the available ports for me is PA7 and PC7 i want to know how can i change my code of keypad init. ...
3
votes
1answer
53 views

Atmega168 USART RX Interrupt does not trigger

I have been trying to get the USART RX interrupt trigger working on my ATmega168A using the tutorial here (updating my registers as per the datasheet): Tutorials I have setup the system to use a ...
2
votes
2answers
116 views

Proportional Control Balance Beam

Bit of an unorthodox question I'm sure, but I'm making a balance beam (two rotors on either end of a see saw) with proportional control, and I can't seem to get it to balance at 0. The proportional ...
1
vote
1answer
43 views

Unexpected results when measuring MPU6050 sample rate with RaspberryPi

MPU6050 datasheet says that maximum accelerometer data output is 1Khz, so in theory when measuring time it takes to receive 1000 data samples through I2C, so I should receive all data in no less than ...
0
votes
1answer
39 views

MSP microcontroller Watchdog timer

I am new to programming microcontroller. what does the following like of code do: WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD i have looked at the technical ...
1
vote
1answer
86 views

USB Strange behavior

I am porting the USB driver from the STM32F4 device to STM32L4 device. It almost works. During the enumeration it sends and receives the information, but the data is not exactly the same as from the "...
1
vote
1answer
63 views

What is the right order for 16bit data on 8bit 8080 data bus

I'm trying to create a program to drive a TFT LCD with an ILI9486 in 8bit but I don't know if I must send the configuration data and commands MSB or LSB first. The color data for the pixels in 16bits ...
0
votes
1answer
57 views

AVR NRF24L01+ No Communication, No IRQ Activity

I've been scratching my head for a few days over getting the NRF24L01+ modules to work on AVRs (ATMega328/p). I followed Gizmosnack's tutorial, not changing very much at all from his code. I've also ...
0
votes
0answers
51 views

PWM output with Teensy 32. Atmega32u4 failing when printing values to terminal

I am implementing PID control and have developed code that reads analog potentiometer inputs, converts it to discrete counts, and outputs a PWM response to a DC motor based on the angular displacement ...
0
votes
2answers
137 views

Using Arduino Mega as Atmega2560 AVR development board with Atmel Studio 7

(updates at end) Qualifier: I am posting this here and not on the Arduino Stack Exchange because my question is about firmware development and not Arduino development. Project: I am designing a PCB ...
2
votes
0answers
57 views

PIC32 having multiple PORTB's “high” at the same time

I am trying to set a couple of PORTBbits to "high" (1) at the same time for that I am using the following code: I am using thePIC32MX695F512H ...
0
votes
1answer
58 views

MPLAB X __delay_ms() hangs on PIC16F77A

I'm trying to use the __delay_ms() function to make an LED blink on the PIC16F77A. The reason I think it stalls on the __delay_ms() function is because whatever I set RB0 to before the delay ...
2
votes
1answer
124 views

ARM Cortex-M3 Interrupts and Interrupt service routine &interrupt handler

I am trying to understand arm architecture and i got stuck with one concept, i.e, INTERRUPT SERVICE ROUTINE. I had gone NVIC structure for HARDWARE & SOFTWARE interrupts. But at some point i got ...
1
vote
3answers
110 views

Circular buffer in flash

I have been facing following problem. I have implemented a datalogger i.e. software running on a MCU which creates periodic snapshots of a system state (values of some quantities of the system). ...