A tiny shawl arrived yesterday at the STM32F103C8.
STM32F103C8 Front
This is a 48-bit 32bit microcontroller. And this is a great upgrade option for those who use Arduino. For the scale put next to the Arduino Pro, which is smaller than the usual Arduino Uno: The size of the microcontroller itself is exactly the same, only the pitch of the legs is not 0.8, but 0.5mm, so they fit into the same building 48, not 32. But the board is smaller and costs from $ 10 with delivery. And what about the functionality? ')
Arduino
32 kB Flash 2 kB RAM 1 kB EEPROM ATMEL AVR's 8-bit architecture, up to 20 MHz, in Arduino runs at 16 MHz. 1 MIPS / MHz The supply voltage is 5V or 3.3V at 8MHz and is not 5V-tolerant.
GPIO general purpose pins - 20 Of them: PWM - 6 (hardware PWM for servo control - 2) ADC inputs - 6 (10 bit) Periphery: I2C tire SPI Bus 1 UART 1x 16 bit timer 2x 8 bit timer Well and on trifles it is a little: interrupt controller, watchdog. It is programmed either via SPI - 4-wire interface (MOSI, MISO, SCK, RST) or via UART, if you first flash the bootloader, which takes up to 2kb flash.
STM32F103C8
64 kB Flash (128 kb if you put STM32F103CB (from $ 2.6 each)) 20 kB RAM ARM CORTEX-M3 32-bit architecture, up to 72 MHz, 1.25 MIPS / MHz Power supply 3.3V (2.7-3.6), almost all pins are 5V-tolerant. The board has a 3.3V voltage regulator, which is powered by an external 5V or USB.
GPIO general purpose pins - 26 Of them: PWM - 12 (all suitable for servo control) ADC inputs - 6 (12 bit, 1µs) Periphery: 3x USART 2x I2C 2x SPI (18Mbit / s) 1 x CAN 2.0B USB 2.0 FS (FullSpeed - 12Mbit) 3x 16 bit timer + 1 PWM timer DMA - 7 channels (ADC, SPI, I2C, USART) RTC - real time clock (32768 Hz quartz is already unsoldered), can run on battery when the MC is sleeping or stopped altogether. Backup registers - registers powered by a battery together with a clock at the time of turning off the MC from the main power supply CRC - checksum calculation unit 96-bit unique ID MK
Programmable via SWD - 2-wire interface or JTAG (industry standard). There is hardware debugging - you can look into the registers of the processor, look at the state of all the peripherals, execute the program step by step, change the values in RAM and Flash, look at the values of variables at any time, put Breakpoint. There is also a sewn bootloader, which is impossible to erase and it allows you to flash the MK through a normal UART by moving the jumper.
Board functionality
Functional chic. Of the shortcomings, only a higher entry threshold during training is that the MC is stuffed with possibilities that it does not immediately work out with them. But there is detailed documentation, there are examples. They are not as primitive as for AVR Atmega and especially Arduino with its Wiring, but they are also not particularly complicated.
In general, in my opinion, the board in all respects exceeds the Arduino including the price. And considering that all MK STM32 series STM32F100, F101, F102, F103, F104, F105, F107 are fully pin to pin compatible in one package, you can extend the functionality of the board without changing its layout, but simply by replacing the chip. There are 48, 64, 100, 144 legs to choose from. And the older episodes (for example, F4) have more.
Understood yesterday with a USB HID for this board, the project without any changes adapted for this MK. As a result, we connect the USB board with a cord. No drivers need to be installed - the board is seen as a standard HID device. USB support is fully hardware, up to 8 endpoints. I use 1 endpoint for two-way communication with the PC. The Delphi program can control the LEDs and get the button states in the form of regular HID reports. Packet exchange is much more convenient than the UART stream, in which you need to mess with the headers, search for the beginning and end of the package. If the COM port is occupied by the program, then no one can connect. If the device is disabled, the program will not be able to close the COM port correctly. There are no such problems with USB HID. Fully hot-plug. I pulled it out, put the device back in, the program can reconnect to it on the fly without restarting.
In the MK, everything works on interrupts, so most of the time it just rests and can be occupied with useful things, unlike V-USB for the AVR, where the MK barely copes with USB software emulation and that is flawed.
Well, for lovers of clarity, we blink LEDs :)
Soon I will lay out on my site the development toolkit for STM32: IDE EmBlocks along with the toolchain, which I modified to support ColinkEx and a little combed the templates for the MK I often use: STM32F103VE, STM32F103C8, STM32F100RB