STM32 vs Arduino

    A tiny scarf arrived yesterday on the STM32F103C8.

    STM32F103C8 FrontSTM32F103C8 Front

    This is a 48x 32bit microcontroller. And this is a great upgrade option for those using Arduino.

    For the scale, I placed it next to the Arduino Pro, which is smaller than the usual Arduino Uno: The microcontroller itself is exactly the same in size, only the leg pitch is not 0.8, but 0.5mm, so they fit in the same case 48, not 32. But the board with it smaller and costs from $ 10 with delivery. And what about the functionality?
    Arduino vs STM32F103C8_r



    Arduino


    32 kB Flash
    2 kB RAM
    1 kB EEPROM
    8-bit ATMEL AVR architecture, up to 20 MHz, works in Arduino at 16 MHz. 1 MIPS / MHz
    Supply voltage 5V or 3.3V at 8MHz and not 5V-tolerant.

    General Purpose Pins GPIO - 20
    Of these:
    PWM - 6 (hardware PWM for controlling servo drives - 2)
    ADC inputs - 6 (10 bit)
    Peripherals:
    I2C
    bus SPI bus
    1 UART
    1x 16 bit timer
    2x 8 bit timers
    Well and a little bit : interrupt controller, watchdog.
    It is programmed either through the SPI - 4-wire interface (MOSI, MISO, SCK, RST) or through UART, if you first flash the bootloader, which takes up to 2kb of flash.

    STM32F103C8


    64 kB Flash (128 kb if you put STM32F103CB (from $ 2.6 each))
    20 kB RAM
    32-bit architecture ARM CORTEX-M3, up to 72 MHz, 1.25MIPS / MHz
    Power supply 3.3 V (2.7-3.6), almost all pins are 5 V-tolerant . There is a 3.3V voltage regulator on the board, which is powered by an external 5V or USB.

    General Purpose Pins GPIO - 26
    Of these:
    PWM - 12 (all suitable for controlling servo drives)
    ADC inputs - 6 (12 bit, 1 μs)
    Peripherals:
    3x USART
    2x I2C
    2x SPI (18Mbit / s)
    1 x CAN 2.0B
    USB 2.0 FS (FullSpeed ​​- 12Mbit)
    3x 16 bit timers + 1 PWM timer
    DMA - 7 channels (ADC, SPI, I2C, USART)
    RTC - real-time clock (32768 Hz quartz is already soldered), can operate on battery when the MK is sleeping or even stopped.
    Backup registers - registers powered by a battery together with the clock for the time the MC was turned off from the main power supply
    CRC -
    96-bit checksum calculation unit unique MK ID

    Programmed via SWD - 2-wire interface or JTAG (industry standard).
    There is hardware debugging - you can look into the processor registers, see the status of the entire periphery, step through the program, manually change the values ​​in RAM and Flash, see the values ​​of the variables at any time, set Breakpoint.
    There is also a wired bootloader that cannot be erased and it allows you to flash MK through a regular UART, rearranging the jumper.

    Board functionalityBoard

    Functionality Functionality is chic. Of the shortcomings, only a higher entry threshold for training - MK is so stuffed with opportunities that it is not immediately possible to deal 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 not particularly complicated either.

    In general, in my opinion, the board surpasses Arduino in all respects, including the price. And considering that all MKM STM32 series STM32F100, F101, F102, F103, F104, F105, F107 in one case are fully pin to pin compatible, you can expand the functionality of the board without changing its wiring, but simply replacing the chip. There are 48, 64, 100, 144 legs to choose from. And the older series (like F4) have more.

    I figured out yesterday with 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. You do not need to install any drivers - 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 a PC. A Delphi program can control LEDs and receive button states in the form of regular HID reports. Packet exchange is much more convenient than a UART stream, in which you need to mess with the headers, search for the beginning and end of the packet. If the COM port is occupied by the program, then no one can connect. If you disable the device, the program will not be able to correctly close the COM port. There are no such problems with USB HID. Totally hot-plug. I pulled it out, inserted the device back, the program can reconnect to it on the fly without restarting.

    In MK, everything works on interrupts, so most of the time it just rests and you can take it with useful tasks, unlike V-USB for AVR, where MK barely copes with software emulation of USB and then it is flawed.

    Well, for those who like visualization, we blink the LEDs :)



    Soon I lay at online design tools for STM32: IDE EmBlocks with tulcheynom that I modified to support ColinkEx and slightly brushed templates for frequently used MC me: STM32F103VE, STM32F103C8, STM32F100RB

    Also popular now: