Go Down

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

mrburnette

#30
Apr 09, 2015, 03:53 pm Last Edit: Apr 09, 2015, 03:57 pm by mrburnette
I've checked YT, still didn't manage, there were some programming stuff about discovery boards and different than arduinoIDE program uploaders, some ST-Link tools,
I have an option on my IDE for upload method as ST-Link, but it shown me a message that it can't connect into st-link device - however windows seen st-link in device manager
The original implementation of the STM32 core project was directed toward the Maple and the Maple Mini clones.  The project grew to address a larger population of STM32 boards based on the STM32F103.

The project was never intended to be a "newbie" project as a replacement for the Arduino 8-bit UNO, Mini, Nano, etc.  It was intended for more experienced experimenters who for some reason had outgrown the 8-bit capacity but did not want to rush to the Due; that is, an inexpensive alternative based on easy to obtain Chinese clones of the Maple and Maple Mini.

Some of the boards (Maple Mini) support USB programming and connectivity much the same way that the ProMicro (32U4) does - it enumerates itself as a COMx port under the OS.  With Windows, this requires drivers to be installed; instructions are in the Github wiki.

Other development boards or boards that do not enumerate to a COMx port are usually programmed using ST-Link which requires that you purchase a programming device that goes into the PC USB port and connects to the ST-Link header on the board.  You can read through the long thread on the devices ordered and that worked (or did not work well.)  I use Windows can cannot recommend one.

This is very important and I am going to repeat this again: The STM32 core is not a beginner's project and while the core is working there are some serious issues documented on the github wiki.  Just as the issue with OneWire did not appear until a few days ago, I am sure there are other issues which will need work-arounds and fixes.  BUT, this is a hobby project and there is no guarantee that compatibility will occur - if you order an STM32 board and utilize the core, you need to know that you are on your own and the core is always in flux - as of this week, a few commands from LeafLabs were removed to align more toward the Arduino commands.

Many AVR 3rd party libraries will not work unchanged - consider this a warning.  If you do not understand how to hack a library or are not competent to look into a Due or Teensy3.1 library and ferret the logic - avoid the library.  You can check here on github to see if the core team has provided a replacement:  Ported-Working libraries for the STM32 (all functions may not work.)

When things are found that do not work (not libraries, basic Arduino commands) someone will hopefully have the hardware to validate the issue and the issue will be placed on the github wiki.  Roger will address the priority and determine if a workaround or fix will be appropriate - OR, the issue may simply be documented and left the way it is... depending on the impact.  There are no guarantees.


Ray
My Projects

rogerClark

Just to clarify

The STM32F1/libraries folder now contains a new folder called OneWireSTM

I have removed the old OneWire folder, as it was not getting found by the IDE (and I don't have time to debug the IDE)

Examples for OneWireSTM are in the examples folder

e.g.

hardware\Arduino_STM32\STM32F1\libraries\OneWireSTM\examples\DS18x20_Temperature

The updated examples reference the new folder name and new header name OneWireSTM.h

I have compiled and tested the DS18B20 example using pin 10 on my Maple board and it worked fine. I also tested on pin 15 and it was also OK.
Freelance developer and IT consultant
www.rogerclark.net

OZ2JP

Hi.

I try to make a "Hello World" with STM32 and I2C_LCD, but it dont work.

Code: [Select]

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x20, 16, 2);

void setup()
{
// initialize the LCD
lcd.begin();
// Turn on the blacklight and print a message.
lcd.backlight();
}

void loop()
{
  lcd.print("Hello, world!");
  delay(1000);
}




The address is confirmed with BusPirate and I can se the signal with my oscilloscope.

The display works with Arduino board.

It looks like the init is going wrong, as I can see flicker every time I send the string.

STM32F103RC and IDE ver. 1.6.3
--
Jens

rogerClark

Interesting

I've not tested this.

I think the LCD library was the one produced by LeafLabs and I'm not sure if its ever been updated :-(

If you have a github account, can you post this as an issue

Freelance developer and IT consultant
www.rogerclark.net

rogerClark

Guys,

I know some people like to see things visually in a video etc.

