using the STM peripheral library

krbonne
Thu Dec 31, 2015 5:20 pm
Hi,

I am working on a project to port the MMDVM (multimode digital voice modem) to generic STM32F1 and STM32F4 devices.
One of the objectives to rewrite the ADC and DAC code to use DMA. I have already test-code for that, but that uses the standaard ST peripheral libraries and ARM CMSIS libraries
*MMDVM (multimode digital voice modem) – https://groups.yahoo.com/neo/groups/mmdvm/info

Can somebody explain how to incorperate ST std-lib and arm cmsis code into a application using stm32duino as these libraries do not seams to be included in stm32duino?

And .. all the best for 2016 to everybody! :-)

Cheerio! Kr. Bonne


mrburnette
Thu Dec 31, 2015 6:07 pm
krbonne wrote:
<…>
Can somebody explain how to incorporate ST std-lib and arm cmsis code into a application using stm32duino as these libraries do not seams to be included in stm32duino?

RogerClark
Thu Dec 31, 2015 7:35 pm
Just to reiterate what Ray has said.

The main F1 and F4 cores are not based on the Standard peripheral library.
(This is because the license on the STM code when the core was originally written in 2012 did not allow reditribution of the code)

There is a completely different core written by @sheepdoll which uses code generated by the STMCube i.e the HAL SPL, but its only at Alpha, and not being actively developed.

You could look at Koduino and also the MakerLabMe cores as I think they both use the CMSIS, but MakerLabMe is not being actively developed any more.


sheepdoll
Thu Dec 31, 2015 9:41 pm
RogerClark wrote:

There is a completely different core written by @sheepdoll which uses code generated by the STMCube i.e the HAL SPL, but its only at Alpha, and not being actively developed.


krbonne
Fri Jan 01, 2016 3:57 am
Ray,

mrburnette wrote:krbonne wrote:
<…>
Can somebody explain how to incorporate ST std-lib and arm cmsis code into a application using stm32duino as these libraries do not seams to be included in stm32duino?


mrburnette
Fri Jan 01, 2016 3:11 pm
krbonne wrote:
<…>
In short, arduino / stm32duino looks like the most interesting option for us (continued support for arduino due, support for stm32f1 and stm32f4 and to support possible future hardware extensions), but I need more information on the possibility to implement DMA-based ADC/DAC operations.
Perhaps you can advice us if stm32duino would be well suited for the first option.
Cheerio! Kr. Bonne.

krbonne
Fri Jan 01, 2016 9:57 pm
Ray,

mrburnette wrote:
I am wondering how your team came to select the STM32Fxxx series as the successor to the AT91SAM3X8E on the Due? My first choice would have been to move to the Teensy3.1/3.2 This product, while 5x the price of the Maple Mini clone ($4) is still a tremendous bang for the buck – especially when you consider the amount of effort Paul Stoffregen has put into the libraries and into Arduino as a whole.
It is my opinion that you should revisit the hosting microcontroller.
Ray


RogerClark
Fri Jan 01, 2016 10:07 pm
If you have to use the standard peripheral library, using this core is a non starter for you, as it doesnt use the SPL.

Try Koduino, https://github.com/avikde/koduino, it uses the SPL.

If the main thing for you is DMA, then our core supports DMA, but it uses its own non portable functions ( originally developed by LeafLabs, but with some recent additions for DMA of SPI)

BTW.
Why do you need to use the F4, is it the single precision maths FPU? or the higher clock rates.
If you need higher performance in the F1 series, the GD32F103 is a compatible device which is faster, because it has zero wait state flash, and also can be clocked up to 108MHz within its spec and in my experience can be overclocked to 120MHz under normal room temperature ranges, with no ill effects at all.


krbonne
Fri Jan 01, 2016 11:05 pm
Roger,

In fact, .. no I do not need the SPL itself. I need the ADC+DAC with DMA. I just happen to have the code for that available, but I will look in the mapple libraries to see if this fits our requirements.

Exactly what functions do I need to look at?

