Search found 179 matches

by ozcar
Wed Jun 04, 2025 7:22 pm
Forum: Projects
Topic: USB↔BLUE.PILL→DMA→SPI→WS2812B
Replies: 8
Views: 2339

Re: USB↔BLUE.PILL→DMA→SPI→WS2812B


Why guys? could you please explain this to me? :roll:


Why what?

Why it takes that length of time to send data for 8 LEDs?

Why the code in question runs with interrupts disabled?

How SPI can be used instead?

BTW there are many old threads here where different ways of controlling such LEDs ...
by ozcar
Tue Jun 03, 2025 6:10 am
Forum: Projects
Topic: USB↔BLUE.PILL→DMA→SPI→WS2812B
Replies: 8
Views: 2339

Re: USB↔BLUE.PILL→DMA→SPI→WS2812B


the whole duration for one transmission is ~2us , so there is no problem to use a blocking little piece of code


Where does the 2μs come from?

For 800kHz LEDs the nominal transfer time is 1.25μs. Of course, that is per bit, so for 8 RGB LEDs the Neopixel library would disable interrupts for ...
by ozcar
Mon Jun 02, 2025 7:17 am
Forum: Projects
Topic: USB↔BLUE.PILL→DMA→SPI→WS2812B
Replies: 8
Views: 2339

Re: USB↔BLUE.PILL→DMA→SPI→WS2812B

If you just want to get your LEDs to work, the Adafruit Neopixel library has worked for some people. The timing of the pulses it generates is not very precise, but should be good enough. A potential problem with it, depending on what else you need to do, is that it disables interrupts for the ...
by ozcar
Thu Apr 10, 2025 9:34 pm
Forum: General discussion
Topic: Pulse Counter
Replies: 9
Views: 2159

Re: Pulse Counter

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 ...
by ozcar
Thu Apr 10, 2025 11:51 am
Forum: General discussion
Topic: Pulse Counter
Replies: 9
Views: 2159

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 ...
by ozcar
Tue Apr 08, 2025 11:48 am
Forum: General discussion
Topic: Pulse Counter
Replies: 9
Views: 2159

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 ...
by ozcar
Mon Mar 31, 2025 1:26 am
Forum: General discussion
Topic: Pulse Counter
Replies: 9
Views: 2159

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 ...
by ozcar
Tue Mar 18, 2025 11:07 am
Forum: General discussion
Topic: PWM and code in the main loop
Replies: 30
Views: 9610

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 ...
by ozcar
Tue Mar 18, 2025 5:41 am
Forum: General discussion
Topic: SystemClock_Config() and extern "C"
Replies: 7
Views: 1591

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 ...
by ozcar
Tue Mar 18, 2025 5:38 am
Forum: General discussion
Topic: PWM and code in the main loop
Replies: 30
Views: 9610

Re: PWM and code in the main loop

julian_lpp wrote: Tue Mar 18, 2025 5:15 am
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?
yes, ES_RGBW == 1 means "the neopixels have White led"
So, did you fix this then?

Code: Select all

#if ES_RGBW == 1
    #define BITS_PER_LED 24
#else
    #define BITS_PER_LED 32
#endif  

Go to advanced search