.. index:: stm32f103, blue pill, olimex p103 .. _stm32f103-lmt01: A Blue Pill LMT01 Temperature Sensor ==================================== This is a rewrite of the :ref:`previous LMT01 temperature sensor project`. It now uses fixed point arithmetic to calculate the temperature to one decimal place and has some extra features such as USB/USART2 terminal access, and a MCU "Device Electronic Signature" reader etc. It contains a ready to run binary for a 64KB Flash version of the STM32F103 Cortex-M3 MCU as used in the :ref:`Blue Pill` that boots from USB at power up. Connect the few components shown in the schematic below to read the temperature. It runs fine without them but should complain about a missing sensor if you try to read the temperature. USB --- This uses the Mecrisp-Stellaris USB driver for STM32F103 by Jean-Claude Wippler which is based on the Coreforth USB driver by Eckhart Köppen. .. note:: From Viktor Dvořák. USB needs PC side idVendor = 0x0483 idProduct = 0x7540 driver which is STM32 Virtual COM port driver desribed in en.DM00478229.pdf. The driver is en.stsw-stm32102.zip (24755 kB) is available directly from st.com * Connect the "Blue Pill" USB port to PC and look for "" device in your system * Connect a PC serial terminal to the USB device above, you can choose any Baud Rate. .. note:: The USB terminal can switch to USART2 by entering "-usb". Speed is 460800 Baud. USART2 ------ Connect a :ref:`serial terminal` to read the temperature. =========== ============= ===================== USART2 MCU Signal 3.3v/USB Dongle =========== ============= ===================== PA1 RTS CTS PA2 TX RX PA3 RX TX =========== ============= ===================== .. note:: The USART2 terminal can switch to USB by entering "+usb" Screenshot ---------- * read the temperature by entering "C" or "F" in the terminal. * check the mcu signature by entering "stm32id" * examine the contents of the RCC CR register by entering "rcc_cr." * read the remperature by pressing the PA0 pushbutton .. image:: projects/f103-lmt01/screenshot.jpg Instructions ------------ * Flash the ae9236b921613c07b1967f21ff20ee97.bin image in this tarball to your STM32F103RBT6 (128KB Flash version) board. * Download it here: https://sourceforge.net/projects/mecrisp-stellaris-folkdoc/files/ae9236b921613c07b1967f21ff20ee97.tar.gz/download * Connect up the few components as shown in the schematic below and power up the board. * The temperature may be read on the terminal by pressing the pushbutton, or entering "T" in the terminal. * The Board runs at 72 MHz using the on board 8MHz crystal. Schematic --------- .. note:: Press "C" or "F" for temperature reading, not "C" as shown below on this earlier version schematic. .. image:: projects/f103-lmt01/f103-lmt01.jpeg Blue Pill Layout ---------------- Layout contributed by Michael Jeffery. .. image:: projects/f103-lmt01/lmt01-blue-pill-layout.jpg Tarball Contents ---------------- ae9236b921613c07b1967f21ff20ee97.tar.gz :: . ├── ae9236b921613c07b1967f21ff20ee97.DELETE.sh ├── ae9236b921613c07b1967f21ff20ee97.README.md ├── ae9236b921613c07b1967f21ff20ee97.bin ├── ae9236b921613c07b1967f21ff20ee97.flashme ├── ae9236b921613c07b1967f21ff20ee97.words4.txt ├── f103-lmt01.jpeg ├── image.bin └── lmt01-blue-pill-layout-1.jpg Source Code ----------- This source code by itself won't run the temperature sensor, however that's no problem as all the support Words required are installed in the downloadable ready to run image above. Nothing else is required, just enter "C" or "F" in the terminal or press the push button to read the temperature. Source Code ^^^^^^^^^^^ .. raw:: html :file: projects/f103-lmt01/f103-lmt01.fs.html Play With Forth ? ----------------- This Image is a complete system, it contains the compiler and many internal Peripheral registers, see the ae9236b921613c07b1967f21ff20ee97.words4.txt file for a listing of what's there. Wonder what they all mean ? see the :ref:`Dictionary`. You can read, write and examine registers, run programs, even commit them to Flash memory. .. note:: to erase all the Flash except the default Mecrisp-Stellaris Forth system, enter "eraseflash" at the terminal. This will remove everything from this project including the USB, and only USART2 will work with a terminal. To reinstall everything just reflash the ae9236b921613c07b1967f21ff20ee97.bin imahe to your board.