ws2812b… again… Sorry… on F4

Nutsy
Sat Mar 24, 2018 11:45 pm
So with my project I need to use addressable leds again…

However rogers library hes bundled with the stm32core isnt compiling with the f4vet6 genric core.

https://pastebin.com/6UmWGUJJ the compile command line….

Im already using SPI1 so i changed the hardware spi call to SPI2, didnt work…

i had assumed the spi calls are identical between the two cores. Am i missing something?


stevestrong
Sun Mar 25, 2018 9:06 am
You are not allowed to mix the cores.
Either use Roger’s one, or stick to generic as detected from your log:
Arduino\hardware\STM32GENERIC\STM32\libraries\SPI\src/SPI.h

Nutsy
Sun Mar 25, 2018 10:35 am
Oh….

In that case what else would I need to do to get the library to run?


Nutsy
Sun Mar 25, 2018 11:00 am
And to add, just tested, It also doesnt compile on rogers F4 core. Only the f1 cores.

stevestrong
Sun Mar 25, 2018 12:53 pm
If you would post the error codes we might be able to help.

Alternatively, you could give it a try with my repo, is further developed than Roger’s core regarding F4 stuff.


Nutsy
Sun Mar 25, 2018 1:15 pm
I commented out wireing private, as it was included but was an empty file….

installed your core

https://pastebin.com/dLARf02H

my guess is something to do with the way it calls dma transfer. i honestly dont know… My brain is turning into mush


stevestrong
Sun Mar 25, 2018 1:24 pm
I see, there is a missing DMA related function in the SPI lib for F4.
It needs to be implemented, which takes time, a missing ingredient.

Nutsy
Sun Mar 25, 2018 4:24 pm
Im assuming just copying the f1 SPI library wont work?

stevestrong
Sun Mar 25, 2018 4:47 pm
It won’t work, the DMA of F4 is different from F1.

mrburnette
Sun Mar 25, 2018 5:09 pm
[stevestrong – Sun Mar 25, 2018 9:06 am] –
You are not allowed to mix the cores.

Words of pure wisdom. … in addition to not mixing the cores, one also should not cross-the-streams.

Egon: Don’t cross the streams.
Peter: Why?
Egon: It would be bad.
Peter: I’m fuzzy on the whole good/bad thing. What do you mean “bad”?
Egon: Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light.
Raymond: Total protonic reversal.
Peter: That’s bad. Okay. Alright, important safety tip, thanks Egon.

Image


Nutsy
Sun Mar 25, 2018 6:47 pm
That would be bad :p

Nutsy
Mon Mar 26, 2018 6:31 pm
So do you feel this library would work, if the SPI library was updated to include all the functions?

mrburnette
Mon Mar 26, 2018 6:56 pm
[Nutsy – Mon Mar 26, 2018 6:31 pm] –
So do you feel this library would work, if the SPI library was updated to include all the functions?

Is that not what Steve implied here?

[stevestrong – Sun Mar 25, 2018 1:24 pm] –
I see, there is a missing DMA related function in the SPI lib for F4.
It needs to be implemented, which takes time, a missing ingredient.

Frédéric (and team) have done a good job with the Nucleo F4 boards
STM32F4

  • Nucleo F401RE
  • Nucleo F411RE
  • Nucleo F429ZI
  • Nucleo F446RE
  • STM32F407G-DISC1

and the wrappers for CubeMX + HAL.

The F4 support in libmaple has been somewhat weak from the start; Steve has made remarkable inroads with advancing the code, but I understand priorities and time constraints – which is why I simply shy away from backend core work … difficult to please the crowds.

IMO, the longterm solution to STM32 & ArduinoIDE is the https://github.com/stm32duino/Arduino_Core_STM32 … it is Official, it is supported, it utilizes current STM thinking on tools, and migrating to pro-tools is straightforward.

Ray


stevestrong
Mon Mar 26, 2018 10:12 pm
[Nutsy – Mon Mar 26, 2018 6:31 pm] –
So do you feel this library would work, if the SPI library was updated to include all the functions?

Yes, it is the function dmaSendAsync(), which was implemented by Victor for F1.
It is not yet ported to F4.


stevestrong
Sat Apr 07, 2018 8:20 am
I have ported the dmaSendAsync() function to my F4 repo, you may give it a try.

Nutsy
Sun Apr 08, 2018 11:00 pm
I havnt got my main dev computer running…

But i just tried to compile the strand test, copying the library over from the f1 lib directory… and commenting out the wire private include.

Sadly still didnt compile…

https://pastebin.com/Ey5Hf2rs << the error


stevestrong
Mon Apr 09, 2018 8:13 am
You should get my repo, it was updated 2 days ago with the changes related to “__IO”

Nutsy
Mon Apr 09, 2018 10:14 am
I really thought I did… :/

Will try again now.


Nutsy
Mon Apr 09, 2018 10:20 am
Yeah still getting the error
https://pastebin.com/qN9aZ8cL

stevestrong
Mon Apr 09, 2018 11:31 am
I have corrected the errors occurred during conflict merging the __IO stuff.
It should compile now error free.

Nutsy
Mon Apr 09, 2018 1:04 pm
Excellent… I cant do an in depth test with regards to the neo pixels… but it does indeed compile. When i get my main rig back up and running (waiting for PSU) i can do a propper test :D

Thanks Steve, this is a great help :)


Nutsy
Wed May 30, 2018 12:37 pm
Hi again sorry for the massive delay, the PSU took a whole month to turn up and by that time i started working on a different project that took up much of my time…

Im now back on this one. But having a little problem getting this working still….

I dont think its a core issue its just me trying to edit things and thats not working…

The normal library uses SPI 1 hardware… But i want to use the SPI2 pins…

ive tried editing the SPI calls in the library to SPI2 or SPI_2 but i get undeclared errors…

What am i missing? (apart from a brain obviously)


stevestrong
Wed May 30, 2018 2:06 pm
I don’t know what you are missing, but I am missing more information in order to help, for instance the error message, the used sketch, OS, upload method, …

Nutsy
Wed May 30, 2018 3:28 pm
Hi sorry… Umm well i sort of got round that error but it didnt start the leds up…

I added SPIClass SPI_2(2); to the library header after reading it on some other threads on how to activate the second spi…

While this did compile, the leds still didnt run in the strand test.

…. added
i reverted back to spi1 (SPI.) but still didnt work…


stevestrong
Wed May 30, 2018 6:20 pm
Check the connections again and try a simple SPI write at the beginning.
If it works then add some more code.

stevestrong
Fri Jun 01, 2018 1:21 pm
Actually, it is not necessary to define a new separate instance for SPI_2, it is enough to call
SPI.setModule(2);

Leave a Reply

Your email address will not be published. Required fields are marked *