Question about the STM32F1, STM32F2, STM32F3 and STM32F4 Series - Page 1
Forum section: electronics / general

author: AgenteSoldier
author_rank: Newbie
timestamp: December 01, 2015, 05:38:28 pm
content: Hello everybody,to start off I would like to tell why I would need them and for what porpuse. After that I would go to the µC themself(if they are called that way). I just wanna say that I am not a native speaker in english so pardon some of my gramma mistakes and I have middle to upper understanding of electronics.For what do I need them:Right now I am working with 2 other guys on a master thesis and we are building an autonom roboter. For that reason we want to make our own circuit board, which can provide all of our needs. Yes we could just buy one and use that one, but we would like to make our own, because all of us have intrest in such a thing and would like to more about it and we could make it more compact and so on.So till now we have the following operations which we need to provide for the roboter on the circuit board:->We need to do the motor controll on it with our own constructed H-bridges(bridge circuits //maybe google fucked up on the translation)(0V->5V Logic, 0V->5V PWM)->We need to do take in the voltages of the sensors regarding objects around us (from 0V->5V analog values)->We want to programm the AI(Artificial Intelligence), which is doing all the regulations and the pathfinding and so on on the µC in C#(thats why I was looking at the STM32 Series)-> and many other stuff(just don't want to go too much into detail)Questions:Is it true that the maximum output of the STM32 Series is Vdd - Vss = 4V, meaning supply - ground Voltage, which would mean 4V max right? That would mean I would not be able to operate the above thingsBecause we would like to programm the AI and all the other stuff in C# is it really a good idea to look at this Series with the .NETMF or should I look somewhere else?If I would go for this one is there anything I need to take into mind before using it or should I be fine with it?I hope you guys can help me out would be really nice.Nice GreetsAgenteSoldier

author: langwadt
author_rank: Super Contributor
timestamp: December 01, 2015, 05:56:49 pm
content: 4V is absolute max you should never see that in normal use, you would run normally run at 3.3Valmost no "modern" cpus can run at 5V, the IC processes used are not made for thatwhy do you need 5V?

author: AgenteSoldier
author_rank: Newbie
timestamp: December 01, 2015, 06:07:25 pm
content: Quote from: langwadt on December 01, 2015, 05:56:49 pmThank you for your answerMy Sensor (Datasheet:http://www.sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a02yk_e.pdf) Recommends 4.5 to 5V so I would need this to get efficient readings out of it. On the otherhand you said modern "CPUS" normally don't run at 5V wouldn't that mean that the Arduino also would have no 5V output, but it does so why that?EDIT:Just realized that I don't need to use the Chip for the Vcc if I am right, which would mean I have no problem with it anymore

author: Jeroen3
author_rank: Super Contributor
timestamp: December 01, 2015, 06:10:21 pm
content: STM32 series, as are other brands, are TTL with 3.3V maximum Vdd or less for lower power specials, that means that a logic high equals Vdd or is pulled to ground.Refer to logic level converters to move around.Mostpins are 5V tolerant logic. That means that you can use it as an input for a 5V TLL signal.The ADC is analog mode, this is special. Read the datasheet.Analog level converting can be done using opamps, see the fundamentals friday of opamps. #600.I would never use Microsoft Java in an ARM Cortex M. I would get an Cortex-A with linux for this, and even then the idea makes me sick. It's just as ridiculous as Javascript on an micro. But, this is just me, a die-hard firmware guy. There are people that do this, and apparently they are successful because a lot of the mobile payment units around here run a custom linux job with C#.But, if you can find the tools and software to do this. Please do, otherwise use C++.Intel has some embedded stuff, did you look at those. These might fit AI better than an STM32.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 01, 2015, 06:21:28 pm
content: Quote from: Jeroen3 on December 01, 2015, 06:10:21 pmThank you for your answerThe thing is we would like to work with C#, because the language is really nice and nice to look at. Furthermore really complex stuff can mostly be easier in C# then in C++ thats another reason. What I saw from the Intel stuff is pretty pricy, which would mean I would more likely look towards the STM32.

author: richardman
author_rank: Frequent Contributor
timestamp: December 01, 2015, 06:47:39 pm
content: Most/all of the STM32F chips can handle 5V I/O on some of the pins. For simple robotic stuff, the F1xx series should be plenty fast enough. There's no C# solution though. For student uses, you are looking at either "free" GCC, or student license of a commercial compiler.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 01, 2015, 06:52:06 pm
content: Quote from: richardman on December 01, 2015, 06:47:39 pmThank you for your information.I heard, thats why I was even looking at this series, is that I would be able to programm the STM32 with my Visual Studio License and that in C#. Is it true now taht I can't programm C# on them, because I heard you can with the .NETMF

author: andersm
author_rank: Super Contributor
timestamp: December 01, 2015, 06:57:13 pm
content: Quote from: richardman on December 01, 2015, 06:47:39 pmThere's some version of the .NET Micro Framework that's beenported to the STM32 family, but I don't know anymore about it than what's on the webpage.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 01, 2015, 06:59:00 pm
content: Quote from: andersm on December 01, 2015, 06:57:13 pmWell thats why I was looking at them

author: Jeroen3
author_rank: Super Contributor
timestamp: December 01, 2015, 08:03:37 pm
content: Intel stuff is probably "free" for universities. I was talking about the Intel Edison. (I had to look it up)As is Altium designer and some other compilers/IDE's that offer edu packages. (Keil is not one of them)It has all the fancy stuff that will take you weeks to diy on an STM32, such as WiFi, Bluetooth and Ethernet and linux.With support for several IDE's. Not sure about C#, but if this is part of your main goals for your thesis it can be very educational.Will you be sharing it?

author: langwadt
author_rank: Super Contributor
timestamp: December 01, 2015, 08:13:56 pm
content: Quote from: AgenteSoldier on December 01, 2015, 06:07:25 pmcorrect.Arduinos can have 5V output but the AVR used on Arduino is a 20year old 8 bit cpu, it is fine for its purpose but I wouldn't call it "modern"compared to 100MHz 32 bit cortex'sanyway to me running C# on even a cortex4 sounds like bolting a couch to you bicycle because you want a comfortable seat

author: cncjerry
author_rank: Unknown
timestamp: December 01, 2015, 08:23:28 pm
content: there is a plug-in for Visual Studio that generates loadable code for that family of processors. I tried it, thought it was lame, expensive and don't think I ever got a debugger working. I would just use Eclipse with GCC as it is free an integrates well with GDB. C++ and C# are supported.I wouldn't interface the CPU directly with external I/O. If you are switching, use a transistor, pretty simple and gives you an extra buffer for spikes coming from motors, etc. As someone mentioned, they might be 5v tolerant but still I have blown more of those boards by forgetting the 3.3v than I care to mention. Also, not all the pins are 5VT, just some, and I don't remember if the ADC pins are at all. All it takes is one mistake on a 3.3v pin and the chip is toast. The development boards are cheap though, I use the F4-discovery also another that has the TFT as well as Nucleo boards. The Nucleos I think are like $9 for a pack of them. I think I bought 10 from Newark.Lastly, unless you have a lot of experience with embedded processors, I would start with something else. I have a ton of experience with this stuff and found the STMF4 family to be challenging. I start and stopped 3 times and went back to either PIC or Arduino for simple control systems. Lot of setup detail required for simple things. Once you get familiar with it, yes, it becomes easier and almost infinitely flexible but the learning curve is very high.Lastly if you are looking at closed loop systems I would use external ADC chips/boards. Again, it is much easier and maybe cheaper to just replace the ADC compared to scrapping an embedded development board. I've been testing the 24bit LT products and they work great.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 02, 2015, 08:23:52 am
content: Quote from: cncjerry on December 01, 2015, 08:23:28 pmThank you for your answer. It is really detailed so I learned a lot from it. The thing about getting a premade Board is that we don't want one, because we want to learn more about that stuff were the negative parts are and so on. That is why we are looking for a µC with C# supported.I will look into the first thing you mentioned if you have any more tipps maybe I would be glad to hear them and you convinced me the look away from the STM32 Series thanksDo you think you could recommend me towards a µC Series which would kinda fit my needs. I would be willing to go for C++ if needed but C# would be nice.

author: AlxDroidDev
author_rank: Frequent Contributor
timestamp: December 02, 2015, 08:41:04 am
content: If you don't want all the hassle that is dealing an ARM toolchain (which is a huge PITA), there is an option to work with the STM32F1 family with Arduino, which is simpler, easier and has a softer learning curve than anything the traditional ARM development methods have to offer.This is the bootloader:https://github.com/rogerclarkmelbourne/STM32duino-bootloaderMore info onwww.stm32duino.comI too am on the very early stage of learning ARM development, and I've tried Keil uVision and Atollic TrueStudio (the free version of both). After a few hours of each, I couldn't even get a led on PC.13 to blink. The I stumbled on stm32duino and within a few minutes I could get it to blink!Today I'll tryCooCox CoIDE, which is free, but has the same steep learning curve of the traditional ARM tools.

author: westfw
author_rank: Super Contributor
timestamp: December 02, 2015, 09:40:20 am
content: There are/were a couple of manufacturers offering .NET compatible (I think that means C#) on ARM chips and/or boards. "Open Source", so they may be good models for porting the .NET VM to other chips as well. Here are two that I dug up:http://www.netduino.com/https://www.ghielectronics.com/catalog/category/34

author: AndreasF
author_rank: Frequent Contributor
timestamp: December 02, 2015, 10:28:03 am
content: You mention two goals that in my mind don't quite fit together: on the one hand you say you don't want to go with a pre-made board because you want to learn the "nitty-gritty" hardware side of things. This is certainly commendable, as there is a lot to learn, and any pre-made, general purpose board could certainly be optimized for a specific application.On the other hand you are quite adamant about using C#. I agree with you that it is a very nice language, but it does come with downsides, such as the need to run on a "virtual machine". As others have said, you can get the .NET micro framework to run on some of the ST Cortex-M3/4 microcontrollers (I tried - it works), but it does the exact opposite of what you're trying with the hardware: it hides a lot of the details of how microcontrollers work in layers of abstraction (in an attempt to make the code independent of the actual hardware it runs on). You also have to be very aware of the limitations of this approach, just because you can write C# code for the .NET micro framework it is not the same as writing and running C# code on a standard desktop PC. Even modern microcontrollers are very resource limited devices.

author: dannyf
author_rank: Super Contributor
timestamp: December 02, 2015, 11:59:46 am
content: QuoteYou want to check the datasheet of the devices you are using for sure. Generally, those are <3.6v devices, with 5v tolerant pins. However, I have run them at 5v without no problem. If you have to do that, experiment first.QuoteTons of options:1) you may still interface directly - again, experiment;2) level translate;3) find devices that work at lower voltage;...If you want to run C#, maybe something closer to a processor (vs. a microcontroller) is appropriate. Like the Pi.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: December 02, 2015, 07:35:58 pm
content: I hate to be a downer on people trying to learn, but if you are looking to avoid voltage translation and want to write low-level stuff in C#, then you probably don't want to be tackling a complex embedded project.Level translation is not a big issue, you are going to have much more complex hardware problems than that. A lot of ARM chips have 5V tolerant pins (notably except Atmel), and there are a few ARM chips that run at 5V - e.g. Freescale KE series. But I wouldn't choose a chip just on that basis.I'm not entirely sure where .NETMF fits, it's a sledgehammer to crack a nut, but you lose a lot of performance and also it's a very cut down version of .NET. You would probably do just as well with C++, it's a much better trodden path. If you really must have something like C#, I would look at MicroPython as well.Personally I would pick on one part of the project as the focus, either hardware, software or application. Don't be afraid to use off the shelf components for the hardware or software, if you are trying to achieve your application goals. If it all goes swimmingly well, you will have time to implement your own custom components.But if you get bogged down with hardware and software issues you may never get to solving the application bit, which can be disheartening. Of course, a failed project can be as much of a learning exercise as a successful one.