So I"ve done an update to my previous video, which describes how to get STM32 working in IDE 1.6.2 or newer



See https://www.youtube.com/watch?v=TePglhSkghg&feature=youtu.be



(Moderators. Sorry for cross posting, but there are 2 different audiences for this project)
Freelance developer and IT consultant
www.rogerclark.net

rogerClark

Unfortunately I don't have one of those displays.

I have a parallel version but not the I2C version

This issue could be I2C speed, its defaulted to FAST in the Wire lib as this works with most things and gives better speed.

But the speed is faster than the AVR boards (i.e AVR uses 100Khz and I think the STM32 default is more like 250kbps) so this may be the issue.


Its probably worth getting hold of the I2C Scanner from the "Arduino Playground" (written by Nick Gammon) and seeing if the display ID's show up on a scan.

To see if its I2C speed issue, look in

hardware\Arduino_STM32\STM32F1\libraries\Wire\Wire.cpp on the line at the bottom that reads

Code: [Select]

TwoWire Wire(PB6, PB7, SOFT_FAST);


and change it to



Code: [Select]
TwoWire Wire(PB6, PB7, SOFT_STANDARD);

which would bring the speed down to 100khz like the AVR boards.



I'm not sure if the version that LeafLabs shipped with the IDE (I.e the one we have) is any different from the normal one.

Looking online, the current version is a lot different from the one we have e.g. the new one can be downloaded from here

http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/LiquidCrystal_I2C.zip

I'd suggest that you try using the latest version instead of the possibly old version we have in the repo


I'll also look at the price of that display, if its just a few dollars I'll order one
Freelance developer and IT consultant
www.rogerclark.net

rogerClark

Freelance developer and IT consultant
www.rogerclark.net

Docedison

That board has worked for me with the FMalpartida I2C library...
There were some issues with the constructor and varying connections between the PCF8574 and the display.
There is a most comprehensive thread in the display section referring to this issue..
I have a level shifter  and a 3,3/5V boost mode switcher that I plan to assemble for a Teensy 3,1 next week.
I plan to use a 4 X 20 LCD with it.. I just need to get my desk cleared first.
It should work well as I've used that library many times before...


Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

OZ2JP

#38
Apr 14, 2015, 10:36 am Last Edit: Apr 14, 2015, 11:26 am by OZ2JP
Can you confirm if the board you have is this one ?
More like this one:
http://www.ebay.com/itm/Module-Display-Character-LCD-1602-16x2-HD44780-Controller-Yellow-Green-Backlight-/350662659597

...soldered together with this one:
http://www.ebay.com/itm/Board-Module-Port-IIC-I2C-TWI-SP-I-Serial-Interface-Arduino-1602-LCD-m2-/131331658861

This is a 5V display - it runs fine on 3.3V but then the contrast voltage must be -0.9V so I run it on 5V with scl/sda pull-up to 3.3V
--
Jens

OZ2JP

To see if its I2C speed issue, look in

hardware\Arduino_STM32\STM32F1\libraries\Wire\Wire.cpp on the line at the bottom that reads

Code: [Select]

TwoWire Wire(PB6, PB7, SOFT_FAST);


and change it to



Code: [Select]
TwoWire Wire(PB6, PB7, SOFT_STANDARD);

which would bring the speed down to 100khz like the AVR boards.

No luck with this.

Quote
Looking online, the current version is a lot different from the one we have e.g. the new one can be downloaded from here

http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/LiquidCrystal_I2C.zip

I'd suggest that you try using the latest version instead of the possibly old version we have in the repo
With this library it works fine - thank you.  8)
--
Jens

rogerClark

Cool

OK. So can you confirm I should remove the LCD_I2C library that is in the current files and replace with the one I linked to ?

Thanks

Roger
Freelance developer and IT consultant
www.rogerclark.net

rogerClark

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

Freelance developer and IT consultant
www.rogerclark.net

Sunspot

#42
Apr 14, 2015, 06:16 pm Last Edit: Apr 14, 2015, 06:20 pm by Sunspot
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!!

rogerClark

@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

Code: [Select]
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
Freelance developer and IT consultant
www.rogerclark.net

Sunspot

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

Go Up