You have already been pointed to the HardwareTimer examples. To be more specific, take a look at this one: https://github.com/stm32duino/STM32Examples/blob/main/examples/Peripherals/HardwareTimer/InputCapture/InputCapture.ino
That example uses "method 1" to measure frequency, but with 'X' (number ...
Search found 176 matches
- Thu Apr 10, 2025 9:34 pm
- Forum: General discussion
- Topic: Pulse Counter
- Replies: 9
- Views: 485
- Thu Apr 10, 2025 11:51 am
- Forum: General discussion
- Topic: Pulse Counter
- Replies: 9
- Views: 485
Re: Pulse Counter
You seem to be proposing different ways of measuring frequency, of either:
1) Measuring how much time it takes to count a certain number of pulses, say 10 of them. Or...
2) Counting how many pulses occur in a fixed time, like one second.
Either way can work, but you seem to be worried about what ...
1) Measuring how much time it takes to count a certain number of pulses, say 10 of them. Or...
2) Counting how many pulses occur in a fixed time, like one second.
Either way can work, but you seem to be worried about what ...
- Tue Apr 08, 2025 11:48 am
- Forum: General discussion
- Topic: Pulse Counter
- Replies: 9
- Views: 485
Re: Pulse Counter
Originally you said you wanted to get notified only after some number 'X' of pulses had been counted, but now you call that an "extreme case".
If "X" is much greater than 1, it might make sense to set up a timer for external clock, and have it generate an interrupt when X pulses have been counted ...
If "X" is much greater than 1, it might make sense to set up a timer for external clock, and have it generate an interrupt when X pulses have been counted ...
- Mon Mar 31, 2025 1:26 am
- Forum: General discussion
- Topic: Pulse Counter
- Replies: 9
- Views: 485
Re: Pulse Counter
I don't see that the HardwareTimer input capture is a great help by itself. You could use that to set up a callback, but you would have to process one callback/interrupt for each cycle of the input. That could be OK for frequencies into kHz range, but just using standard Arduino attachInterrupt ...
- Tue Mar 18, 2025 11:07 am
- Forum: General discussion
- Topic: PWM and code in the main loop
- Replies: 30
- Views: 3273
Re: PWM and code in the main loop
It shouldn't be that hard.
I took the code as provided, and made a few changes in line with what I already said.
It was generating pulses, but the whole timing was way out - pulses were like 25ms or 50ms! Maybe the prescaler was wrong, but instead of trying to see exactly what was happening there ...
I took the code as provided, and made a few changes in line with what I already said.
It was generating pulses, but the whole timing was way out - pulses were like 25ms or 50ms! Maybe the prescaler was wrong, but instead of trying to see exactly what was happening there ...
- Tue Mar 18, 2025 5:41 am
- Forum: General discussion
- Topic: SystemClock_Config() and extern "C"
- Replies: 6
- Views: 560
Re: SystemClock_Config() and extern "C"
What I don't understand is why that name gets mangled, while SystemClock_Config does not (even if defined in the same sketch). Maybe there is some other declaration/prototype for one of them, but not the other in some header file?
It appears to be due to this:
#ifdef __cplusplus
extern "C ...
- Tue Mar 18, 2025 5:38 am
- Forum: General discussion
- Topic: PWM and code in the main loop
- Replies: 30
- Views: 3273
Re: PWM and code in the main loop
So, did you fix this then?julian_lpp wrote: Tue Mar 18, 2025 5:15 amyes, ES_RGBW == 1 means "the neopixels have White led"ozcar wrote: Mon Mar 17, 2025 8:46 am Is ES_RGBW equal to 1 supposed to mean that you do have RGBW LEDs, or maybe that you do not have RGBW?
Code: Select all
#if ES_RGBW == 1
#define BITS_PER_LED 24
#else
#define BITS_PER_LED 32
#endif
- Mon Mar 17, 2025 7:45 pm
- Forum: General discussion
- Topic: SystemClock_Config() and extern "C"
- Replies: 6
- Views: 560
Re: SystemClock_Config() and extern "C"
In a currently active thread here, somebody had defined a DMA irq routine without extern "C". I was just going to advise them to add that, but I was wondering if that was also something you might get away with. So I decided to check.
They had both prototype/declaration and definition without the ...
They had both prototype/declaration and definition without the ...
- Mon Mar 17, 2025 8:46 am
- Forum: General discussion
- Topic: PWM and code in the main loop
- Replies: 30
- Views: 3273
Re: PWM and code in the main loop
Julian,
I think your main problem is that you are using the wrong DMA channel. You must have seen the "DMA1 request mapping" table in the reference manual, which shows "TIM4_CH1" as one of the sources of requests for DMA1 Channel1. The trouble is, you need DMA request for update event (which is the ...
I think your main problem is that you are using the wrong DMA channel. You must have seen the "DMA1 request mapping" table in the reference manual, which shows "TIM4_CH1" as one of the sources of requests for DMA1 Channel1. The trouble is, you need DMA request for update event (which is the ...
- Sat Mar 15, 2025 9:58 pm
- Forum: General discussion
- Topic: PWM and code in the main loop
- Replies: 30
- Views: 3273
Re: PWM and code in the main loop
Lots to cover here...
Doing what I suggested and just looping until you see the update event is the same tactic in that it still requires the code to run with interrupts disabled. That is not ideal, particularly if you have a lot of LEDs, but depending on what else needs to be done maybe this is of ...
Doing what I suggested and just looping until you see the update event is the same tactic in that it still requires the code to run with interrupts disabled. That is not ideal, particularly if you have a lot of LEDs, but depending on what else needs to be done maybe this is of ...