Overwhelmed with MCU for design - Page 1
Forum section: electronics / beginners

author: GTheis
author_rank: Contributor
timestamp: May 22, 2020, 03:06:45 pm
content: Hello,A couple days ago I've posted about how to chose the right MCU for a projecthttps://www.eevblog.com/forum/projects/help-with-microcontroller-for-project-and-how-to-program-it/msg3076874/#msg3076874. Since then I decided to go with a STM32 MCU even if it is an overkill just, so I can learn since it seems to be one of the most popular MCUs out there. I found theSTM32G0to be fairly cheap and apparently without the necessity of an external crystal in the PCB design (please correct me if I am wrong).I am inclined to use theSTM32G030K6T6because it is the cheaper option. Now I am very stressed with the workflow. My idea is to buy an evaluation board since they seem to be cheap (<10€)https://www.digikey.nl/products/en/development-boards-kits-programmers/evaluation-boards-embedded-mcu-dsp/786?k=STM32G0. But none of them use theSTM32G030.So there are many questions I want to ask bout this that seem to be very overwhelming (many answers online).(1) To code/program should I use ST'sstm32cubeor (thinking I want to have a near-to-professional workflow) should I use another tool?(2) Should I buy an eval-board or should I look for a breakout board/design a breakout board?(3) Can I simulate the behavior of the circuit (i.e: load the code in a simulation tool, attach the resistors, caps etc)?(4) How to then to program the chip? Will I need an USB connector on my final design or there is a socket board I could use to program? What I would need specifically? I know I need a STM32V2, but I am still not sure how to then connect the STM32V2 to theSTM32G030chipThanks in advance!-- Guilherme

author: MosherIV
author_rank: Super Contributor
timestamp: May 22, 2020, 07:30:22 pm
content: Q1A1 the STM32Cube is a tool that ST produced to provide low level driver code for the peripheral in their range of STM32 microcontrollers. You can use or you can choose not to use it.The advantage of using it is that it gets you running much quicker than if you have to write your own peripheral driver.The disadvantage is that the drivers provided are far from perfect, they can be buggy and are not the most efficient code.Q2A2 The point of an evaluation board is that you can test the thing (microcontroller in this case) before you take that thing and produce a design.Yes, it is a well troden path in prototyping to build a prototype using a dev board.Shame you cannot get one for the microcontroller (uC) you want.Q3A3 yes. Some tools let you simulate at embedded code. IAR Workbench will do it.But why?Try to divide your code into layers, application layer and low level driver layer.The low level driver layer interacts with the peripherals eg adc driver just needs to return the adc value.Then your can write your application layer and write simulations of the drivers on host.You can then develop the application on host.Q4.A4 there are a number of options.uC normally have some kind of debugging interface. STM32 used the SWD interface. ST micro produce the very cheap (usb) STlink debugger that will connect to all STM32 uC. Many of ST eval boards have built in STlink.Some STM32 uC have ROM based bootloaders. They are serial, usb or CAN based. See user guide for particular uC for detailsFinally, you can develop your own bootloader to program your device

author: Jeroen3
author_rank: Super Contributor
timestamp: May 22, 2020, 08:07:44 pm
content: 1) highly opinion dependent.2) yeah get an eval board. Although you may not need it. But you can play around with peripherals and run some benchmarks measurements. Many of ST's board some with the flagship controller but can be refitted with a lower tier one from the same family. Or sometime another family. I do not know about the G0 series, but you could investigate.3) Analog circuit simulation can be done in LT-SPICE. Digital simulation can be done with some debuggers, but you only have the core and memory.Hybrid simulation is something I have never heard of.4) Use an ST-LINK over SWD (protocol from ARM) or use the bootloader on usart or i2c on your chip with the boot pin configurations. If not disabled by option bits.

author: emece67
author_rank: Frequent Contributor
timestamp: May 22, 2020, 10:49:47 pm
content: .

author: Mecanix
author_rank: Frequent Contributor
timestamp: May 23, 2020, 06:32:01 pm
content: Moved away from third-party IDE and now only using the STM32CubeIDE (1.31) with a ST-Link V3-Mini as programmer/probe. Nothing else.You won't need an external crystal if precise/high speed timings (e.g usb) isn't required. In most case the internal clock is sufficient.Eval boards are fantastic to get you started and learn, however you'll eventually want to move to the breadboard using breakout boards that are compatible to STM32 packages/footprints. You can have a few made for relatively cheap. See example pic.

author: rstofer
author_rank: Super Contributor
timestamp: May 23, 2020, 07:35:09 pm
content: How many widgets do you intend to build? Is this a commercial project? It wouldn't seem so but what do I know? The point is, if this is a one-off project, who cares what the board costs, it's just one board. Get something that is clearly over the top and get started.I picked an STM32F303RE board for a project a while back and it has a bunch of IO. It is also mbed compatible which means you can use the ARM toolchain online atwww.mbed.org. Don't count on debugging, with the online tools you need to use printf(). Just about everything you are likely to need is already in the library.FWIW, 80 kB of flash, 512 kB of SRAM 72 MHzhttps://www.st.com/en/microcontrollers-microprocessors/stm32f303re.htmlOther tools will work and the Keil toolchain is very nice.Make sure your board has the ST-Link-V2 programmer/debugger. In this case the device is part of the PCB but can be broken off if desired.The board is $11 at Newarkhttps://www.newark.com/stmicroelectronics/nucleo-f303re/dev-board-st-link-nucleo/dp/26Y5707There are a lot of these boards, look for those with a lot of pins and perhaps even Arduino headers.If the real issue is building a production board with such a fine pitch package, I suspect you would farm that out to the board manufacturer. If you are building a one-off, build a daughter card and plug the ST board into headers on the daughter card. Easy to do!Alternatively, look into the Teensy 4.0 or 4.1 boards (www.pjrc.com). The programming software installs under the Arduino IDE (not that I like that IDE) so it makes development quite straightforward. In fact, you can use the entire Arduino functionality on a chip running 600 MHz. These breakout boards are easy to install on a daughter card and the result can be quite professional.I just can't wrap my head around worrying about the cost of a single board. $11 just isn't the kind of number I care about for one-off. The Teensy boards are a lot more expensive because they aren't subsidized by the chip manufacturer.