New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32duino port (Maple, Blue Pill etc.) #568

Merged
merged 1 commit into from Aug 31, 2018

Conversation

Projects
None yet
5 participants
@kolyshkin
Contributor

kolyshkin commented Feb 15, 2018

This mostly builds on previous work for SparkCore STM32103 (Cortex M3),
and patches from Evey Quirk @evq.

Unfortunately, stm32duino distribution does not include a header
with definitions for CoreDebug registers and flags etc.
so they were added to a newly created cm3_regs.h from
https://github.com/ARM-software/CMSIS/blob/master/CMSIS/Include/core_cm3.h

Tested on my Blue Pill, works fine

@kolyshkin

This comment has been minimized.

Contributor

kolyshkin commented Feb 15, 2018

Should fix #142, #531, #564

@kolyshkin

This comment has been minimized.

Contributor

kolyshkin commented Mar 8, 2018

@focalintent PTAL, and let me know if I can improve anything

@jordanapplewhite

This comment has been minimized.

jordanapplewhite commented Apr 16, 2018

@kolyshkin Works great on APA102, but when I used it on WS2813 (a clockless chipset) the animation ran half as fast as the exact same code running on Uno. Any idea could be causing that? Thanks for your work on this!

@jordanapplewhite

This comment has been minimized.

jordanapplewhite commented Apr 18, 2018

Seems that when interrupts are disabled in order to send WS281x data then the SysTick isn't running. I set up a sketch to print seconds since program start. Each "second" took 2 seconds. When I disabled FastLED.show() the timer operated correctly. Not sure if this is an issue with this port or Arduino_STM32. I'm hoping there's a way to tweak the interrupt priority so SysTick always runs.

@focalintent

This comment has been minimized.

Member

focalintent commented Apr 18, 2018

The stm code defaults to not allowing interrupts while writing out WS2812 style led data - you can try changing this by putting:

#define FASTLED_ALLOW_INTERRUPTS 1

before you include FastLED.h. The initial stm32 code was done for the sparkcore MCUs, and I think I defaulted to keeping interrupts disabled because some of their interrupts always ran too long, but honestly I don't fully remember.

@jordanapplewhite

This comment has been minimized.

jordanapplewhite commented Apr 19, 2018

@focalintent Thanks for the suggestion. I tried allowing interrupts and it seems to fix the SysTick issue but then I experience the LED strip glitching or freezing on some animations (but not others, weirdly). I'll keep investigating.

@focalintent

This comment has been minimized.

Member

focalintent commented Apr 19, 2018

The glitching might be a sign of the WAIT_TIME parameter being a bit off. It also might be the frame retry that attempts to happen if an interrupt takes too long, that can cause some glitching effects - the stm clockless code is out of date compared to some of the others, so comment out lines 32 and 33 in platforms/arm/stm32/clockless_arm_stm32.h:

 29   virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
 30     mWait.wait();
 31     if(!showRGBInternal(pixels)) {
 32       sei(); delayMicroseconds(WAIT_TIME); cli();
 33       showRGBInternal(pixels);
 34     }
 35     mWait.mark();
 36   }
@Yona-Appletree

This comment has been minimized.

Yona-Appletree commented Aug 2, 2018

Would love to see this get merged. What work is still required here?

@focalintent

This comment has been minimized.

Member

focalintent commented Aug 26, 2018

The pin definitions need to be fixed to be numbers, among other things

stm32duino port (Maple, Blue Pill etc.)
This mostly builds on previous work for SparkCore STM32103 (Cortex M3),
and patches from Evey Quirk.

Unfortunately, stm32duino distribution does not include a header
with definitions for CoreDebug registers and flags etc. (used in )
so they were added to a newly created cm3_regs.h from
https://github.com/ARM-software/CMSIS/blob/master/CMSIS/Include/core_cm3.h

[v2: changed PIN numbers to be int]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin

This comment has been minimized.

Contributor

kolyshkin commented Aug 31, 2018

The pin definitions need to be fixed to be numbers, among other things

@focalintent thank you for your review; commit updated accordingly; also rebased to current master

@focalintent focalintent merged commit bf6b765 into FastLED:master Aug 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment