0
\$\begingroup\$

I am looking for a cheap and minimalist dev board, and found the above one (Cortex M3 for Arduino). I am used to stm32 but normally their dev boards are a bit expensive if I am going to use them in a bunch of units, so this seemed like a good choise at 3$.

However, I would like to program it in C and be able to debug it. It has a SWD interface, but I am finding very little info on how to set up programming and debugging (almost all links seems to be for AVR based Arduino, not stm32). Will absolutely not use the Arduino IDE.

Anyone knows where to find this info, or any similar really cheap 32-bit dev boards?

\$\endgroup\$
2
\$\begingroup\$

These Are everywhere on ebay/amazon and the like. The SWD interface is clearly labeled if you are questioning the PCB you posted. But for 3 dollars you might as well buy one, buzz it out then see if it fits your needs. Getting these running with the ST-Link Utility over the command-line and GCC is pretty simple. GDB is a different story, but there are plenty of canned IDE's you can use thet will work out of the box. Embitz is nice, as is the MCUonEclipse plugin. Hope this helps

\$\endgroup\$
  • \$\begingroup\$ I have a proprietary IDE, IAR Workbench. It supports flashing all the Discovery and Nucelo boards from ST via st-link v2 jtag and swd, so maybe this is no different? Even though I only tried via the JTAG. My hope is to be able to use that one together with MXCube for code generation. Anyway I ended up ordering one so we'll see :) \$\endgroup\$ – Rolle Apr 18 '17 at 9:04
1
\$\begingroup\$

I think I got mine for closer to $2.50 and at times you can get them less than $2. Careful though I got taken for $20 buy an ebay vendor, I didnt read the reviews carefully enough to know they send a package with a few inches of wire or something of little value to satisfy ebays package tracking. It is on you to deal with the loss, not ebay nor paypal.

It is hard to compete with those prices so long as you dont get taken too often. but for a few bucks you could buy parts and boards from places that are not going to leave you empty handed.

either way with many/most of the cortex-ms you can use an ftdi based board that supports mpsse, you can get j-link (I assume clones) for ten bucks on ebay from asia, they work just fine with this board/chip (note there is a cortex-m0 based board on ebay for around the same price has both the swd and serial broken out on the bottom). For about ten bucks you can get a nucleo board from ST, those or the discovery boards you can remove the jumpers to get at the swd pins and then use that header for other chips/boards/vendors. If you get the right nucleo board as not all of them support this you can also use the stlink debugger for uart access. have to check the docs, the boards often have RX/TX pins but not all are usable.

You can go the tiva-c route as well and some of those boards you can get at the header although some are wee tiny and painful. i find stlink or j-link much easier.

use openocd, can telnet into the openocd server and erase and load flash or run programs from ram. all free.

These parts have a bootloader in them as well so with a usb to uart you can move the jumper over and boot that way and download your program that way, simple protocol, can bang out your own tool in tens of minutes, or an afternoon depending.

Can apt-get tools or easily come by pre-build gnu based tools.

ST has various libraries if you dont want to get your hands dirty, should have support for free tools, and might provide an ide which supports the stlink.

Should be very easy to find more than enough examples out there, only took a few seconds for me...

As with any mcu start at the vendors web page, for arm details you go to arms website although ST does have a document similar to the architectural reference manual, even though you are not normally allowed to re-distribute that info. It is in the vendors best interest to provide for free/cheap a set of libraries that hide the details of the chip, and an ide and other tools for programming the parts. And they do that, there is churn on these items so as soon as you get used to one another one comes out that is completely different, but at least there is something. or you can just program them using the docs, these parts are fairly simple to program.

Note I found these parts on these asia/ebay boards locked.

stm32x device protected
failed erasing sectors 0 to 0

can use the write unprotect bootloader command which doesnt respond, but on the next power cycle it is now unlocked.

I also figured out how to do it with openocd, but dont remember where I wrote that down. I think my bigger batch of boards I just ran them through the uart interface like an assembly line to unlock them all then used a jlink with a hand made adapter that plugs into the end for development. have not finished my usb based bootloader...

\$\endgroup\$
1
\$\begingroup\$

They have just soldered the MCU to the board for you. It is very well documented, nothing mysterious.

Baremetal recipe:

  • Read a book about those processors. For example, The Definitive Guide To the ARM Cortex M3 by Joseph Yiu.

  • stm32-discovery board, configure it to use its SWD interface on remote devices.

  • Programming (processor core specific) and reference (manufacturer's implemention specific) manuals of that specific MCU.

  • Openocd for programming interface (with telnet) and debugging backend

  • GCC for compiling

  • GDB for debugging (with --tui mode it is good enough to be standalone)

This page is a good starter especially for linux:

http://www.triplespark.net/elec/pdev/arm/stm32.html

\$\endgroup\$
  • \$\begingroup\$ I am mostly interested in how well debugging/programming would work over the swd pins. But if I understand correctly, any environment that can identify my st-link should be able to work? Like I mentioned in another comment, I like to use mxcube together with IAR cause I use this at work, and it can debug all discovery and nucleo boards from ST without problem \$\endgroup\$ – Rolle Apr 18 '17 at 11:32
  • \$\begingroup\$ You have ITM (instrumentation trace) and DWT (data watchpoint and trace) units via the SWD. It works well. @Rolle \$\endgroup\$ – Ayhan Apr 18 '17 at 12:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.