Concerning the type of processors, this is a not a descision by me, but the idea is that, as these STM32F4 CPUs are available anyway, why not use them. Jonathan has written an implementation of a C4FM demodulation (the modulation sceme used by Yeasu fusion and DMR) that works quite good but is quite CPU-intensive. (I think it uses pattern-matching techniques). GMSK demodulation does work OK on a cortex M3.
I myself are also interested in STM32F1 based application for AFSK based

This is an open-source hardware project aimed for ham-radio, so not really high-volume. The price-difference for a STM32F1 and a STM32F4 is not that large.
It could be that code-optimalisation will lower the CPU-requirements to such a level that the code also runs on a STM32F1, but .. as said, … as these STM32F4s are there anyway, why not use them?

Cheerio! Kr. Bonne.


martinayotte
Fri Jan 01, 2016 11:26 pm
krbonne wrote:The price-difference for a STM32F1 and a STM32F4 is not that large.

zmemw16
Fri Jan 01, 2016 11:33 pm
advanced search or via google site:http://www.stm32duino.com variation for ‘adc+dma+sound’

try these, origin
http://www.stm32duino.com/viewtopic.php … 8429#p8429

and the results
http://www.stm32duino.com/viewtopic.php … 8474#p8474

stephen


martinayotte
Sat Jan 02, 2016 2:21 am
@zmem16, after a New Year souper, it is a bit difficult to follow (although I’m trying to follow all STM32duino threads)…
Is it positive or negative ? …
(I didn’t work with DMA on STM yet, especially that I’m F4xx guy)

stevech
Sat Jan 02, 2016 7:46 am
note that ST’s “standard peripheral library” or SPL, is declared legacy and will go EOL sometime fairly soon.
It was replaced with the HAL, and those libraries are, I’ve found, more comprehensive and better documented. And managed by CubeMX.

But long time SPL users are understandably reluctant to change.


stevech
Sat Jan 02, 2016 7:47 am
stevech wrote:note that ST’s “standard peripheral library” or SPL, is declared legacy and will go EOL sometime fairly soon.
It was replaced with the STM32 type-agnostic HAL, and those libraries are, I’ve found, more comprehensive and better documented. And managed by CubeMX.

But long time SPL users are understandably reluctant to change.


zmemw16
Sat Jan 02, 2016 1:42 pm
martinayotte wrote:@zmem16, after a New Year souper, it is a bit difficult to follow (although I’m trying to follow all STM32duino threads)…
Is it positive or negative ? …
(I didn’t work with DMA on STM yet, especially that I’m F4xx guy)

zmemw16
Sat Jan 02, 2016 1:53 pm
zmemw16 wrote:martinayotte wrote:@zmem16, after a New Year souper, it is a bit difficult to follow (although I’m trying to follow all STM32duino threads)…
Is it positive or negative ? …
(I didn’t work with DMA on STM yet, especially that I’m F4xx guy)

RogerClark
Sat Jan 02, 2016 8:01 pm
krbonne wrote:Roger,

In fact, .. no I do not need the SPL itself. I need the ADC+DAC with DMA. I just happen to have the code for that available, but I will look in the mapple libraries to see if this fits our requirements.

Exactly what functions do I need to look at

Cheerio! Kr. Bonne.


martinayotte
Sat Jan 02, 2016 9:55 pm
@Roger, the ones at $5 ? they are not boards, they are bare chips that I will use on my own PCB for my daily job.

http://www.aliexpress.com/item/Chip-New … 60554.html

Hoping they genuine, I still waiting them from “slow-boat” …

If someone needs boards, maybe they can look at the STM32F4Stamp design from Frank Zhao, and tweak it to their needs.

http://eleccelerator.com/stm32f4stamp-breakout-board/


ahull
Sat Jan 02, 2016 11:35 pm
RogerClark wrote:krbonne wrote:Roger,

In fact, .. no I do not need the SPL itself. I need the ADC+DAC with DMA. I just happen to have the code for that available, but I will look in the mapple libraries to see if this fits our requirements.

