STM32duino for a UAV project?

puedpued
Sat Jul 04, 2015 2:51 am
Hi guys,
I am working on micro unmanned aerial vehicles and looking for a microcontroller that is suitable for this project.
I mainly work on algorithms and theory stuff and when it comes to hardware and software I’m clueless, my questions are going to sound stupid so please bear with me.

I have tried to program the STM32F4 but the learning curve is way too steep and I could not get anything working :(
I have successfully programmed the arduino uno, however, it seems that the computation I need is too intensive for that board.

What I need to do:
– Control 4-5 micro servos
– DC Motor control
– Read a few analogue and digital signals
– Bluetooth, GPS, telemetry
– Kalman filter
– Nasty predictive control algorithm
All of which to be computed simultaneously

Therefore, it seems like the arduino for stm32 is the way to go.
I am considering the maple mini and the STM32F103C8T6 boards.

So my questions are:
1) Does the maple mini have an output voltage pin? I looked at the PCB and there aren’t any, am I missing something?

2) How does this arduino for stm32 actually works? Is it like something like this plug in-> install drivers-> open Arduino IDE-> Code -> upload -> DONE!! ???

3) Is the programming the same as arduino? What I mean is that is whether the way to code is the same? If I upload a code written for an Uno, assuming the pin numbers have been changed, would it work on this board?

4) Where is good place to start? I had a quick look at Roger Clark’s tutorial, will go into more detail if I decide to use the board.

5) Are these boards suitable for my project in general?

Thank you in advance for your help.


RogerClark
Sat Jul 04, 2015 3:22 am
So my questions are:
1) Does the maple mini have an output voltage pin? I looked at the PCB and there aren’t any, am I missing something?

No. You need to use a board with a STM32F103RC (or better, e.g. F103RE or F103VE or F103ZE)
Even then, these boards only have 2 DAC’s i.e you can only create 2 voltages. So if you need more than 2 voltage generators you’d need to use external hardware, i.e external SPI or I2C DAC

2) How does this arduino for stm32 actually works? Is it like something like this plug in-> install drivers-> open Arduino IDE-> Code -> upload -> DONE!! ???
Arduino STM32 is a “Third Party core”. You install the core (copy the files to the correct location), if you are using a board that has USB serial and you are using Windows, you need to run the install bat so that Windows loads the correct drivers for the USB Serial and DFU (upload).

3) Is the programming the same as arduino? What I mean is that is whether the way to code is the same? If I upload a code written for an Uno, assuming the pin numbers have been changed, would it work on this board?
Basically the API is the same. However for pin numbers, its best if you use the STM names for the pins e.g. PA4 is Port A, pin 4.
If you are using a Maple mini or Maple Rev 3 board etc you can use conventional pin numbers, but this only applies to the Maple hardware. All other boards are labeled with the PA/PB, PC etc numbering e.g. the STM32F103C8 boards normally have an LED on pin PC13 so if writing a blink sketch for that board you need to use PC13 as the pin number (however all the F103 boards are made by different companies, so all have the LED on different pins – and some boards don’t have a user controllable LED at all)

4) Where is good place to start? I had a quick look at Roger Clark’s tutorial, will go into more detail if I decide to use the board.
Watch the videos on youtube. Then look at the wiki on github.

5) Are these boards suitable for my project in general?
Hard to say.
Processing speed is much faster than on AVR (about 5 times faster), floating point can be double precision which is not available on AVR.
There is lots more RAM even on the F103C8 and Maple mini (20k).

If you want a more powerful board, take a look at the F103VET boards, they have more RAM and more flash (48k RAM).

BTW. The F4 support is taken from the AeroQuad project, so you may just want to look at that project instead of looking at this and using the F103 as the F103 may not have fast enough processing.

The F4 support in my repo is a lot less developed than the F103, but generally uses the Arduino API, albeit pre-Arduino 1.0 hence some API features like Stream are not supported at the moment.


puedpued
Sat Jul 04, 2015 3:47 am
Thank you so much Roger!!!

Let say I get this board,
http://www.ebay.com.au/itm/Hot-STM32F10 … 2a4a0081af

how do I upload the code to this guy? Do I need one of the ST-link or J-link thingy(what is the difference really)?
Or can I directly upload the program through the micro USB port?

The 103VE board maybe a little bit big for my application, I will probably order both and try them out though.


victor_pv
Sat Jul 04, 2015 4:15 am
You can upload code to that board 2 different ways:
1.- St-link
2.- USB to Serial adapter (3.3v compatible).

You can get either one in ebay for a few bucks. The st-link can be useful for debugging with GDB.
The usb to serial converter is cheaper, and you may have one laying around already.

You can also use either to upload the stm32duino bootloader. The bootloader is based on and works like the original Maple bootloader.
Once installed, it takes 8KB of flash space that you loose for your sketch, but it allows you to upload sketches thru the board usb port, so from that moment you dont need the usb-serial converter or st-link to upload sketches.
It is easier and simpler than having to have either of those connected, but in a board with so little flash, you may not be able to spare 8KB for the bootloader.

You can also upload the bootloader and use it until your sketches need all the flash, and then you just wipe it and use st-link or the usb2serial from that moment on.

That board you linked to uses the C8T6 version of the chip. That is 64KB of flash and 20KB of RAM, although in practice everyone seems to actually have 128KB of flash, right like it’s bigger brothers the CBT6. Now, that is not guaranteed, as it is out of spec and STM may decide to change it whenever they wish, but as long as they don’t, you have an extra 64KB of flash.

