STM32, Maple and Maple mini port to IDE 1.5.x

mrbwa1:
You guys sucked me in. I'm probably not experienced enough to help with the code changes, but am am learning a lot and pretty well understand what you are doing.

Not sure I have any projects that I need an STM32 for, but I have lots of various sensors and components I can at least test and try to help out.

I was a bit interested in the Due, but I pre the small form factor boards like an Arduino micro or pro mini (I see there is a pro micro now too). The maple mini board seems like the perfect price point for a processor with some real potential for pushing limits. If nothing else, it'll help me learn ARM stuff better.

Checking the codebase is a great help ... this is how we identify limitations, etc. I have some experience in this area, so refer to some of my stuff if you like: here.

At $4, it does not matter if you have STM32 needs, it is only slightly more expensive than the 328 mini boards from last year! Of course, this year the 328P mini boards are under $2.25 USD - Moore's Law at work.

Ray

mrburnette:
Checking the codebase is a great help ... this is how we identify limitations, etc. I have some experience in this area, so refer to some of my stuff if you like: here.

At $4, it does not matter if you have STM32 needs, it is only slightly more expensive than the 328 mini boards from last year! Of course, this year the 328P mini boards are under $2.25 USD - Moore's Law at work.

Ray

I ordered basically the same board (but from eBay). I agree about the price point. I started my undergraduate life in Computer Science, but it was not for me. I did, however do c, c++, Java and even VB programming when I got into the management /IS program. Heck, I even took an EE course as an elective that was 1/2 about designing circuits and 1/2 about the Z80 processor architecture (if only they had Arduino back in the day... as in long ago enough that I did C programming on a UNIX system).

I have a bunch of Arduino stuff and had all these big plans, but have been turned off by the fact that you get a code example that works as is, but the commenting and structure is so poor, that it's nearly impossible to easily modify without really digging in. I guess I just need to tinker rather than drop in pre-made code. that said, I appreciate well written libraries where I can easily understand the API and get it to do what I want.

I could honestly care less about the shields, as I'd rather build my own stuff. It's easy enough to pick up a few ATMega chips when I'm ordering other components, so I'm starting to build my own (guess I need to learn to etch my own PCBs next).

Looking forward to the STM32 as a pure tinkering to get it working process. With Arduino, I have gotten bogged down trying to save as much power as possible that I have lost sight of making cool projects. I need to get back to making that fully autonomous system for monitoring the weather and garden soil so it can automatically water the plants.

Hello :slight_smile:

Finally managed to get it running ^^
Did someone already made a Pinout-Graph with Functions of these Pins. f. ex. SPI, PWM etc? Thx :3

~Straw

@strawmedia and @mrbawl

Just a gentle reminder that we now have a new dedicated forum for Arduino on STM32

http://www.stm32duino.com

I will still try to support users on the thread, but the new site will hopefully be better for everyone, as we can separate things into different sections and topics, and information will be much easier to find than it is in this one massive thread.

Thanks

Roger Clark

http://www.stm32duino.com

Arduino for STM32 continues to improve.

Rick Kimbal found an error in the setup for anyone using STLink, so I have integrated his changes into one board type and more boards will be updated as I get time, as as STLink is added as an upload option.

Work continues on the new DFU based Bootloader aka "Bootloader 2.0" and its hoped to make it 100% backwards compatible with the original Maple bootloader soon. (the only remaining issue is sketch upload to RAM, which is generally not worth having on the smaller boards but should be retained for backwards compat)

www.stm32duino.com now has 25 registered users (albeit 1 of them is me and 2 are admin accounts) so interest is increasing every day

Cheers

Roger

The STM32 forum is a brilliant idea, for many reasons.. well done to all those involved
I am sure I can now cut through all my confusion and get to the nuts !

I recently upgraded my IDE, I had several that I was using, but the main one was 1.0.4 ! yes you read that right !

I like the latest version, but its a shame that errors are given as a line number rather than code highlighted !!

Anyway, back to the forum, I have just joined and will spend some time reading and asking some really dumb questions !!

I am wondering if anyone has added any RF24 (nrf24L01) library input yet ?

@mcnobby

I've not heard of anyone using the NRF24L01 library

I can't see it would be a big problem to port or it may just work straight out of the box, is it SPI ??

Yeah, thats what I was thinking.. its just SPI with two other connection CE & CSN
I have literally dozens of units running with a variety of the nordic radio boards.. I love em ! :slight_smile:

The only issue we may have with a lib that uses SPI, is whether it attemps to set the CE/CS lines in its constuctor, because basically its bad practice to do that, because C doesnt guarantee the order it runs global constructors, and we've had libs where the constructor for the library was trying to use pinMode before the pin mapping table was setup (because the table is not const its a normal dynamic array thats inited by the core code depending on various factors)

Anyway, the proof of the pudding..... etc etc

rogerClark:
The only issue we may have with a lib that uses SPI, is whether it attemps to set the CE/CS lines in its constuctor, because basically its bad practice to do that

Oh dear....

RF24 radio(RF24_CE,RF24_CSN);

depends whether it actually trys to use the pins in the constructor

Can we take this discussion to the new forum :wink:

Dhrystone and Whetstone Benchmarks on STM32F103xx

