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
0answers
11 views

how to prevent pipelining optimizations in vivado hls

is there way to choose which optimizations vivado hls can use, specifically i want to disable pipelining option , i tried to use #pragma HLS occurrence , #pragma HLS pipeline off and it it doesn't ...
0
votes
0answers
37 views

Modifying Option Bytes at compile time

I need to modify the option bytes at compile time for STM32L0xx controller and generate the binaries i.e. .hex, .bin. could you please suggest a solution for the same. I amusing STM32Cube IDE for ...
2
votes
0answers
70 views

STM32 HAL_ADC_Start() ends with HAL_ERROR

I'm new to microcontroller programming and I have a problem I can't solve. I am using STM32 Nucleo board L4R5ZI and I try to read the analog value on one of the pins, and then use the ADC to convert ...
0
votes
1answer
35 views

Bug and Best Practices for Interrupt Handling/Organization

I've read a few documents on best practices for interrupt handling and thought I was doing things correctly, ensuring the variable set in the ISR was declared volatile. In my code the interrupt ...
0
votes
1answer
70 views

How to implement C language driver for SPI peripheral [closed]

I have been implementing device driver for the SPI peripheral of the MCU in C language. I would like to exploit interrupt mechanism for reception and also for transmission. As far as the reception ...
0
votes
1answer
55 views

Getting unexpected I2C Slave Address from a LSM9DS1 sensor and reading the wrong data from the register I just wrote in

I am using a STM32F030R8 nucleo board and a LSM9DS1 sensor. I'm just starting out learning about this stuff and I am having troubles reading from the sensor. Here are all the details about the problem ...
0
votes
1answer
117 views

Problem in c language [closed]

I need a and b value. a=2; b=a+=++a; a+=-b; Solution is: a=0 b=6 Why is this the ...
0
votes
0answers
29 views

How to increase polling speed of data from external ADC (controller and ADC has SPI interface) without any external interrupt?