Exactly what functions do I need to look at

Cheerio! Kr. Bonne.


dfwJones
Wed Jan 06, 2016 7:42 pm
Jumping in here as another of the MMDVM worker bees.

The code as it is today is only fast enough for two of the digital modes when running on a Due, even using the CMSIS libraries. Another one of the modes needs a lot more horsepower. Back of the envelope calculations suggest that the F405 with its higher speed clock and M4 core will be fast enough – barely.

There are at least 6 different hardware projects on the go to support MMDVM. Most are add-on boards to platforms including the Due and Teensy 3.x. There are a couple of the boards which will include the processor and the first prototypes are using the F405.

The current software is not using DMA, but is using a 24khz timer to trigger the ADC and DAC. I believe “analog/digtial loopback” code is working on the Due, Teensy and STM32Duino (F405). There’s also a version written for Koduino but that has a number of issues with the Koduino library and has been shelved for the time being.

I think there are two separate questions from the worker bees:
1) are there any pointers to get the ADC/DAC /w DMA working on the F405 under STM32Duino
2) are there any pointers to getting CMSIS working for the F405 under STM32Duino?

Thanks.

RogerClark wrote:If you have to use the standard peripheral library, using this core is a non starter for you, as it doesnt use the SPL.

Try Koduino, https://github.com/avikde/koduino, it uses the SPL.

If the main thing for you is DMA, then our core supports DMA, but it uses its own non portable functions ( originally developed by LeafLabs, but with some recent additions for DMA of SPI)

BTW.
Why do you need to use the F4, is it the single precision maths FPU? or the higher clock rates.
If you need higher performance in the F1 series, the GD32F103 is a compatible device which is faster, because it has zero wait state flash, and also can be clocked up to 108MHz within its spec and in my experience can be overclocked to 120MHz under normal room temperature ranges, with no ill effects at all.


RogerClark
Wed Jan 06, 2016 9:51 pm
I think there are two separate questions from the worker bees:
1) are there any pointers to get the ADC/DAC /w DMA working on the F405 under STM32Duino
2) are there any pointers to getting CMSIS working for the F405 under STM32Duino?

1. Unfortunately DMA on the F4 is a lot different to the way it works on the F1. I don’t know if anyone has used DMA on the F4 with the current STM32Duino core. (I don’t think so)

2. As has been previously described. The STM32Duino code base was written a long time ago (2012) when the CMSIS was not open source, hence it does not use the CMSIS.
You could try adding the CMSIS files into the core folder and see what happens, but I think you would probably be wasting your time.

Did you look at Koduino ?? Or @SheepDoll’s HALMX cores ??


stevech
Wed Jan 06, 2016 10:40 pm
ST’s HAL driver code from CUBEMX supports F1… F4
DMA option on most I/O devices, including ICU, SPI, UARTs, etc.
Different scenario than Arduino-alikes.

robca
Wed Jan 06, 2016 11:48 pm
I’m not familiar at all with the F405, but when I was looking options for my project (a fast ADC using simultaneous dual ADC with DMA on multiple channels), the F303 had much better ADC and DAC performance than just about any chip in the ST families

If you need to convert more than 2 channels on a F103, I have working code (can sample 4 channels at up to 500kHz per channel)


dfwJones
Thu Mar 03, 2016 4:11 pm
I owe everyone an update. I’ve spent way too much time working on this. Short version is that I don’t yet have it working using the CMSIS libraries. I’ve tried all the variations of STM libraries mentioned.

The longer version is that I ended up just extracting the one function I needed from the CMSIS source code and adding it directly into my project. Now I don’t have to worry about getting paths right for includes or libraries. I also pulled down the Dec 2015 version of CMSIS. At least for the function I’m using, the code has changed quite a bit.


mrburnette
Thu Mar 03, 2016 6:39 pm
dfwJones wrote:
<…>
Now I don’t have to worry about getting paths right for includes or libraries.

Leave a Reply

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