Search found 31 matches
- Sat May 09, 2020 11:08 pm
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
SPI i'd think is 'the other' easy method besides the timers. though for that matter stm32 has pretty elaborate timers. i'd guess is the varying period lengths which makes fixed periods timer implementation more troublesome. of course the other way is to do 100% and 0% duty cycle in the interrupts a...
- Sat May 09, 2020 4:52 am
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
If you are still not convinced, well, just clear the counter as well like you were doing. (Reminds me of the line "These are my principals. If you don’t like them, I have others." attributed to Groucho Marx.) With two DMA controllers with 8 streams each, I don't think I would be too worri...
- Sat May 09, 2020 3:17 am
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
I certainly did not see it ever misbehave when I tried just clearing UIF, but that does not prove that there is not still some small chance for it to do so. I'm also sort-of surprised that you never saw the original problem yourself. This got me to thinking about the possibility of running a test w...
- Fri May 08, 2020 11:19 pm
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
If you are still worried, then maybe set the counter to zero, clear UIF, then set UIE. Or if you really wanted to be sure, to be sure, you could clear EN in CR1, set the counter to zero, clear UIF, set UIE, and finally turn on EN again. I guess it depends on how hard you want to have to think wheth...
- Fri May 08, 2020 9:54 pm
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
The other bad news, is that my explanation is a bit long... Normally, let's say somewhere in the middle of generating the whole long stream of pulses, the execution of the interrupt routine is synchronised with the timer. That is, the interrupt routine always gets called just after the timer update...
- Fri May 08, 2020 7:53 am
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
If I miss the trigger there (which I can't see happening anyway), then I get to see nothing. With that in place, I saw it usually working OK and outputting 8 bits, but very occasionally only 7, with the first bit missing. I'm not saying it is going to fail exactly every 20th time - for me it was ve...
- Fri May 08, 2020 7:27 am
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
I suspect somebody may have done something similar already. I decided to check if this method has been used before, and the very first thing brought up by my uncle Google is this: http://stm32f4-discovery.net/2018/06/tutorial-control-ws2812b-leds-stm32/ . I did not look very closely at the actual c...
- Thu May 07, 2020 9:12 am
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
Inspired by Flyboy's code, I now came up with a version that uses DMA, but with a buffer only big enough for 2 LED's worth of data. Instead of having to handle one interrupt per bit, there is only 1 interrupt per LED (24 bits). The interrupt routine has to do more work now, but it still comes out a...
- Wed May 06, 2020 9:11 pm
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
You could maybe add something to know when the transmission is complete and there was been sufficient delay for the "reset". Probably the easiest way to do this is check the status of the UIE bit becuase the stopping of the transmission is done by this line. TIM4->DIER &= ~TIM_DIER_UI...
- Tue May 05, 2020 11:42 pm
- Forum: Projects
- Topic: [F4] Neopixel driver using hardware timers
- Replies: 50
- Views: 31315
Re: [F4] Neopixel driver using hardware timers
+1 @flyboy74 this is really nice, i've wanted to mess with timers doing something basically this & you have been there done that :D i think playing with ARR is a good way, of course another way may be to play with the output compare registers which would enable messing in 4 channels. If you whe...