Go Down

Topic: STM32 "for the rest of us" (Read 26975 times) previous topic - next topic


Apr 16, 2015, 08:35 pm Last Edit: Apr 17, 2015, 05:57 pm by mrburnette
The full Arduino experience but with small STM32 ARM boards is the goal I would humbly request from the developers forum.

The Maple Mini clone and your small generic are all I ask for - but as always people like me want the quick results that lots of working libraries offer - all fixed for next winter....

Go, developers, Go Go !!!
(with sincere thanks :) )
@Sunspot:  cute, but...

Anyone with some coding experience can also tackle the libraries AS these are difficult because one must have the specific sensor, display, etc.

As the ILI9341, the BMP180, Nokia 5110, etc.  are working, all anyone needs to do is use Winmerge against the STM32-centric versions and the AVR versions to identify what was changed.  Then, make a few notes and go tackle your own port.

Working libs can be submitted to Roger for hosting if the author does not have a github account.  In either case, we would like to include the information that Op_xyz has a working library for device abcd.

My projects



Apr 18, 2015, 06:35 pm Last Edit: Apr 18, 2015, 06:39 pm by mrburnette
This looks fun - new to me

- £2.05 to get a chip on-line



(insert URL stopped working - odd...)
Ah, the ESP8266 ... they are everywhere!  I have 3 (breakout version) on the bench but have not gotten to play (yet).

Roger has been working on a port for Arduino, but will shortly point to a new effort that seems to be going a bit stronger.

On another note, I have published a new STM32 Project on my Hackster.io page: Mesmerize


On another note, I have published a new STM32 Project on my Hackster.io page: Mesmerize

Hey! It works  :smiley-cool:

Had to change this for my STM32F103RC:
Code: [Select]

#define TFT_CS          PC7                 
#define TFT_DC          PC6               
#define TFT_RST         PC8   



I'd recommend you post to the other forum, as people are actively working on super high speed access to that display using DMA (Direct Memory Access)

Actually there are various versions of the lib with different attempts at DMA, which achieve very good speeds for certain types of functions, e.g. it depends if you are just setting individual pixels or drawing text or straight lines etc.
Work is being done on writing lines to local memory buffer and then writing the buffer to the display via DMA, which is faster than the current method.

Also in the long term, DMA will be asynchronous, so that you can write to a local ram buffer in the main code, then tell the DMA to transfer this to the display in the background, while the main code can do something else

However we need to get "blocking" / synchronous DMA working well before we look at Asynchronous / non-blocking DMA.
Freelance developer and IT consultant


Apr 19, 2015, 04:03 am Last Edit: Apr 19, 2015, 04:08 am by mrburnette
Hey! It works  :smiley-cool:
Had to change this for my STM32F103RC:

Code: [Select]

#define TFT_CS          PC7                  
#define TFT_DC          PC6                
#define TFT_RST         PC8  

@Jens,  Great!

The info Roger was wanting documented on the main STM32 thread is the display controller model # and the pinout and any other info that you may note in your test that would relate to coding/wiring.  This is really helpful.  Posting in both threads is appropriate; have as much room here as you want and drop a summary over on the main thread.  Thanks!

There are 'nuff fingers in the libs, so except for a few changes such as faux SoftwareSerail.h, I have tried to stay out of their sandbox and concentrate to generic Sketch Code to actually make use of the ported libs Like here

Having a set of simple programs that utilize various sensors and multiple libs is in my Hackster.io projects..



Apr 19, 2015, 04:14 am Last Edit: Apr 19, 2015, 04:29 am by evildave_666
As the ILI9341, the BMP180, Nokia 5110, etc.  are working

Which 5110 libraries are working? I didn't see anything in the repo that said 5110 or PCD8544 so I assume that one or more of the standard ones work unchanged, is that correct?


Apr 19, 2015, 02:24 pm Last Edit: Apr 22, 2015, 06:51 pm by mrburnette
Which 5110 libraries are working? I didn't see anything in the repo that said 5110 or PCD8544 so I assume that one or more of the standard ones work unchanged, is that correct?
Generic Nokia 5110:


I am not a really big fan of creating a library for the 5110 as functions work very well.  A library would be easy to implement but the Nokia display is so easy to implement with a few functions that I see no particular reason to increase the overhead by using a library.



Apr 22, 2015, 06:51 pm Last Edit: Apr 22, 2015, 07:53 pm by mrburnette
Which 5110 libraries are working? I didn't see anything in the repo that said 5110 or PCD8544 so I assume that one or more of the standard ones work unchanged, is that correct?
A NOKIA 5110 (PCD8544) Library has been created.