Last thing about that board. There are 2 very similar versions, Rick cleverly named them blue pill and red pill because each version is mostly found in the corresponding PCB color, although not always match. Do a search in the forum for blue pill or red pill to find the threads talking about them, there is small advantages and disadvantages on the USB connector and the regular used in each.


martinayotte
Sat Jul 04, 2015 4:22 am
@Roger
RogerClark wrote:The F4 support in my repo is a lot less developed than the F103, but generally uses the Arduino API, albeit pre-Arduino 1.0 hence some API features like Stream are not supported at the moment.

martinayotte
Sat Jul 04, 2015 4:27 am
victor_pv wrote:You can upload code to that board 2 different ways:
1.- St-link
2.- USB to Serial adapter (3.3v compatible).

victor_pv
Sat Jul 04, 2015 5:06 am
martinayotte wrote:@Roger
RogerClark wrote:The F4 support in my repo is a lot less developed than the F103, but generally uses the Arduino API, albeit pre-Arduino 1.0 hence some API features like Stream are not supported at the moment.

victor_pv
Sat Jul 04, 2015 5:07 am
martinayotte wrote:victor_pv wrote:You can upload code to that board 2 different ways:
1.- St-link
2.- USB to Serial adapter (3.3v compatible).

RogerClark
Sat Jul 04, 2015 6:13 am
martinayotte wrote:@Roger
RogerClark wrote:The F4 support in my repo is a lot less developed than the F103, but generally uses the Arduino API, albeit pre-Arduino 1.0 hence some API features like Stream are not supported at the moment.

RogerClark
Sat Jul 04, 2015 6:30 am
puedpued wrote:Thank you so much Roger!!!

Let say I get this board,
http://www.ebay.com.au/itm/Hot-STM32F10 … 2a4a0081af

how do I upload the code to this guy? Do I need one of the ST-link or J-link thingy(what is the difference really)?
Or can I directly upload the program through the micro USB port?

The 103VE board maybe a little bit big for my application, I will probably order both and try them out though.


puedpued
Sat Jul 04, 2015 6:44 am
RogerClark wrote:
You would be better off buying a Maple mini its virtually the same price and twice as much flash and comes with the bootloader pre-installed

e.g.

http://www.ebay.com.au/itm/1pc-STM32-AR … 5d4f8c3bd1

Note. We have had reports of some board being poor quality and the best supplier is Baite who are only on AliExpress (as they seem to be the actual manufacturer of the Maple mini clones

(there is a link in another thread, to the Baite shop on AliExpress)

The board you linked to also has an issue the USB connector not being that strong, its a mico USB not a mini usb and they are not fixed to the board very well, I had to glue mine down when the solder started to come loose.

If you buy a maple mini you don’t need any additional hardware e.g. You don’t need usb to serial or Stlink


RogerClark
Sat Jul 04, 2015 7:08 am
Why do you need a DAC ?

None of the STM board has 5V output as they are 3.3V devices


puedpued
Sat Jul 04, 2015 7:13 am
RogerClark wrote:Why do you need a DAC ?

RogerClark
Sat Jul 04, 2015 7:31 am
5V is input to the 3.3V regulator on the board

All STM32 devices are 3.3V i.e all outputs are 3.3V

Outputs on normal microprocessors are not designed to power external peripherals, they are only designed to power minimal loads or to send data.


puedpued
Sat Jul 04, 2015 7:52 am
Alright thank you again.
I think I’ll get them anyway and try to find another way to power other peripherals.

Just out of curiosity, what does the Vbat pin do?

Also, I have a STM32F411RE Nucleo development board lying around. Will this board work with arduino?


strawberrymaker
Sat Jul 04, 2015 10:16 am
if you need 5V output you could use couple of transistors, or directly go with a transistor array, which you can find in the ULN2803 Chip, which is pretty low cost. Or a logic converter should do the trick if you need connection from your peripheral and the Maple Mini.
For your information: If there is a Pin labelled with a voltage, f.ex. 5V you can use it for powering you devices or powering the board itself. This is the same as with Arduinos.
You dont need a dac to power your projects, as dacs output a variable voltage and not a constant one which you would need for your project.b

The VBat Pin is for an external battery which powers the RTC (Real-Time Clock) as all STM32 Boards offer a on-chip one. Which means you dont need an external one, like the DS1307. Mostly all RTC Chips offer a battery input to keep the time even if the power is disconnected.

The Nucleo boards can be used like a arduino, but that is more of an topic for @madias :)

~Straw


puedpued
Wed Jul 08, 2015 7:55 am
strawberrymaker wrote:if you need 5V output you could use couple of transistors, or directly go with a transistor array, which you can find in the ULN2803 Chip, which is pretty low cost. Or a logic converter should do the trick if you need connection from your peripheral and the Maple Mini.
For your information: If there is a Pin labelled with a voltage, f.ex. 5V you can use it for powering you devices or powering the board itself. This is the same as with Arduinos.
You dont need a dac to power your projects, as dacs output a variable voltage and not a constant one which you would need for your project.b

The VBat Pin is for an external battery which powers the RTC (Real-Time Clock) as all STM32 Boards offer a on-chip one. Which means you dont need an external one, like the DS1307. Mostly all RTC Chips offer a battery input to keep the time even if the power is disconnected.

The Nucleo boards can be used like a arduino, but that is more of an topic for @madias :)

~Straw


Leave a Reply

Your email address will not be published. Required fields are marked *