Go Down

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

mrburnette

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

Ray
My projects

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

mrburnette

#47
Apr 18, 2015, 06:35 pm Last Edit: Apr 18, 2015, 06:39 pm by mrburnette
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

OZ2JP

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   
--
Jens

rogerClark

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.
Freelance developer and IT consultant
www.rogerclark.net

mrburnette

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

Ray

evildave_666

#51
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?

mrburnette

#52
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:

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

mrburnette

#53
Apr 22, 2015, 06:51 pm Last Edit: Apr 22, 2015, 07:53 pm by mrburnette
Quote
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 = {
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

Sunspot

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

bigplik

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?

rogerClark

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
www.rogerclark.net

bigplik

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

rogerClark

Ah yes

Sleep modes.

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

Freelance developer and IT consultant
www.rogerclark.net

urvi1995

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