Over the weekend I got dhrystone and whetstone benchmarks to run both on a 16MHz ATmega2560 (there's not enough RAM on an ATmega328P) and on my Baite Electronics Maple clone.

First the integer maths dhrystone:

ATmega2560 16MHz

Dhrystone Benchmark, Version 2.1 (Language: C)
Execution starts, 300000 runs through Dhrystone

Execution ends
Microseconds for one run through Dhrystone: 78.67
Dhrystones per Second: 12711.22
VAX MIPS rating = 7.23

STM32F103 72MHz

Dhrystone Benchmark, Version 2.1 (Language: C)
Execution starts, 300000 runs through Dhrystone

Execution ends
Microseconds for one run through Dhrystone: 11.66
Dhrystones per Second: 85762.68
VAX MIPS rating = 48.81

The STM32F103 is executing Dhrystones at approximately 6.75 times the speed of the ATmega2560. This will mostly be down to the faster clock plus the fact that 16 bit arithmetic is quicker on a 32bit machine than and 8 bit one.

The traditional dhrystone code has been modified to use Arduino's Serial.print() function rather than printf

The code be downloaded from here as a zip file Dhrystone

The Whetstone is the classic floating point benchmark

The Whetstone test code adapted for Arduino by Thomas Kirchner is here

When run on a standard Arduino 16MHz Duemillenove the Whetstone produced the following result

Starting Whetstone benchmark...
Loops: 1000 Iterations: 1 Duration: 81740 millisec.
C Converted Double Precision Whetstones: 1.22 MIPS

On the STM32F103 board with a 72MHz clock

Starting Whetstone benchmark...
Loops: 1000 Iterations: 1 Duration: 19691 millisec.
C Converted Double Precision Whetstones: 5.08 MIPS

So the STM32F103 appears to be running Whetstone at approximately four times the speed of the Arduino.

Dhrystone and Whetstone are the classic benchmarks - but not generally representative of real applications. Take the figures for guidance purposes only.

Ken

VAX MIPS rating

That takes me back! (or dates me...)

My first job out of university was programming on a VAX 11/780, which was the original definition of 1 MIP! Up to 20 of us shared that old 11/780 using VT terminals.

Even a 16MHz ATMega scores over 7 mips!

Ken

I think you have registered on the new forum

I have a 168mhz F4 board as well, ( one other person on the forum has the same board as me), and it would be interesting to see how they stack up because as well as a high clock speed the F4 has a floating point processor in it.

Hello.

I've got this chinese clone from ebay, it's STM32F103C series, which is what is selected in the Board menu of Arduino IDE 1.6.3

I followed the instructions on Installation · rogerclarkmelbourne/Arduino_STM32 Wiki · GitHub

Then in "Perpetual bootloader" mode, i compiled MrBrunette's Blink example and i get this error:

Build options changed, rebuilding all

Sketch uses 13,616 bytes (10%) of program storage space. Maximum is 128,000 bytes.
Global variables use 3,888 bytes of dynamic memory.
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY

Cannot handle device "/dev/ttyACM0"
Failed to open port: /dev/ttyACM0

I've tried:
sudo chmod 600 /dev/ttyACM0

But that doesnt change anything.

Here is my boards.txt file, if it would help:

###################### Generic STM32F103C  ########################################

genericSTM32F103C.name= Generic STM32F103C series
genericSTM32F103C.build.variant=generic_stm32f103c
genericSTM32F103C.build.vect=VECT_TAB_ADDR=0x8000000
genericSTM32F103C.build.core=maple
genericSTM32F103C.build.board=GENERIC_STM32F103C
genericSTM32F103C.upload.use_1200bps_touch=false
genericSTM32F103C.upload.file_type=bin
genericSTM32F103C.upload.auto_reset=true

## STM32F103CB -------------------------
genericSTM32F103C.menu.device_variant.STM32F103CB=STM32F103CB (20k RAM. 128k Flash)
genericSTM32F103C.menu.device_variant.STM32F103CB.build.cpu_flags=-DMCU_STM32F103CB  
genericSTM32F103C.menu.device_variant.STM32F103CB.build.ldscript=ld/jtag.ld
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.maximum_size=128000
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.ram.maximum_size=20000
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.flash.maximum_size=128000


## STM32F103C8 -------------------------
genericSTM32F103C.menu.device_variant.STM32F103C8=STM32F103C8 (20k RAM. 648k Flash)
genericSTM32F103C.menu.device_variant.STM32F103C8.build.cpu_flags=-DMCU_STM32F103C8  
genericSTM32F103C.menu.device_variant.STM32F103C8.build.ldscript=ld/jtag_c8.ld
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.maximum_size=64000
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.ram.maximum_size=20000
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.flash.maximum_size=64000

#---------------------------- UPLOAD METHODS ---------------------------
genericSTM32F103C.menu.upload_method.serialMethod=Serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.protocol=maple_serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.tool=serial_upload


genericSTM32F103C.menu.upload_method.STLinkMethod=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1

Also noteworthy, this workaround is a must for Arduino IDE 1.6.3

http://www.rogerclark.net/work-around-for-arduino-stm32-with-ide-v-1-6-3-or-newer/

Hi @kevzl

We now have a new dedicated forum for Arduino on STM32 which I set up a few weeks ago.

See

www.stm32duino.com

Its probably best if you register and post on the new forum as more people now monitor that forum than read this thread

Thanks

Roger

Just seen THIS about the Neutrino, not as good as the STM32xxx, but nevertheless a nice product, hopefully the IDE will be ready for it soon :slight_smile:

Same price as a Teensy but less performance.

I'm surprised it made its financial target.

I will stick with a $5 Maple mini, which is almost twice as fast.

Albeit this device has 32k ram instead of 20k and 258k flash.
But I can't imagine who would need that much flash.

BTE.
@strawberrymaker is designing a Community STM32 board, on the www.stm32duino.com forum

It's likely to be better than that board and potentially cheaper, it will most likely have a F103RET processor which is better spec ed than that board

@Roger, Ok, just thought I would mention it, its not cheap but it IS another alternative when people are looking for 'faster/bigger than uno' alternatives.. its also a SAM which I think is similar to the Due

A community STM32 board ? wow thats great, what is the advantage over the ebay-uino's ?