Skip to main content

All Questions

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

STM32L432KC Timer interrupt only triggers once

I am trying to send a message through UART based on Timer 6 interrupt on STM32L432KC microprocessor. The prescaler is set to 39999 and the auto reload is set to 19999 to get an interrupt every 10 ...
kefecik's user avatar
  • 11
0 votes
0 answers
39 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
97 views

Two basic timers on an STM32 don't work simultaneously

I have an STM32L073RZ and it has TIM6,7 basic timers. I need a timer interrupt. TIM7 works fine as I want, but TIM6 doesn't. I tried different settings of prescaler and counter: same as TIM7, almost ...
sneiksus's user avatar
1 vote
1 answer
385 views

Can I use a different channel of a timer at the same time?

I am using AVR128A for a project. It comes with two 16-bit timers (Timer 1 and Timer 3) and two 8-bit timers (Timer 0 and 2). Timer 1 has two channels whereas Timer 3 has three. I have all the timers ...
RK Eshat's user avatar
  • 153
0 votes
1 answer
538 views

Using Timer Interrupts Instead Of Delays in PIC Microcontroller

I have this task where I have to use timer interrupts intead of delays (for efficiency purposes) in this 7 segment display circuit with PIC18F4620. Here is the circuit: Display is common anode. I ...
Line Follower's user avatar
0 votes
1 answer
141 views

STM32 PWM timer interrupt latency

I have STM32F401 board (WeAct Black Pill V3.0, but the chip is labeled as STM32F401CCU6). My task is to read output of AD7606 (16 bit, simultaneous sampling, 8 channels, 200 kSPS max) in parallel mode ...
anandr's user avatar
  • 111
2 votes
2 answers
819 views

How do I measure a pulse width using the ATmega328P interrupts and timers?

I am using an ATmega328P MCU with an 8 MHz internal oscillator. I need to measure the pulse width of an incoming pulse. The frequency of this pulse is approximately 500 Hz. Once every 2 ms, one pulse ...
turqay mammadov's user avatar
3 votes
2 answers
490 views

How can I change ARR/CCRx register in ISR correctly?

I have strange behavior of timers. I'm using a Blue Pill with a STM32F103 chip with the HAL lib. My case: I set up TIM2 to input capture mode to count impulses, then I store it in a global structure ...
Alexey's user avatar
  • 43
1 vote
1 answer
154 views

What is preferred way to have an interrupt every second - setting timecmp to timecmp+1000 or time+1000

me and friend were discussing what the most accurate way have an timer interrupt happen every second in RISC-V. We understand that the internal clock is generally inaccurate, but were still wondering ...
Mattwmaster58's user avatar
2 votes
1 answer
137 views

Triggering ADC conversions with a timer on the MSP430FR5969

I am trying to repeatedly sample one channel from the ADC on my MSP430FR5969 using timer TA0. Unfortunately, the timer doesn't appear to be causing conversions. I expect my issue lies in my ...
Rohan Menon's user avatar
2 votes
3 answers
500 views

Arduino Uno prescaler, not measuring what I expected

I'm using the following code to set a pin high or low (each cycle.) I measure that pin with a logic analyzer. I use an Arduino Uno with 16MHz frequency. I set a timer interrupt with a prescaler of 64, ...
Mart's user avatar
  • 376
-1 votes
2 answers
1k views

STM32: How can i poll a GPIO pin until 100ms using timer interrupt?

I am currently use nucleo-board and I try to poll a pin until 100ms. I activated timer interrupt. So basically if pin is not high (digital '1') until 100ms the function must returns false. I share my ...
qt_goodi's user avatar
0 votes
1 answer
319 views

Faster Timer0 overflow than 2 ms on Attiny85

I'm trying to get a Timer0 overflow with an overflow every 500us, but can't find a solution to get it so low. I'm running the Attiny85 on its internal 1 MHz clock, so I know it is not gonna be the ...
jonas's user avatar
  • 309
0 votes
0 answers
2k views

How to update period of a timer every interrupt on stm32 with preload enabled?

I'd like to change timer period inside interrupt handler that is equivalent to AVR code ISR(TIMER0_COMP_vect){ OCR0 == new_value } As I undestand the documentation,...
Gryphon's user avatar
  • 103
0 votes
1 answer
585 views

MSP430 Timer Interrupt Not Happening

I recently starting learning how to program a MSP430 and thought I'd start by writing a program to turn a LED on and off every second. However, when I run my code the LED goes on an stays on. When I ...
dman's user avatar
  • 31
0 votes
2 answers
831 views

How to exit from an interrupt's loop for MSP430

I'm new to MSP430 and microcontrollers. Right now I'm learning interrupt routines and trying to write a program that changes the LED's state (OFF-ON-BLINK) by every press on P1.1 button. I have used ...
Efe's user avatar
  • 35
0 votes
1 answer
231 views

Error Real Time Clock implementation AVR microcontroller

