STM32 "for the rest of us"

@Sunspot

Re: Generic STM32F103C8 board

I have started work on the a generic STM32F103C board type, rather than internally use the "variant" code for the Maple mini

The only difference you should see if you use this, is that pin PB9 is now available. It is not available on Maple mini because its use internally to reset the USB bus

This is somewhat of a work in process, so it would be good if you could give it a try and see if it works for you.
Because although the changes I made are not technically very difficult, there is a lot of manual searching and replacing of pin names / numbers.

PS.

I presume you are using the STM32 pin names e.g PA5 - which I feel is definitely the correct way to do things.

Roger
I will try but in a couple of days - pin names e.g PA5 work.

The large generic board blinks OK as delivered - it has space for a clock Xtal but none fitted - no real advantage over your small generic board - or the Mini I guess.

3 Maple Mini clones (below £4) arrived from 3 vendors. All blink and none show rework.

Using the Maple IDE on iMac I can program them via USB.
I have loaded your USB drivers but do not see the Minis - not sure how to activate the drivers.
Guess I can use serial like for generic but will wipe the USB boot SW?

This winter hobby is holding back spring jobs - OK in Oz!!

@Sunspot.

It looks like that large generic board just as a STM32F103C8 uP on it, so I agree its pointless getting one of those

http://www.ebay.com/itm/ARM-Cortex-M3-STM32F103C8T6-Minimum-System-Development-Board-STM32-48-Pin-NEW-/111514106343?pt=LH_DefaultDomain_0&hash=item19f6c239e7

Boards like this

http://www.ebay.co.uk/itm/STM32F103RC-Breakout-Board-STM32-Mini-System-Core-Board-Learning-Board-l-/251691116509?pt=LH_DefaultDomain_3&hash=item3a99f5a7dd

Are better as they have more Flash and more Ram and also have DAC

I think one other person on this thread has one of these (I do)

This board is pricey, but interesting

http://www.ebay.co.uk/itm/STM32-STM32F103RET6-Cortex-M3-ARM-header-board-512k-JTAG-SWD-STM32F103-/350630718937?pt=LH_DefaultDomain_0&hash=item51a3382dd9

As its and F103RET which is the same as used on the Maple RET6 board, and has more flash again (though the same ram)

These are also good value

http://www.ebay.co.uk/itm/1pcs-STM32F103ZET6-Minimum-System-Development-Board-ARM-STM32-Cortex-m3-M75-/291305557264?pt=LH_DefaultDomain_0&hash=item43d32a0d10

64k ram and I think 512K Flash (though it could be 256K, I'd need to double check)

They also have additional flash and eprom on the back

I have one of these, but have not had time to investigate how to make use of the external Flash and eeprom chips, but one of them is definitely connected to the I2C pins as it shows up when I run the i2C scanner

Lots of users enjoy playing with pin and socket boards and for them the larger boards - like the Mega and Uno - are fine.

"Chapter 2" users want to embed a cheap board that is hardly more than a large DIL package with serious speed and memory. They want to build useful - very often portable - devices.

Download, Google to debug, solder, USE!

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 :slight_smile: )

Sunspot:
<...>
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 :slight_smile: )

@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.

Ray
My projects

Ray,
This looks fun - new to me

  • £2.05 to get a chip on-line

http://www.ebay.co.uk/itm/ESP8266-Serial-WIFI-Wireless-TransceiveR-Module-Send-Receive-LWIP-AP-STA-IG-/261813690063?pt=LH_DefaultDomain_3&hash=item3cf54fdecf

see
http://www.esp8266.com/

(insert URL stopped working - odd...)

Sunspot:
Ray,
This looks fun - new to me

  • £2.05 to get a chip on-line

http://www.ebay.co.uk/itm/ESP8266-Serial-WIFI-Wireless-TransceiveR-Module-Send-Receive-LWIP-AP-STA-IG-/261813690063?pt=LH_DefaultDomain_3&hash=item3cf54fdecf

see
http://www.esp8266.com/

(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

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

Hey! It works :sunglasses:

Had to change this for my STM32F103RC:

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

Jens

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.

OZ2JP:
Hey! It works :sunglasses:
...
Had to change this for my STM32F103RC:

#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..

Ray

mrburnette:
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?

evildave_666:
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:

http://www.hackster.io/rayburne/bmp180-barometer-on-arm-32-bit-under-arduino-1-6-0

Added:
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.

Ray

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.

/*
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 = {
	0xE0,0x18,0x04,0x04,0x02,0x32,0x32,0x02,0x02,0x22,0x22,
	0x02,0x04,0x04,0x18,0xE0,0x07,0x18,0x20,0x22,0x44,0x48,
	0x48,0x48,0x48,0x48,0x48,0x44,0x22,0x20,0x18,0x07};


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

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

	// Fill the screen with characters
	for (char ch = '!'; ch <= 't'; ch++)
		lcd.print(ch);
	delay(2000);

	lcd.clear();
	// Set cursor to (character) column zero and row 0
	lcd.setCursor(0,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(0b00010100);
	lcd.data(0); // A blink pixel column

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

	lcd.setCursor(0, 3);
	lcd.println(" PCD8544");
	lcd.println("    on");
#ifdef BOARD_maple
	lcd.print("the Maple");
#else
	lcd.print(" Arduino");
#endif
	// 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
	lcd.clearRestOfLine();

	// Write a fake temperature
	lcd.gotoRc(1, 8*5);
	lcd.print("22.8");
	lcd.data(0);

	// A degree sign
	lcd.data(0b00000100); // Degree
	lcd.data(0b00001010);
	lcd.data(0b00000100);
	lcd.data(0);
	lcd.print('C');
	lcd.clearRestOfLine();
	delay(100);
}

Ray

IMG825_web.jpg

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

Tnx Roger, I'll move with this subject to stm32duino so :wink:
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

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 ?