Search found 146 matches

by ozcar
Sat May 09, 2020 4:12 am
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

So, after thinking again about it again for the situation if show_neopixels were to just clear UIF and then set UIE (without resetting counter): A few posts back I looked at what might happen if the update event were to happen between clearing of UIF and setting UIE. Because UIE is still not set, UI...
by ozcar
Sat May 09, 2020 2:45 am
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

If you check my code I do set the timer count to 0 before clearing the UIF flag so the counter will be at the beginning of the count before the UIF flag is cleared. You are right, I missed that you said you reset the counter - so what you are doing was my "slightly more cautious" suggesti...
by ozcar
Fri May 08, 2020 10:56 pm
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

A simple fix I think is to reset the timer and clear the UIF flag just before enabling the interrupt flag in void show_neopixels(). Please test the updated version on my github :) That is exactly what I already tried, and it seemed to work. Well, I did try to think whether there was still some tiny...
by ozcar
Fri May 08, 2020 1:15 pm
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

I have changed my interrupt handler a little bit so that all the update code is inside the loop that tests TIM_SR_UIF bit and I don't reset this bit till the end of the handler that way it can't fire again till after exit. Please test this update and see if your still get a dropped bit https://gith...
by ozcar
Thu May 07, 2020 10:56 pm
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

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...
by ozcar
Thu May 07, 2020 10:52 am
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

I didn't look super close at your code so correct me if I am wrong. You create a buffer big enough to hold all the vaules for the CCR for 48 bits (I assume you can use uint8_t as values are always low) so that would be a total of an extra 48 bytes on top of the array that stores the whole led strip...
by ozcar
Thu May 07, 2020 3:31 am
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

Isn't this similar to how the Octo8211 library for Teensy is implemented? Uses three timer channels to drive 8 GPIO pins from DMA. This only uses one timer channel, but as was mentioned above this could be extended to use more timer channels to output data to several strings simultaneously. Could p...
by ozcar
Wed May 06, 2020 11:34 pm
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

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_UIE; //disable interrupt flag to end transmission. Yes you can tell that it is no longer transmitting by checking UIE, but as it stands y...
by ozcar
Wed May 06, 2020 1:43 pm
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

... Ok I have updated my driver a little to fix this problem Please test it and see if you get good results. I have changed a few things 1. set the OC1PE as u suggested to ensure CCR and ARR remain in sync. 2. I used to start and stop transmission by enabling or disabling the timer (flick the en bi...
by ozcar
Wed May 06, 2020 2:52 am
Forum: Projects
Topic: [F4] Neopixel driver using hardware timers
Replies: 50
Views: 33214

Re: [F4] Neopixel driver using hardware timers

... If anyone out there knows assembler I would be interested to know how many machine instructions my interrupter handler uses. I am using a STM32F407 so it is a 32bit RISC running at 168MHz so that is just under 6ns per instruction. I have not yet looked at your latest version. This was one attem...

Go to advanced search