I want to create a real-time clock using ATmega328p microcontroller. The microcontroller's frequency is 1 MHz. So, I think I should use timer interrupts in CTC mode to generate interrupt every second. ...
manueld4722623's user avatar
0 votes
4 answers
274 views

Crystal tolerances and what that means for timer interrupts

I'm developing a system that needs to periodically wake up and perform a process. We're currently targeting for an hourly wake up (give or take, this spec is very loose). The key here is the unit cost ...
epietrowicz's user avatar
0 votes
1 answer
404 views

How to use PIC16F84A TMR0 Interrupt as a substitute to the Sleep instruction in Assembly

I have this circuit: So my problem is that I'm having trouble using the TMR0 interrupt as a delay or substitute to the SLEEP instruction in the PIC16F84A. I can't quite get the concept of using the ...
German III Felisarta's user avatar
0 votes
1 answer
926 views

MSP430 Timer Interrupt Not Triggering

I'll post my code below. The problem is that the MSP's ISR_TRAP function (a function that handles ISRs that are not otherwise handled) is triggering and trapping me in its endless loop. This happens ...
Formeanlegion's user avatar
1 vote
0 answers
893 views

STM32 - Configure Output Compare Registers on the Fly

since this is my first, feel free to give newbie a feedback :) I have a following setup with my STM32 Nucleo (simplified, ignore the HW behind): a) one input signal acquisition (Square wave, consider ...
aljazjelen's user avatar
2 votes
2 answers
1k views

Context Switch in C in 32-Bit MCU

I am trying to understand the concept of 'Context switch' in reference to C-language and 32-bit MCUs. For example if I am programming STM32F407 MCU in C-language using STM32CubeIDE and I want to ...
homecloud's user avatar
  • 139
-1 votes
1 answer
354 views

STM8 alarm firing shortly after resetting time

I'm using an STM8L151F3 with the SPL, compiled with SDCC. I'm trying to generate an alarm interrupt after n seconds, then another after m seconds. To do that, I reset the time to 0, then set the alarm ...
Jackson Seal's user avatar
0 votes
1 answer
271 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 ...
Kile's user avatar
  • 34
1 vote
0 answers
1k views

What is the difference between TIMx_IRQHandler and HAL_TIM_PeriodElapsedCallback function?

I am a beginner, I am using the stm32F103 interrupt function TIM1_IRQHandler function to count, but HAL_TIM_PerodElapsedCallback can also achieve accurate counting, which one should I choose to use? ...
eezhijun's user avatar
1 vote
1 answer
837 views

How to achieve an interrupt frequency of 100 kHz on SAM E70?

Setup: ATMEL Studio 7, ASF3.47.0, SAME70 XPlained eval board. In the minimum working example shown below, I use the onboard LED for visualizing if the timer and interrupt enabling have executed. <...
Hansel's user avatar
  • 333
0 votes
1 answer
1k views

timer input capture for really low frequencies

How low of a frequency can a timer be used to measure an external signal in "input capture" mode? If I need to measure something that has a frequency of say 1hz - 2hz... or even slower for that ...
scottc11's user avatar
  • 433
1 vote
4 answers
3k views

What happens if an interrupt callback execution is interrupted by the same interrupt?

I have a microsecond timer (generates interruption every microsecond) for which I implemented a "HAL_TIM_PeriodElapsedCallback" function. What occurs if the ...
DTl's user avatar
  • 117
0 votes
2 answers
982 views

What is the difference between IQRn 0 and IRQn 1?

I am using STM32CubeMX to program my chip. Essentially I have a timer that i am trying to set to one ms, and every time that timer reaches a ms I want to toggle a pin. My question is that does it ...
user9964422's user avatar
0 votes
1 answer
1k views

timer interrupt on STM32F303

I'm kind of a newbie so excuse me if this is a beginner's question. tried to find an answer but couldn't find one. I'm working on STM32f3Discovery eval board, with the stm32f303vc on it. The code ...
Elad's user avatar
  • 43
0 votes
0 answers
285 views

Calling a function that uses HW_Delay inside timer interrupt

I have the following timer interrupt configuration ...
andreahmed's user avatar
0 votes
0 answers
167 views

PIC timer1 interrupt never occurs

I am trying to use timer1 interrupt on PIC18F26K83. I use Micro C as compiler. So I set my timer for 30 ms and after that 30 ms, it is supposed to enter an interrupt and light the LED. But it never ...
Günkut Ağabeyoğlu's user avatar
6 votes
1 answer
2k views

Inaccurate timer interrupt STM32

I wrote a simple program to toggle an LED on and off using the TIM1 interrupt on an STM32F0 discovery board. CLK Freq = 48MHz Prescalar = 48000 Auto Reload Register = 1000 Using the following ...
user150963's user avatar
0 votes
0 answers
317 views

Problem with using Timer Counter interrupt on Atmel ARM

I'm using an ATSAM4E16C microcontroller and i need to get a 1 millisecond tick. I want to implement this using the timer counter module to trigger an interrupt. The clock frequency is 96 MHz, so using ...
user3808318's user avatar
0 votes
1 answer
204 views

STM32F030(K6) Systick not triggering (BOOT0 problem)

I'm trying to write a simple program for a STM32F030K6T6 microcontroller. The problem I am facing is the more common "Systick is not working" problem. The code is generated using Cube32MX (Firmware 1....
Frank Berndsen's user avatar
0 votes
1 answer
561 views

Output Compare Interrupt does not work avr atmega

Hey I'm trying to do blinking led using interrupts on 16 bit timer. My atmega model is Atmega168A. Chip clock rate is 12Mhz. Here is my code: ...
bielu000's user avatar
  • 139
-2 votes
1 answer
80 views

Counting slow to fast in a microcontroller.(Ramp)

I want to make an increment(++) to a variable initially slowly then speed up linearly. For example, using a timer interrupt(every 1 sec) in increase the variable x by 1.so at first variable get ...
litun bls's user avatar
  • 191
2 votes
1 answer
14k views

How to dynamically adjust a timer with STM32

I've got this timer (TIM4) that's in PWM mode. I'm outputting one PWM channel and i want to wait a bit, and then grab the latest ADC samples from a DMA conversion. TIM4 -> ARR is 4096 TIM4 -> CCR1 ...
testname123's user avatar
0 votes
1 answer
3k views

How to set two timers running at the same time in atmega328p?

I want to set up two timers running two ISR-s with different resolutions. One timer for counting milliseconds for clock time, another for counting microseconds when ...
flowian's user avatar
  • 109
0 votes
1 answer
869 views

How to use two timers for one interrupt vector on avr?

I want to use timer1 and timer2 for same vector TIMER#_COMPA_vect isr on atmega328p. Idea is to start and stop one when requested, for time sensitive functions. And ...
flowian's user avatar
  • 109
0 votes
1 answer
2k views

Wake up a PIC from sleep using Timer1 Interrupt

I tried to wake up a PIC (16F88) from sleep using Timer1 Interrupt with external crystal. But it doesn't work. I tested it using watch dog timer and it works. But I want to use Timer1 Interrupt. It ...
PLAA Hemantha's user avatar
0 votes
1 answer
514 views

STM32 one timer for multiple push buttons

I have a small project where I set up a timer interrupt to check the state of few buttons. Do I need to set up 1 timer per button or can I check 2 or 3 with 1 timer?
vib's user avatar
  • 343
4 votes
1 answer
9k views

STM32: Timer encoder reset

I configured my TIM4 as encoder input and everything is working well when I execute TIM_GetCounter(TIM4) But I would like to put the timer value back to 0 (reset?) when I press a push button with an ...
vib's user avatar
  • 343
0 votes
1 answer
1k views

Can I use Timer Input capture interrupt and GPIO interrupt on same line?

I use Timer Input Capture of STM32L476RG.Is it possible if a timer capture based on interrupt will disable normal EXTI interrupt on the same line? For example TIM2_CH1 can be input capture on PA0. ...
Arun Joe Cheriyan's user avatar
6 votes
2 answers
1k views

Nanosecond interrupt accuracy on a 64MHz microprocessor

I am currently designing a PCB with a 64MHz nRF52832 bluetooth MCU. I have an interrupt connected to this MCU which needs to be detected with 1-3 nanosecond accuracy. Unfortunately, the 64MHz MCU has ...
inushii's user avatar
  • 63
2 votes
2 answers
752 views

Unexplained interrupt behavior in AVR ATMEGA324P Timer Counter ISR

I have an ATMEGA324P controlling a dual motor driver circuit. I'm using the 16-bit Timer Counter 1 in Phase and Frequency Correct mode to create (2) PWM outputs using the ICR1 as the TOP value and the ...
Neelix's user avatar
  • 365
1 vote
2 answers
6k views

Arduino Atmega328 sleep mode with internal timer interrupt

I am trying to reduce the current consumption of my Atmega328 -Arduino- by using the sleep modes. In my code, I want to wake-up every 10ms, read the value from ADC, ...
Farzad's user avatar
  • 11
4 votes
2 answers
974 views

How to manually clear OC1A and OC1B?

On the arduino uno (= ATmega328/P), how can I manually clear the timer 1 output compare signal? The purpose of the code is to generate some output pulses after a precise interval from the input pulse....
AJMansfield's user avatar
2 votes
1 answer
145 views

Need help tracking down the source of a delay between timer interrupts on SAM MCU

I have a project that outputs a series of values to DACs with a precise timing interval. The problem is that sometimes there is a delay longer than expected between the system timer interrupt in which ...
GrixM's user avatar
  • 668
0 votes
1 answer
207 views

Why is the signal sawtooth shaped? [closed]

I am currently working with interfacing a stepper motor (4-pin bipolar), and providing it the propper input signal, such that it accelelrate and decellerate correctly. In recently also across an ...
Sorrow's user avatar
  • 133