Code Monkey home page Code Monkey logo

bluepilldemo's Introduction

BluePillDemo

The Blue Pill is a very cheap bare bones development board containing a STM32F103C8 ARM Coretex M3 processor with 64 kBytes of flash and 20 kBytes of RAM. This makes it an excellent piece of hardware to get into professional standard embedded programming on an ARM microcontroller on the cheap. There are many examples of how to get started with this board available but almost all of them use the Arduino environment. While this is fine, and an easy way to start embedded programming, it has its limitations. The Arduino way shelters you from getting close to the processor with an easy to use interface. This restricts what you can do in the code and makes it inefficient. Because of this the Arduino environment is almost never used professionally in industry. For anyone looking to make a career of embedded development it is necessary to move on.

The manufacturer of the processor on the Blue Pill board, ST, provide a compiler/IDE environment that is widely used in industry. The latest incarnation is called STM32CubeIDE and is a free unrestricted download from ST. However, it is a daunting bit of software supporting a huge range of processors and all their capabilities and is not easy at all to get going with. To help this process this repo contains a collection of small projects that can be directly imported into STM32CubeIDE.

Are you fed up with searching the internet for example code that is poorly written, full of messy commented out code, doesn't build, doesn't work or is cluttered with all sort of guff that hides what you are trying to find out to do? Me too. Therefore these projects start off at the lowest level being SIMPLE. The lowest level projects shows how to configure and then exercise one (usually!) peripheral on the processor. Then moving on there are some common simple driver examples that exercise the peripherals, like I2C, UART or SPI, by communicating with external devices. There are projects that integrate FreeRTOS, at the lowest level doing only that and nothing else, to keep that as simple as possible. Then there are projects that integrate FreeRTOS with peripheral drivers like the 16x2 HD44780 text display or third party middleware like the FatFS library. At the highest level are the SIM800L modem examples (these incorporate drivers (GPIO and UART), FreeRTOS, middleware (the modem driver), application code (MQTT library) and html and javascript running on a webserver) and the MAX30102 pulse oximeter with graphical display project.

Another bugbear of internet sourced example embedded code is that it's often just the code and you are left clueless on how to wire up the hardware to run it. These projects all have a schematic where components external to the Blue Pill board are used.

In the project there is a readme file describing the project, a circuit diagram if required and the STM32CubeIDE hardware configuration file that is used to set up the processor's hardware and any peripheral used (.ioc file). The example code then makes calls into ST's HAL library to operate the peripheral.

Once the code is built, flashing and debugging needs a ST-LINK device connected to the Serial Wire 4 pin header at the end of the Blue Pill board. These are cheaply available on ebay for a few £€$, sometimes supplied together with a Blue Pill board. You need 4 female to female jumper cables to connect the two. Note: The ST-LINK v2 debugger will not connect to Blue Pill boards with fake processors on them. Some Blue Pill boards are supplied with non-genuine or cloned STM32F103C8T6 processors.

Any requests can be added as an issue to this repo. I'll create a project if I have time and the extra hardware is not too expensive for me to buy.

The Seatalk projects are only of interest for interfacing with the Seatalk marine data network.

Creating a new Blue Pill project

A brief explanation of how to create a new project for the Blue Pill board in STM32CubeIDE using a ST-LINK device for flashing/debugging is shown below:

File|New|STM32 Project

In Target Selection type STM32F103C8 in Part Number Search

Select this processor when it is listed on the right, Next

Enter Project Name, select C++ if you need it, leave other selections default, Finish

In 'Project Name'.ioc editor Select Pinout & Configuration tab

In Pinout & Configuration choose Categories then expand System Core then select SYS

Under Debug select Serial Wire

In System Core select RCC

In both High Speed Clock (HSE) and Low Speed Clock (LSE) select Crystal/Ceramic Resonator

Select Clock Configuration Tab

In System Clock Mux select PLLCLK

In PLL Source Mux select HSE

In PLLMul select X9

In APB1 Prescalar select /2

For projects using USB, ADC or RTC further clock configuration is required. See example projects.

bluepilldemo's People

Contributors

miniwinwm avatar navnmea183 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluepilldemo's Issues

debug/build error: .elf file does not exist

Hi,

I am new to STM32CubeIDE and STM32 in general and Blue Pill in specifics. Your code is a godsend - if only I can get it to load! I am running STM32CubeIDE in Linux Mint 20.

I decided to start with the BluePillDemo_GPIO project and naively opened your project in the IDE by double-clicking on the .project file. The project popped up in my Project Explorer. So far so good. But when I hit the 'debug' button, I get this error:

Screenshot from 2020-11-14 11-04-54

My CDT build console states:

11:04:27 **** Incremental Build of configuration Debug for project BluePillDemo_GPIO ****
make -j8 all 
arm-none-eabi-size   BluePillDemo_GPIO.elf 
   text	   data	    bss	    dec	    hex	filename
   4676	     20	   1572	   6268	   187c	BluePillDemo_GPIO.elf
Finished building: default.size.stdout
 

11:04:28 Build Finished. 0 errors, 0 warnings. (took 163ms)

If you can help me, I would very much appreciate it.
Sebastien B

STM32f103 virtual com connection win 10 problem

Hi,

Firstly thanks for the lots of good example project. I have a very important problem. I can't connect stm32f103 with pc via usb. When I connected blue pill and pc , pc didn't recognize device. I read couple article about this. I didn't find any driver work on win10. So Can you help me? How can I fix this connection problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.