Code: [Select]

Nokia5510 library by Matthias Diro
settings tested on maple mini
  HW SPI and soft SPI tested
  do not use as slave (SCE) pin 7

Tested by R. Burnette 20150422
Arduino 1.7.2
  Sketch uses 17,764 bytes (16%) of program storage space. Maximum is 108,000 bytes.
  Global variables use 4,592 bytes of dynamic memory.
#include "SPI.h"
#include "pcd8544.h"
#define ADMAX 4095
#define ADPIN 15
#define PROGMEM

/*    Nokia 5110          Maple Mini STM32F103
  RED board      Signal      Signal (Pin#)
  ---------      -------     ----------
  Pin 1            Rst         Reset  ( 9)
  Pin 2            CE          SCE    (10)
  Pin 3            DC          D/C    ( 8)
  Pin 4            Din         MOSI   ( 4)
  Pin 5            Clk         SCLK   ( 6)
  Pin 6            Vcc
  Pin 7            LED
  Pin 8            GND

byte dc_pin = 8;    // Data/Command
byte reset_pin = 9;
byte cs_pin = 10;    // Chip Select

// Create a pcd8544 object using Hardware SPI
// (SPI1 on the Maple, add 2 as last argument for SPI2 (untested)).

pcd8544 lcd(dc_pin, reset_pin, cs_pin);

// For software SPI, any 5 pins.
// pcd8544 lcd(dc_pin, reset_pin, cs_pin, sdin_pin, sclk_pin);

// 2 rows by 16 cols smiley. First 16 bytes is first row,
// next 16 is second.
byte smile[] PROGMEM = {

void setup(void)
pinMode(11, INPUT_ANALOG);

lcd.begin();  // Always call lcd.begin() first.

// Fill the screen with characters
for (char ch = '!'; ch <= 't'; ch++)

// Set cursor to (character) column zero and row 0
lcd.println("Level: ");  // First line
lcd.println("Temp: ");   // println skips to second line

// Draw a double line
for (byte i = 0; i < PCD8544_WIDTH/2-2; i++)
lcd.data(0); // A blink pixel column

// Some small numbers
for (byte i = 0; i < 11; i++)

lcd.setCursor(0, 3);
lcd.println(" PCD8544");
lcd.println("    on");
#ifdef BOARD_maple
lcd.print("the Maple");
lcd.print(" Arduino");
// Draw an image.
lcd.gotoRc(4, 57);
lcd.bitmap(smile, 2, 16);

void loop(void)
byte i, val;

// Draw bar on row 0, pixel column 8*5
lcd.gotoRc(0, 8*5);
val = map(analogRead(11), 0, 4096, 8*5, 84);

        // the bar
for (i = 5*8; i < val; i++)
lcd.data(0b01111100); // Bar

// Write a fake temperature
lcd.gotoRc(1, 8*5);

// A degree sign
lcd.data(0b00000100); // Degree



I have been loading Arduino_STM32 into the Arduino IDE into a fresh copy of Win XP
My experience differs from the Wiki install instructions.

Some notes here


Hi, I try to use DS1307 and DS1302 RTC modules work on STM32,
I could upload code into Maple Mini 2 and Maple Rev3+ but when I'll do it COM port is not visible
on arduinoIDE. When put back "blink" code from examples then LED on board flash and COM
port is visible.
Does anyone tried to work with this modules on STM32 with success?
Or maybe is any another way to use RTC on STM32 Maple Mini or Rev3+ boards?


If the maple serial device doesnt appear, it means the code has crashed

A common cause of this is the library is attempting to setup or use a peripheral before the init code has run in libmaple (the core code)

I had a feeling that someone had already looked at this

You are better off posting to www.stm32duino.com in the libraries section, as there are far more people using STM32 there than here

BTW. The board has onboard RTC, but most cheap STM32 boards don't have the battery etc thats required to maintain the RTC when the power is removed.

Note. be carefull attaching a battery, read @ahulls experience on the stm32duino.com forum, and how he destroyed a button cell battery
Freelance developer and IT consultant


Tnx Roger, I'll move with this subject to stm32duino so ;)
have also few questions about sleep modes, as standard <avr/sleep.h> library do not work in my case


Ah yes

Sleep modes.

There are some current postings about that in the last few days

Freelance developer and IT consultant


I am using Nucleo 144 board with SMP32 F746ZG. I have to use IO expander PCF8574 for more GPIO pins. when i compiled code in arduino ide, it gives me error regarding PCF8574 library. Is there any other PCF8574 library available for STM32 F746GZ ?

Go Up