# Can I use mbed for STM32F103(C8T6)?

I have some experience with Arduino, but for one of the devices I want to use something with more power (RAM/CPU power).

I already found out that some STM32F4 or STM32F7 models really with what I need, however, since I have no experience, I bought a (very cheap) STM32F103C8TT6 evaluation board.

I don't have it yet, but I'm reading information about it. I encountered mbed which seems a very easy way to program it.

However, in the list of boards I don't see any evaluation boards, mostly NUCLEO's or Discovery versions.

Is it possible to still use it? (like by selecting the 'similar'NUCLEO F103RB' or is mbed only supporting NUCLEO's (and lots of other ARM core devices) ?

The reason is that if the evaluation board does not support mbed, it's not really a good alternative to try if I can use mbed later anyway on the actual STM32 version I want.

• MBED boards definitions typically go slightly beyond the MCU itself into things like clock sources, but often you can get something close to essentially work, and if you download a Makefile project for offline building can then fully customize it to your hardware. There are some rather extreme oddities to certain aspects of it, however. – Chris Stratton Jul 19 '17 at 2:05
• @ChrisStratton Thanks for the remark ... that mean it would be quite a lot of effort for an eval board just for 'checking' if the platform would be suitable.... but maybe I can use it just to learn more about the ARM32 (since my knowledge is about zero). – Michel Keijzers Jul 19 '17 at 8:12

## 2 Answers

Yes, you can. You can create a new project based on NUCLEO F103RB and then replace precompiled library with sources. Then in sources you can redefine pin mappings to fit your specific board. Please note, that I haven't done this for STM MCUs, but ~2 years ago I got it working for my nRF51 custom board.

The idea is, that MCU stays the same with all the internal peripherals, you just have pins wired slightly differently. Additional changes might be required if your board has different clock source.

• Thanks ... that would be great (I don't need full functionality, just for 'evaluation', but if only pin numbers are different, it should not be a problem (although I still haven't looked in detail at them). – Michel Keijzers Jul 19 '17 at 12:16
• It's not going to be pin numbers in general (unlike with Arduino the actual GPIO names are used), more a few things like where a uniquely designated LED or switch might be. Often you can ignore that. Clocking issues you may not be able to ignore - it's possible it will just work, but you really need to dig into exactly what their code is doing. – Chris Stratton Jul 19 '17 at 13:57

Yes, someone made a library for mbed that contains the necessary clock initialization and pin definitions for the STM32F103C8. You can find information and a "hello world" example here:

https://developer.mbed.org/users/hudakz/code/STM32F103C8T6_Hello/

To flash the firmware binary produced by the mbed online compiler to the board, you need a USB-to-serial adapter and then use the stm32flash program to do the upload. The USB-to-serial adapter connects to pins PA_9 and PA_10 (serial 1) 3V3 and GND. Then set pin BOOT0 to HIGH press reset to activate the built-in serial bootloader and start the upload:

stm32flash -w my_firmware.bin -v -g 0x /dev/ttyUSB0


You can also use another STM board with a ST-Link interface to flash the firmware, but I haven't tried that yet.

There's also a bootloader that should allow you to use DFU, but I haven't been able to make it work yet.

• Thank you very much for this info! I have an USB-to-serial adapter already, so I am ready to go (but also wants to attend some other things first). – Michel Keijzers Aug 5 '17 at 8:18