1.. _olimexino_stm32: 2 3OLIMEXINO-STM32 4############### 5 6Overview 7******** 8 9The OLIMEXINO-STM32 board is based on the STMicroelectronics STM32F103RB ARM 10Cortex-M3 CPU. 11 12.. figure:: img/olimexino_stm32.jpg 13 :align: center 14 :alt: OLIMEXINO-STM32 15 16 OLIMEXINO-STM32 17 18More information about the board can be found at the 19`OLIMEXINO-STM32 website`_ and `OLIMEXINO-STM32 user manual`_. 20The `ST STM32F103xB Datasheet`_ contains the processor's 21information and the datasheet. 22 23Supported Features 24================== 25 26The olimexino_stm32 board configuration supports the following 27hardware features: 28 29+-----------+------------+-------------------------+ 30| Interface | Controller | Driver/Component | 31+===========+============+=========================+ 32| NVIC | on-chip | nested vectored | 33| | | interrupt controller | 34+-----------+------------+-------------------------+ 35| SYSTICK | on-chip | system clock | 36+-----------+------------+-------------------------+ 37| UART | on-chip | serial port | 38+-----------+------------+-------------------------+ 39| GPIO | on-chip | gpio | 40+-----------+------------+-------------------------+ 41| I2C | on-chip | i2c | 42+-----------+------------+-------------------------+ 43| SPI | on-chip | spi | 44+-----------+------------+-------------------------+ 45| USB | on-chip | USB device | 46+-----------+------------+-------------------------+ 47| WATCHDOG | on-chip | independent watchdog | 48+-----------+------------+-------------------------+ 49| CAN | on-chip | Controller Area Network | 50+-----------+------------+-------------------------+ 51 52Other hardware features have not been enabled yet for this board. 53 54Pin Mapping 55=========== 56 57.. figure:: img/olimexino-stm32-front.jpg 58 :align: center 59 :alt: OLIMEXINO-STM32 connectors 60 61 OLIMEXINO-STM32 connectors 62 63LED 64--- 65 66* LED1 (green) = PA5 67* LED2 (yellow) = PA1 68* PWR_LED (red) = power 69 70Push buttons 71------------ 72 73* BUT = PC9 / TIM3CH4 / BOOT0 74* RST = NRST 75 76External Connectors 77------------------- 78 79SWD 80 81+-------+--------------+-------------------------+ 82| PIN # | Signal Name | STM32F103RB Functions | 83+=======+==============+=========================+ 84| 1 | VCC | N/A | 85+-------+--------------+-------------------------+ 86| 2 | TMS / SWDIO | JTMS / SWDIO / PA13 | 87+-------+--------------+-------------------------+ 88| 3 | GND | N/A | 89+-------+--------------+-------------------------+ 90| 4 | TCK / SWCLK | JTCK / SWCLK / PA14 | 91+-------+--------------+-------------------------+ 92| 5 | GND | N/A | 93+-------+--------------+-------------------------+ 94| 6 | TDO / SWO | JTDO /TIM2_CH2 / PB3 / | 95| | | TRACESWO / SPI1_SCK | 96+-------+--------------+-------------------------+ 97| 7 | Cut off | N/A | 98+-------+--------------+-------------------------+ 99| 8 | TDI | JTDI / TIM2_CH1_ETR / | 100| | | PA15 / SPI1_NSS | 101+-------+--------------+-------------------------+ 102| 9 | GND | N/A | 103+-------+--------------+-------------------------+ 104| 10 | RESET | NRST | 105+-------+--------------+-------------------------+ 106 107UEXT 108 109+-------+--------------+-------------------------+ 110| PIN # | Signal Name | STM32F103RB Functions | 111+=======+==============+=========================+ 112| 1 | VCC | N/A | 113+-------+--------------+-------------------------+ 114| 2 | GND | N/A | 115+-------+--------------+-------------------------+ 116| 3 | D7 (TXD1) | PA9 / USART1_TX / | 117| | | TIM1_CH2 | 118+-------+--------------+-------------------------+ 119| 4 | D8 (RXD1) | PA10 / USART1_RX / | 120| | | TIM1_CH3 | 121+-------+--------------+-------------------------+ 122| 5 | D29 (SCL2) | PB10 / I2C2_SCL / | 123| | | USART3_TX / TIM2_CH3 | 124+-------+--------------+-------------------------+ 125| 6 | D30 (SDA2) | PB11 / I2C2_SDA / | 126| | | USART3_RX / TIM2_CH4 | 127+-------+--------------+-------------------------+ 128| 7 | D12 (MISO1) | PA6 / SPI1_MISO / | 129| | | ADC12_IN6 / TIM3_CH1 / | 130| | | TIM1_BKIN | 131+-------+--------------+-------------------------+ 132| 8 | D11 (MOSI1) | PA7 / SPI1_MOSI / | 133| | | ADC12_IN7 / TIM3_CH2 / | 134| | | TIM1_CH1N | 135+-------+--------------+-------------------------+ 136| 9 | D13 (SCK / | PA5 / SPI1_SCK / | 137| | LED1) | ADC12_IN5 | 138+-------+--------------+-------------------------+ 139| 10 | UEXT_#CS | N/A | 140+-------+--------------+-------------------------+ 141 142EXT 143 144+-------+--------------+-------------------------+ 145| PIN # | Signal Name | STM32F103RB Functions | 146+=======+==============+=========================+ 147| 1 | D23_EXT | PC15 / OSC32_OUT | 148+-------+--------------+-------------------------+ 149| 2 | D24 (CANTX) | PB9 / TIM4_CH4 / | 150| | | I2C1_SDA / CANTX | 151+-------+--------------+-------------------------+ 152| 3 | D25 (MMC_CS) | PD2 / TIM3_ETR | 153+-------+--------------+-------------------------+ 154| 4 | D26 | PC10 / USART3_TX | 155+-------+--------------+-------------------------+ 156| 5 | D27 | PB0 / ADC12_IN8 / | 157| | | TIM3_CH3 / TIM1_CH2N | 158+-------+--------------+-------------------------+ 159| 6 | D28 | PB1 / ADC12_IN9 / | 160| | | TIM3_CH4 / TIM1_CH3N | 161+-------+--------------+-------------------------+ 162| 7 | D29 (SCL2) | PB10 / I2C2_SCL / | 163| | | USART3_TX / TIM2_CH3 | 164+-------+--------------+-------------------------+ 165| 8 | D30 (SDA2) | PB11 / I2C2_SDA / | 166| | | USART3_RX / TIM2_CH4 | 167+-------+--------------+-------------------------+ 168| 9 | D31 (#SS2) | PB12 / SPI2_NSS / | 169| | | I2C2_SMBAI / USART3_CK /| 170| | | TIM1_BKIN | 171+-------+--------------+-------------------------+ 172| 10 | D32 (SCK2) | PB13 / SPI2_SCK/ | 173| | | USART3_CTS / TIM1_CH1N | 174+-------+--------------+-------------------------+ 175| 11 | D33 (MISO2) | PB14 / SPI2_MISO / | 176| | | USART3_RTS / TIM1_CH2N | 177+-------+--------------+-------------------------+ 178| 12 | D34 (MOSI2) | PB15 / SPI2_MOSI / | 179| | | TIM1_CH3N | 180+-------+--------------+-------------------------+ 181| 13 | D35 | PC6 / TIM3_CH1 | 182+-------+--------------+-------------------------+ 183| 14 | D36 | PC7 / TIM3_CH2 | 184+-------+--------------+-------------------------+ 185| 15 | D37 | PC8 / TIM3_CH3 | 186+-------+--------------+-------------------------+ 187| 16 | GND | N/A | 188+-------+--------------+-------------------------+ 189 190Arduino Headers 191--------------- 192 193CON1 power 194 195+-------+--------------+-------------------------+ 196| PIN # | Signal Name | STM32F103RB Functions | 197+=======+==============+=========================+ 198| 1 | RESET | NRST | 199+-------+--------------+-------------------------+ 200| 2 | VCC (3V3) | N/A | 201+-------+--------------+-------------------------+ 202| 3 | VDD (3V3A) | N/A | 203+-------+--------------+-------------------------+ 204| 4 | GND | N/A | 205+-------+--------------+-------------------------+ 206| 5 | GND | N/A | 207+-------+--------------+-------------------------+ 208| 6 | VIN | N/A | 209+-------+--------------+-------------------------+ 210 211CON2 analog 212 213+-------+--------------+-------------------------+ 214| PIN # | Signal Name | STM32F103RB Functions | 215+=======+==============+=========================+ 216| 1 | D15 (A0) | PC0 / ADC12_IN10 | 217+-------+--------------+-------------------------+ 218| 2 | D16 (A1) | PC1 / ADC12_IN11 | 219+-------+--------------+-------------------------+ 220| 3 | D17 (A2) | PC2 / ADC12_IN12 | 221+-------+--------------+-------------------------+ 222| 4 | D18 (A3) | PC3 / ADC12_IN13 | 223+-------+--------------+-------------------------+ 224| 5 | D19 (A4) | PC4 / ADC12_IN14 | 225+-------+--------------+-------------------------+ 226| 6 | D20 (A5) | PC5 / ADC12_IN15 | 227+-------+--------------+-------------------------+ 228 229CON3 digital 230 231+-------+--------------+-------------------------+ 232| PIN # | Signal Name | STM32F103RB Functions | 233+=======+==============+=========================+ 234| 1 | D0 (RXD2) | PA3 / USART2_RX / | 235| | | ADC12_IN3 / TIM2_CH4 | 236+-------+--------------+-------------------------+ 237| 2 | D1 (TXD2) | PA2 / USART2_TX / | 238| | | ADC12_IN2 / TIM2_CH3 | 239+-------+--------------+-------------------------+ 240| 3 | D2 | PA0 / WKUP / | 241| | | USART2_CTS / ADC12_IN0 /| 242| | | TIM2_CH1 | 243+-------+--------------+-------------------------+ 244| 4 | D3 (LED2) | PA1 / USART2_RTS / | 245| | | ADC12_IN1 / TIM2_CH2 | 246+-------+--------------+-------------------------+ 247| 5 | D4 | PB5 / I2C1_SMBAI / | 248| | | TIM3_CH2 / SPI1_MOSI | 249+-------+--------------+-------------------------+ 250| 6 | D5 | PB6 / I2C1_SCL / | 251| | | TIM4_CH1 / USART1_TX | 252+-------+--------------+-------------------------+ 253| 7 | D6 | PA8 / USART1_CK / | 254| | | TIM1_CH1 / MCO | 255+-------+--------------+-------------------------+ 256| 8 | D7 (TXD1) | PA9 / USART1_TX / | 257| | | TIM1_CH2 | 258+-------+--------------+-------------------------+ 259 260CON4 digital 261 262+-------+--------------+-------------------------+ 263| PIN # | Signal Name | STM32F103RB Functions | 264+=======+==============+=========================+ 265| 1 | D8 (RXD1) | PA10 / USART1_RX / | 266| | | TIM1_CH3 | 267+-------+--------------+-------------------------+ 268| 2 | D9 | PB7 / I2C1_SDA / | 269| | | TIM4_CH2 / USART1_RX | 270+-------+--------------+-------------------------+ 271| 3 | D10 (#SS1) | PA4 / SPI1_NSS / | 272| | | USART2_CK / ADC12_IN4 | 273+-------+--------------+-------------------------+ 274| 4 | D11 (MOSI1) | PA7 / SPI1_MOSI / | 275| | | ADC12_IN7 / TIM3_CH2 / | 276| | | TIM1_CH1N | 277+-------+--------------+-------------------------+ 278| 5 | D12 (MISO1) | PA6 / SPI1_MISO / | 279| | | ADC12_IN6 / TIM3_CH1 / | 280| | | TIM1_BKIN | 281+-------+--------------+-------------------------+ 282| 6 | D13 (SCK1 / | PA5 / SPI1_SCK / | 283| | LED1) | ADC12_IN5 | 284+-------+--------------+-------------------------+ 285| 7 | GND | N/A | 286+-------+--------------+-------------------------+ 287| 8 | D14 (CANRX) | PB8 / TIM4_CH3 / | 288| | | I2C1_SCL / CANRX | 289+-------+--------------+-------------------------+ 290 291CAN 292 293+-------+-------------+ 294| PIN # | Signal Name | 295+=======+=============+ 296| 1 | GND | 297+-------+-------------+ 298| 2 | CAN L | 299+-------+-------------+ 300| 3 | CAN H | 301+-------+-------------+ 302 303System Clock 304============ 305 306OLIMEXINO-STM32 has two external oscillators. The frequency of 307the slow clock is 32.768 kHz. The frequency of the main clock 308is 8 MHz. The processor can setup HSE to drive the master clock, 309which can be set as high as 72 MHz. 310 311Serial Port 312=========== 313 314OLIMEXINO-STM32 board has up to 3 U(S)ARTs. The Zephyr console output is 315assigned to USART1. Default settings are 115200 8N1. 316 317SPI 318=== 319 320OLIMEXINO-STM32 board has up to 2 SPIs. The default SPI mapping for Zephyr is: 321 322- SPI1_NSS : PA4 323- SPI1_SCK : PA5 324- SPI1_MISO : PA6 325- SPI1_MOSI : PA7 326 327I2C 328=== 329 330The OLIMEXINO-STM32 board supports two I2C devices. The default I2C mapping for 331Zephyr is: 332 333- I2C1_SCL : PB6 334- I2C1_SDA : PB7 335- I2C2_SCL : PB10 336- I2C2_SDA : PB11 337 338USB 339=== 340 341OLIMEXINO-STM32 board has a USB 2.0 full-speed device interface available 342through its mini USB connector. 343 344- USB_DM : PA11 345- USB_DP : PA12 346 347CAN 348=== 349 350OLIMEXINO-STM32 board has a CAN interface with transceiver on board. 351CAN is accessible through a screw terminal. 352 353- CAN_RX : PB8 354- CAN_TX : PB9 355 356Jumpers 357======= 358 359The Zephyr kernel uses the OLIMEXINO-STM32 default jumper 360settings. Note that all jumpers on the board are SMD type. 361You will need to solder, unsolder, or cut them in order to 362reconfigure them. 363 364The default jumper settings for the OLIMEXIMO-STM32E are: 365 366+---------------+------------+---------------+ 367| Jumper Name | Open | Close | 368+===============+============+===============+ 369| LED1_E | | x | 370+---------------+------------+---------------+ 371| LED2_E | | x | 372+---------------+------------+---------------+ 373| D23_E | x | | 374+---------------+------------+---------------+ 375| R-T | x | | 376+---------------+------------+---------------+ 377| P10_E | | x | 378+---------------+------------+---------------+ 379 380+---------------+------------+---------------+ 381| Jumper Name | D10 | D4 | 382+===============+============+===============+ 383| D10/D4 | | x | 384+---------------+------------+---------------+ 385 386Flashing Zephyr onto OLIMEXINO-STM32 387************************************ 388 389Flashing the Zephyr kernel onto OLIMEXINO-STM32 requires the 390`stm32flash tool`_. 391 392Building stm32flash command line tool 393===================================== 394 395To build the stm32flash tool, follow the steps below: 396 397#. Checkout the stm32flash tool's code from the repository. 398 399 .. code-block:: console 400 401 $ git clone http://git.code.sf.net/p/stm32flash/code stm32flash 402 $ cd stm32flash 403 404#. Build the stm32flash tool. 405 406 .. code-block:: console 407 408 $ make 409 410#. The resulting binary is available at :file:`stm32flash`. 411 412Flashing an Application to OLIMEXINO-STM32 413========================================== 414 415To upload an application to the OLIMEXINO-STM32 board a TTL(3.3V) 416serial adapter is required. This tutorial uses the 417:ref:`button-sample` sample application. 418 419#. Connect the serial cable to the UEXT lines of the UART 420 interface (pin #3=TX and pin #4=RX). 421 422#. Power the OLIMEXINO-STM32 via the mini USB. 423 424#. Reset the board while holding the button (BUT). 425 426#. To build the application and flash it, enter: 427 428 .. zephyr-app-commands:: 429 :zephyr-app: samples/basic/button 430 :board: olimexino_stm32 431 :goals: flash 432 433#. Run your favorite terminal program to listen for output. 434 435 .. code-block:: console 436 437 $ minicom -D /dev/ttyUSB0 -b 115200 438 439 The :code:`-b` option sets baud rate ignoring the value 440 from config. 441 442#. Press the Reset button and you should see the output of 443 button application in your terminal. The state of the BUT 444 button's GPIO line is monitored and printed to the serial 445 console. When the input button gets pressed, the interrupt 446 handler prints information about this event along with its 447 timestamp. 448 449.. note:: 450 Make sure your terminal program is closed before flashing 451 the binary image, or it will interfere with the flashing 452 process. 453 454.. _OLIMEXINO-STM32 website: 455 https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/ 456 457.. _OLIMEXINO-STM32 user manual: 458 https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/resources/OLIMEXINO-STM32.pdf 459 460.. _ST STM32F103xB Datasheet: 461 http://www.st.com/resource/en/datasheet/stm32f103tb.pdf 462 463.. _stm32flash tool: 464 https://sourceforge.net/p/stm32flash/wiki/Home/ 465