I have an an external ADC which has capability to sample data at 40Ksps and controller needs to poll the data from ADC. I am unable to get enough sampling rate by keepon calling it from while(1) loop (...
6
votes
1answer
1k views

How to get rid of shift and logical operations

I am trying to upgrade an old firmware of a 32-bit MCU. The fw has many macros in it which uses various operations eg., logical shift etc. I want to replace these shift and logical operations. An ...
0
votes
0answers
22 views

How can I reset/stop a PWM timer using STM32F4 board

Hi I'm working with the STM32F4 board trying to make a servomotor do two movements (one side and the other). This is my code so far: ...
1
vote
0answers
27 views

How to use ATMega USART in synchronous mode using XCK pin

I'm working on a project with ATMega64 and I have a problem with one of the USART interfaces which is going to work in synchronous mode. when trying to send a test data like: ...
1
vote
0answers
36 views

Is my design for data reading over an I2C bus and writing back to UART good enough?

So I implemented drivers for I2C and USART using interrupts with some guidelines online, and was wondering if I can get some suggestions from a design point of view even though the code works (tried ...
0
votes
1answer
28 views

TIVA TM4C123G Driverlib Function Question

I have a question about how to use a basic GPIO function from the TIVA driver library to set an output pin high. See the below image for more detail. The red underline on the code on the left hand ...
0
votes
1answer
56 views

TM4C123 Header File Problem

I'm having trouble getting a simple blinky project working using the on-board LED's on the TIVA TM4C123G evaluation board. I am using the header files from the driver libraries so I don't have to ...
0
votes
1answer
53 views

Approach to prevent Replay and spoofing attack on CAN protocol

I want to make an authentication system between 2 buses. In order to achieve that I use counter to avoid replay and hash to avoid spoof. The message must be sent in two phases. Is there any proper way ...
0
votes
1answer
26 views

Decoupling setting of specific bits (transfer mode, stream, channel) from the generic DMA_Init() function

So with regards to DMA drivers, what's the approach for configuring certain bits generic inside a function which could be reused for both TX and RX calls which would require different stream parameter ...
0
votes
1answer
30 views

STM32 Nucleo board, SD card displaying symbols instead of numbers

Devices: STM32F4 The SD is working and the data is saving on the SD, but the problem is that the integers are displayed as symbols in this SD. So I think that the problem is that the function I used ...
2
votes
0answers
87 views

Is my IIR implementation (in C) correct for this difference equation?

I recently started developing a digital regulator for a DCM boost (Digital regulator for DCM Boost - How does it relate to duty cycle?) And I've implemented the difference the following controller in ...
1
vote
0answers
34 views

Compiler settings to code in C with Proteus

I have made a circuit for a game called catch the light on Proteus. I have a C code for that. But I don't know how to set compilers and all that. I tried to add source code but due to some compiler ...
0
votes
2answers
97 views

PIC18F Rotary Encoder Code Help XC8

I'm trying to interface a rotary encoder with my pic18f4550. Just trying to get it to increase/decrease the variable output and then display that value through the ...
3
votes
2answers
353 views

Efficient way of writing to flash memory without losing data

For my project, I am writing some code that gets some results and I want to store these results on external flash memory. The external flash memory in question is a MX25R8035F. I found that writing ...
2
votes
1answer
64 views

Making use of the serial data received via UART - a few concerns [closed]

So I have been finally able to send and receive data serially via usart, but now I'm thinking of getting something useful out of it. One thing that I do plan on doing is maybe take in the input, ...
0
votes
2answers
41 views

How is clock bus different than peripheral clock in STM32?

Been looking to clarify this confusion: how is the clock that a specific peripheral is on (APB1, APB2 etc) different than the peripheral clock itself? Say, I2C1 ...
0
votes
0answers
21 views

Is there any standard way of defining respective data structures to read the sensor data into?

So I have been wondering about the standard way of structuring your files/code when it comes to reading data from the driver file. So what I now have is a buffer that's supposed to store the data that ...
0
votes
2answers
52 views

Set multiple pins to different GPIO ports

I am using an STM32F4 discovery board and I have the following array v ...
0
votes
2answers
74 views

How to structure an application, and driver code for UART - the concept of decoupling the data [closed]

So I'm writing drivers for UART on STM32 and even though I kind of have an idea on laying out the structure, I'd still want to clarify prior to implementing, and also considering how essential it is ...
17
votes
9answers
4k views

Does the “Avoid using floating-point” rule of thumb apply to a microcontroller with a floating point unit (FPU)?

As a rule of thumb, I try to avoid using floating-point in my embedded system codebase. Floating-point variables are: Computation-intensive Not atomic (can cause problems in an RTOS application or ...
0
votes
1answer
37 views

How to use UART interrupts for PIC24 with MCC?

I'm using UART6 to interrupt my program whenever it receives an incoming string. I'm using the MCC to generate functions that I can use but I'm not sure how to call my interrupt function. Here is my ...
1
vote
0answers
65 views

USB Audio device won't open in windows

I'm working on a simple USB audio input device based on the Microchip/Atmel ATSAMD21. The descriptors identify it as a single channel microphone with a single feature unit for volume control. As I ...
0
votes
1answer
84 views

STM32F103 bxCAN not working

I'm trying to make use of the bxCAN of STM32F103C8 on a bluepill but it doesn't work and I don't know what is the problem.I'm using the hal API here is the main code in the while loop ...
1
vote
0answers
23 views

UART Overrun Error handling when transmitting data onto a terminal (lpc2138)

I am making a driver code for lpc2138. Currently I need to read the voltage on a potentiometer with the ADC and with the use of timer, print it onto a terminal in regular intervals. There are also ...
0
votes
2answers
73 views

STM32 I2C only sends address

Hello I am trying to communicate with TI BQ28Z610 by using Nucleo-F746ZG. All I do is trying to read data from TI chip. I am sending 0x08 to slave address 0x55.I2C frequency is 80kHz and pull ups are ...
0
votes
2answers
136 views

Creating a memory mapping to peripheral memory on STM boards

I am trying to find a way to load/execute code that is stored on an external SRAM chip without having to load it to the microcontroller internal memory. I'm not 100% sure of the name for what I'm ...
0
votes
2answers
62 views

How to go from specs/requirements to design, architecture, code, tests, documentation for embedded systems? [closed]

How do professional embedded systems engineers design, architect, code, test, document systems? Any good examples, libraries, resources that showcase the process of going from specs/requirements to ...
0
votes
0answers
51 views

What's the way of passing a pointer from application file to driver HAL file that contains interrupt handler?

So there's a static pointer inside hal.c that stores a reference to the pointer being passed in from app.c, but having a ...
1
vote
1answer
73 views

Saving a variable between reboots on a microcontroller without using flash memory

I am developing a bootloader and have some trouble jumping from the bootloader to the application. As far as I can see the problem is because I am doing certain initializations in the bootloader which ...
1
vote
1answer
34 views

While loop for function call for enabling I2C interrupts seems to be behaving weirdly

Trying to understand why the while loop is behaving weirdly. HAL_MasterReceiveInterrupt() enables the control bits for I2C and ...
0
votes
1answer
57 views

Incorporating RTOS into a simple sensor interfacing project for learning purpose

I am trying to switch to embedded from a software test role, and been working on learning about STM32, and almost finishing up writing drivers for I2C which I used for interfacing with a sensor. I ...
0
votes
1answer
39 views

Getting a NACK after reading 1 byte from MCP9808 temperature sensor

I am implementing drivers for I2C interrupts for STM32F401RE and looks like the API for transferring the data seems to work. But for receiving, I see that I'm only able to receive one byte. I am ...
0
votes
1answer
56 views

Unified struct in C to represent multiple sensor data

Working on desginging APIs for sensor events. I was wondering if there is a way to represent different type of sensor readings into a unified struct in C ? For example a accelerometer'e reading ...
3
votes
2answers
193 views

How can I design a low pass filter using Z transform in Microcontroller?

I have generated a signal which is a mixture of 50 Hz and 250 Hz sine waves using a microcontroller and DAC. Check the screenshot of the excel file: The values of row 4 (i.e. f1+f2) are feed to an 8-...
3
votes
0answers
94 views

Getting an ACK failure right away after writing slave address in interrupt mode for I2C [STM32F4]

I see that once slave address is written in the interrupt handler, I get an ACK Failure right away, but when I do the same thing with polling approach, I do get an ACK and goes on to read off the ...
0
votes
0answers
52 views

Capture GPIO pin values with STMA32 and DMA

I am trying to capture all GPIO_C port pin values at a time when PA0 pin goes low. I am using STM32F091RC micro-controller. But I cant figure out why ...
2
votes
1answer
73 views

Stack error when jumping from bootloader to application

I have been trying to jump from my bootloader to an application for a while now but I can not figure out what is going wrong. I am hoping someone here might be able to help me. I am using Texas ...
1
vote
0answers
51 views

Imprecise bus error when setting Vector Table Offset Register. TI CC2652

I am developing a bootloader and want to jump to the application. I am new to this so I am not entirely sure I am doing it right, but as far as I know I have to change the value stored in the VTOR (...
0
votes
1answer
63 views

CAN bus malfunction on STM32F3

I create applications for STM32 F303RE for communication with the instrument panel. I managed to connect everything but I have some problems. I'm not sure if it's due to bad code or good performance. ...
1
vote
1answer
64 views

NAK in CAN bus for STM32F3 uC

I have a problem with the NAK on the CAN bus. On STM32F303RE I wrote a code for communication via CAN bus with car dashboard (Instrument Panel Cluster). The communication works, I manage to receive ...
1
vote
1answer
53 views

Checking interrupt flags for UART data receiving and transmitting on STM32

I'm trying to develop a UART receiver/transmitter for an academic project. For now i developed the UART continuous data receiving part and it works quite well. Here is the code: Interrupt file: ...
0
votes
0answers
29 views

How can I add a SVCall handler to the Vector Table of a CC2652 device

According to the CC26xx Driver Library documentation there are two options for adding interrupt handlers, one dynamically and one statically. The static registration of handlers seems to be the ...
0
votes
0answers
39 views

Proteus gives unrecognized attribute 17 for stm32 Hello World in C

Here is my simple C program for the stm32, I tested it on QEMU, it flashes the led successfully. But when I try to load the main.elf file into the MCU on Proteus, I ...

1
2 3 4 5
27