author: DD4DA
author_rank: Contributor
timestamp: December 03, 2015, 08:22:41 am
content: I am a developer using STM32Fxx devices since 4 years. I can state that the ADC of the chip is poor in the F4. You need an avaraging routine with about 255 samples to get stable results if you decide to use the normal 3.3V that supplies the hole circuit. If you plan to use the ADC use a 3.3v precision voltage reference. A zener diode method is not exact enought.The 5V sensor can be used by using a voltage converter of open-collector driver.You can use every programming language on the STM32Fx if this called "C" :-). Don't waste time to do experiments with C++ or C# and .NET on that devices. I am sure your application should response fast, so forget that Java is available on the market.Well, do the traditional way and use KEIL or GNU Compilers that understand "c" language. This works perfect an d you got the big bunch of libraries and support for them - in addition, there are a couple of RTOS freely available.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 03, 2015, 04:36:03 pm
content: Quote from: AndreasF on December 02, 2015, 10:28:03 amThank you for your information. Me and my 2coworkers were talking about it again today and we decided to shy away from C# and go for C, because as you mention we would be closer to the hardware.

author: AgenteSoldier
author_rank: Newbie
timestamp: December 03, 2015, 04:37:06 pm
content: Thank you all for your helpfull information and your patience.Me and my Coworkers now decided that we will shy away from C# and go for a µC with support for the language C.Nice Greets,AgenteSOldier