(https://store.arduino.cc/usa/arduino-nano)
The wiki for pills is not very detailed.
———–
A1. Not for now…
viewtopic.php?f=28&t=117
This post helps. Use google search site:www.stm32duino.com
Q2. Is there any reference website or blog which could act as a good dictionary for a newbie like me?
http://www.gammon.com.au/forum/bbshowpo … pic_id=123 is very helpful. Any similar blog or website concerning more about Bluepills?
———–
A2. Not for now.
But I’ve found https://github.com/rogerclarkmelbourne/ … STM32/wiki check the list on the right.
This wiki uses BP for an example many times.
Q3. What’s the VB used for? Is it not the same as VRAW on Arduino boards? What’s its voltage safe range?
I got 2 STM32F103C8 Bluepills. They look like Arduino nano. But what confuses me is the VB port (means VBattery).
I read the pin map gif. It shows that VB port can’t stand a voltage as high as 5v (not a black dot, it’s a white dot or circle).
I saw a regulator on the back of Bluepill which looks like the one on Arduino Pro Mini’s which could be 3.3v(5v)~12v. But I’m not a hardware expert.
———–
A3.
This meant to be used with the RTC peripheral so you can power down the device but maintain the RTC settings. Search this site for RTC V Battery and read about the warnings about it. You want to use this only with 3v3. Feeding it anything else will blow your stm32 chip.
No VRAW pin, it accepts 5v input by USB and the 5v pin. If both are used together, may cause problems.
Read the link I posted above about powering the device. You can either power it via the USB or the 5v pin but not both at the same time. This 5v input goes to a tiny 3.3v regulator (I do mean tiny so don’t over load the 3.3v pins too much). The board it’self runs on 3.3v but can tolerate 5v intputs on some pins.
The VB pin is not a main power input pan. Cause couple of days later, I got some bigger boards with a tiny battery onboard, I think the PB’s VB pin may be used like that way.
Q4. What’s the right way to use 128kb flash? Just open a sketch of 100kb with the STM32F103C8 64kb option selected, then simply click upload?
The wiki says STM32F103C8 could have 128kb flash just like STM32F103CB, but there could be an exception case.
So how to set the chip option to make it 128kb? Should I choose the STM32F103CB 128k option?
I noticed when choosing STM32F103C8 64kb the upload log always display a flash of 128k.
———–
A4.
Just select 128k option and use it. I don’t think anyone has a bluepill that doesn’t have 128k. Obviously if you were making a commercial product you would buy the stm32f103cb if you needed the 128k, but as a hobbyist obviously you don’t care and just want bonus stuff for free. If it doesn’t work, you just switch back to 64k. If it does work, Win!
Q5. What’s the internal pull-up resistor’s value of the Bluepill and total minimize pull-up resistor for I2C?
Arduino active the internal pull-up resistor when Wire.begin(), is it the same for Bluepills?
I’m not an expert. Actually, I just learn the knowledge of pull-up resistor and frequency for Arduino lately.
———–
A5
You want to use external resistors with a bluepill. On top have having high resistance internal pullups, the 3V3 voltage will round your I2C square waves to become useless. So you want to use a lower value than you would use on a 5V Arduino. So if you used to use a 2.2k on a 5v, you want to use ~1k5 on 3v3.
Q6. Should all pins shared by Serial1/Wire1 be avoided? And does Serial1 conflict with Wire1(share PB6 PB7)?
Cause Arduino did not recommend using 0 and 1 which is used by Serial Communication. The pinout gif of Bluepill shows that PA9 PA10 PB6 PB7 are all used by RX1 TX1, should I avoid using all of them when Serial1 is in use?
And PB6 and PB7 are also used by I2C Wire1. When Serial1 functioning, can Wire1 be used? And seems PB8 PB9 is shared with Wire1…will they be banned, too?
I’m quite confused about so many shared PINs for the communication functions.
———–
A6
If you want to use the Serial1 pins as GPIO pins, fine do it. Same with Wire1.
Q7.I’ve found my Bluepill’s LED_BUILTIN is reversed. And I search the forum and found this post
https://www.stm32duino.com/viewtopic.php?t=2429
This post explains the Bug of the LED_BUILTIN.
Does this Reversed LED Bug happen to any other pin of Bluepill?
A7. Couples of days passed, answer this myself. Yes, cause my STM32F103RE and STM32F407VE arrived and they both got a reversed onboard LED.
———–
Answers mainly provided by Rick Kimball, thanks to him. And other kind members here.
After reading that you will find answers to many of your questions.
Ardunio is hugely supported and documented and ypou won’t find as much docs for the blue pill but solving the puzzle if what makes it fun ![]()
Read the link I posted above about powering the device. You can either power it via the USB or the 5v pin but not both at the same time. This 5v input goes to a tiny 3.3v regulator (I do mean tiny so don’t over load the 3.3v pins too much). The board it’self runs on 3.3v but can tolerate 5v intputs on some pins.
To upload a sketch there is a few ways. Most Ardunio boards have aUSB to serial converter on the board so you can upload via serail without needing extra hardware, The blue pill doesn’t have a USB to serial converter so to upload via serial you need to hook a USB to serial to the UART on pins PA9 and PA10. Usually most places sell this board with Ardunio boot loader already installed so you should be able to upload then. The blue pill does have OTG USB on the MCU but the boards have the wrong pullup so you can’t communicate via the USB connector unless you change the pull up resistor as shown in the link I posted above. The other way that you can upload is via st-link
The bible is great but it’s very hard for me. I will try to look up but still need something more like Arduino, I totally understand stm32duino is in the middle of stm32 and Arduino which is both a tech geek and an artist.
Thanks, flyboy74,
Thanks for your tips about the power, so there is no Raw input for the BP, I’m still confusing about the purpose of VB port.
Thanks for your tips about upload. I used Arduino Pro Mini so it is very similar at first. Things got weird is that after I succeeded in upload the blink example with Serial. I just upload the bootloader with Demonstrator GUI and connect BP with USB directly. Everything works! BP is used like an Arduino Nano rather than a Pro Mini. I didn’t modify the resistor cause I don’t know what’s the problem is. Will it cause other problems like lack of power?
[flyboy74 – Tue Jul 31, 2018 7:51 am] –
The blue pill does have OTG USB on the MCU but the boards have the wrong pullup so you can’t communicate via the USB connector unless you change the pull up resistor as shown in the link I posted above.
The bluepill doesn’t have OTG. USB OTG means it can act as a host. The bluepill can only act as a USB device.
[flyboy74 – Tue Jul 31, 2018 7:51 am] –
Usually most places sell this board with Ardunio boot loader already installed so you should be able to upload then.
This is not true. The only place offering a pill board preloaded with Roger’s USB bootloader is robotdyn.com All other sources provide the board loaded with just a blink program. You might be confusing it with the ROM based uart bootloader that works on USART1 which is built into the chip.
[human890209 – Tue Jul 31, 2018 12:12 pm] –
I didn’t modify the resistor cause I don’t know what’s the problem is. Will it cause other problems like lack of power?
I never changed the USB resistors and never had problems to upload over USB (Win10 x64 and XP).
Any answer for the other questions is welcomed. ![]()
[human890209 – Tue Jul 31, 2018 4:15 am] –
Q1. Is there a documentation for Bluepills just like those for Arduino boards on their official website?
That link isn’t documentation, but more a running blog on how the genericSTM32F103 board became the bluepill. As you follow the posts, you can learn as I learned, stumbling, experimenting, sharing my successes, enjoying other’s input, breaking things and then fixing them.
[human890209 – Tue Jul 31, 2018 4:15 am] –
Hi,
Q3. What’s the VB used for? Is it not the same as VRAW on Arduino boards? What’s its voltage safe range?
This meant to be used with the RTC peripheral so you can power down the device but maintain the RTC settings. Search this site for RTC V Battery and read about the warnings about it. You want to use this only with 3v3. Feeding it anything else will blow your stm32 chip.
[human890209 – Tue Jul 31, 2018 4:15 am] –
Q4. What’s the right way to use 128kb flash? Just open a sketch of 100kb with the STM32F103C8 64kb option selected, then simply click upload?
Just select 128k option and use it. I don’t think anyone has a bluepill that doesn’t have 128k. Obviously if you were making a commercial product you would buy the stm32f103cb if you needed the 128k, but as a hobbyist obviously you don’t care and just want bonus stuff for free. If it doesn’t work, you just switch back to 64k. If it does work, Win!
[human890209 – Tue Jul 31, 2018 4:15 am] –
Q5. What’s the internal pull-up resistor’s value of the Bluepill and total minimize pull-up resistor for I2C?
You want to use external resistors with a bluepill. On top have having high resistance internal pullups, the 3V3 voltage will round your I2C square waves to become useless. So you want to use a lower values than you would use on a 5V arduino. So if you used to use a 2.2k on a 5v, you want to use ~1k5 on 3v3.
[human890209 – Tue Jul 31, 2018 4:15 am] –
Q6. Should all pins shared by Serial1/Wire1 be avoided? And does Serial1 conflict with Wire1(share PB6 PB7)?
If you want to use the Serial1 pins as GPIO pins, fine do it. Same with Wire1.
[Rick Kimball – Tue Jul 31, 2018 1:09 pm] –[flyboy74 – Tue Jul 31, 2018 7:51 am] –
Usually most places sell this board with Ardunio boot loader already installed so you should be able to upload then.This is not true. The only place offering a pill board preloaded with Roger’s USB bootloader is robotdyn.com All other sources provide the board loaded with just a blink program. You might be confusing it with the ROM based uart bootloader that works on USART1 which is built into the chip.
OK something for me to learn here. My understanding was that Ardunio puts a small bit of code(ardunio boot loader) on the chip that when it starts up it checks the status of the boot pin and if selected for boot mode then instead of starting the main program it listens on UART1 for new code to be uploaded.
When I first started to use blue pill I was uploading from Ardunio IDE via PA9 and PA10 with CP2104 serial converter. R u saying this is not using Ardunio boot loader but rather a boot loader that is permanently on the chip and can’t be erased and Ardunio boot loader is a second boot loader that sits on top of this 1???
[flyboy74 – Tue Jul 31, 2018 9:42 pm] –
OK something for me to learn here. My understanding was that Ardunio puts a small bit of code(ardunio boot loader) on the chip that when it starts up …
The Arduino doesn’t add any code. It just uses one of the upload methods you select.
[flyboy74 – Tue Jul 31, 2018 9:42 pm] –
When I first started to use blue pill I was uploading from Ardunio IDE via PA9 and PA10 with CP2104 serial converter. R u saying this is not using Ardunio boot loader but rather a boot loader that is permanently on the chip and can’t be erased and Ardunio boot loader is a second boot loader that sits on top of this 1???
Yes, you were using the ROM (system memory) bootloader that is triggered by the settings of the BOOT0/BOOT1 pins when the chip is RESET. When this project first started, bluepill users only had this ROM builtin method to upload. Which at the time we didn’t consider a major problem. We had yet to discover why many of use couldn’t use USB (it turned out to be the problem with the R10 resistor not being 1k5) Roger’s bootloader didn’t work with the bluepill at that time. Bluepill users either used the USART1 ROM bootloader or we used an STlink SWD dongle. The only board that had a preloaded USB bootloader was the Maple Mini or the Maple Mini clone from Baite. There is actually no reason to load Roger’s bootloader if you are happy manipulating the BOOT0/BOOT1 pins and using a serial dongle. In fact, you get back 8k of flash buy not loading Roger’s bootloader.
You can find out about the Bootloader and which devices it will work win in the ST Application Note AN2606
from the AN2606 document wrote:The bootloader is stored in the internal boot ROM memory (system memory) of STM32
devices. It is programmed by ST during production. Its main task is to download the
application program to the internal Flash memory through one of the available serial
peripherals (USART, CAN, USB, I2C, SPI, etc.). A communication protocol is defined for
each serial interface, with a compatible command set and sequences. This document
applies to the products listed in Table 1. They are referred as STM32 throughout the
document.
I haven’t used DFU boot loader yet. But if I understand what your saying is that the Blue Pill doesn’t have DFU native but rather you have to add Roger code to use it but some other STM32 MCUs do have DFU native. Am I right in thinking the STM32F407 does in face have the DFU already on the ROM?
Also just so that I understand everything correctly that upload with st-link via SWD doesn’t require a boot loader and has a low level control (can reset/erase and flash) regardless off boot pins??
[flyboy74 – Wed Aug 01, 2018 12:07 am] –
Am I right in thinking the STM32F407 does in face have the DFU already on the ROM?
You should go read the AN2606. I think that chip does, but you would have to check. I’m drawn to the stm32f103cx because of the cost. If I was going to move up to the STM32F4 chips, I’d just buy a Nucleo or Discovery board which comes with an attached STlink and I wouldn’t worry about DFU or Serial bootloaders.
[flyboy74 – Wed Aug 01, 2018 12:07 am] –
Also just so that I understand everything correctly that upload with st-link via SWD doesn’t require a boot loader and has a low level control (can reset/erase and flash) regardless off boot pins??
Yes SWD talks to the Debug Access Port using the Coresight protocol. No bootloader used, you can reset/erase and flash, in addition, it provides its main purpose which is debugging. However, unlike the ROM serial bootloader which can’t be disabled, the user code can disable the SWD pins. In fact, the stm32duino code will disable the SWD pins if you compile and successfully upload using the “STM32Duino bootloader”. However, you can set the BOOT0 pin to 1 to gain control if you ever do that accidentally. Of course, if you never load Roger’s bootloader (AKA STM32Duino bootloader), you don’t have to worry as you won’t be able to upload without it.
Yes at $2US for a blue pill the price to performance ratio can’t be beat.
The black STM32F407VE at $7US is also very hard to beat for price to performance ratio with: more pins, RTC crystal and battery, SD card slot,QSPI flash storage along with more flash and RAM and processing power.
[flyboy74 – Wed Aug 01, 2018 6:33 am] –
I’m drawn to the stm32f103cx because of the costYes at $2US for a blue pill the price to performance ratio can’t be beat.
The black STM32F407VE at $7US is also very hard to beat for price to performance ratio with: more pins, RTC crystal and battery, SD card slot,QSPI flash storage along with more flash and RAM and processing power.
I disagree.
At a delivered price (qty==1), the $2.77 ESP8266 offers superior performance and capability (analog excepted.)
At a delivered price (qty==1), the $4.74 ESP32 blows the blue pill and ESP3266 out of the price-performance chart.
That being said, the Blue Pill is a go-to for sensor integration, protocol conversion, datagram parsing and formatting and many other places where discrete TTL/CMOS logic was used many years ago. In many circumstances, the Blue Pill is all that is needed.
Increasingly, I am finding that larger design efforts, while possibly distilled into the space of a Blue Pill are better put into an ESP32… huge SRAM, large 4M eeprom, dual-core, 3rd support processor, easily to utilize SPIFFS, low-power sleep, etc. Even the ESP8266 has a completely different power consumption personality when the RF section is disabled.
At ~ $2, the STM32 F103 boards are within the price of a few 4000 CMOS chips and I often use it that way.
For lifting heavier than the ESP32, I have fallen in love with the $5 rPi Zero. Just not for realtime data collection although my experience has been that near-realtime is often adequate.
Ray
I like ??duino because I can easily switch hardware without changing bunch of my codes.
For now, I’m looking for a best price-SRAM ratio hardware. Of course, faster and more functions are also welcomed.
Yesterday I just found STM32F407 got 192k SRAM which is nearly 10x Bluepill and the price is just 3.5x. So I ordered one.
And just ordered an ESP8266… The datasheet says it has about 50k SRAM, which is cool. And there seems an Arduino Core for it.
————3 minutes later——-
ESP32 got 520k SRAM!, and also an Arduino Core for it, keep ordering…..
At a delivered price (qty==1), the $2.77 ESP8266 offers superior performance and capability (analog excepted.)
At a delivered price (qty==1), the $4.74 ESP32 blows the blue pill and ESP3266 out of the price-performance chart.
I am certainly a lover of the ESP32 and I use it a lot mainly due WiFi enabled and bang for buck is crazy great.
Here is a robot that I built with a ESP32 that runs provides a WiFi access point and runs a web server with web sockets so that you can control the robot with a web broswer https://www.youtube.com/watch?v=-MyodFHwfTU the PCB with the ESP wrover module I designed and built myself
The only main downside that I have found with ESP32 is low pin count. I am always struggling for enough pins on my projects. My play with STM32 atm is because I am playing with a camera running 8 bit parallel and a LCD in 16 bit parallel.
ESP gives wireless connectivity and STMFx gives pins and real-time processing.
Btw, can you share some of the code from that video? Special interested in MicroWebSockets.
I have myself ported WebSockets to blue pill. Is MicroWebSockets different from that? Just trying to reduce the RAM usage.
I how ever write all my own keimatics for the robot see this series of 3 videos
https://www.youtube.com/watch?v=Rr02JyVlNfE&t=14s
https://www.youtube.com/watch?v=8yS1m_NS-bA&t=118s
https://www.youtube.com/watch?v=DfykegzGoDw&t=148s
All the body I designed myself in Autodesk fusion360 and cut out with my laser cutter
[flyboy74 – Thu Aug 02, 2018 8:59 am] –
<…>All the body I designed myself in Autodesk fusion360 and cut out with my laser cutter
Very impressive build! Bravo.
Ray
[flyboy74 – Thu Aug 02, 2018 5:13 am] –
<…>
The only main downside that I have found with ESP32 is low pin count. I am always struggling for enough pins on my projects. My play with STM32 atm is because I am playing with a camera running 8 bit parallel and a LCD in 16 bit parallel.
Exploring my earlier statement a bit more in depth, we must utilize auxiliary uC’s to manage real-time events. Just as the human arm will pull quickly away from a hot surface, the brain is only involved after-the-fact… usually with the pain signals! Architecturally, we are working with distributed systems. There have been lots of attention given to the layered approach for AI.
Most hobbyists that utilize GPS fail to realize that the GPS unit is a rather powerful microcontroller. After it does all the dirty work, it sends a nice serial stream out for digestion (usually by our STM32 or an Atmega uC. Distributed processing is all around us but we often fail to realize the team effort: just consider the modern automobile and the uC’s connected to the vehicle bus.
Ray
we must utilize auxiliary uC’s to manage real-time events.
Sorry, I’m a newbie.
I’m confusing that why auxiliary uC is related with the lack of pin count? Are you suggesting that using an STM32(more pins) talking to other hardware and communicate with ESP32 on a higher AI level? Using ESP32 like a brain and STM32 as epencephala and nerves?
I noticed the low pin’s number of ESP32, too. I think that’s reasonable for a board already with wifi and Bluetooth. And that won’t piss STM32 off…
My question is:
Most hobbyists that utilize GPS fail to realize that the GPS unit is a rather powerful microcontroller. After it does all the dirty work, it sends a nice serial stream out for digestion
Is the “dirty work” and the “Serial stream” more concerning about hardware circuit connection(a lot of input pin and a few output pin) or calculation?
Is ESP32 not good at real-time calculations?
This is a good question and I am a noob so not 100% sure on answer. I do know from my experience that ESP8266 and RPi zero have bad latency because of the threading to maintain the WiFi. I do believe that the dual core of the ESP32 had addressed some of these problems but am still lead to believe that STM32 still has faster interrupts than ESP32
My ESP8266 and ESP32 haven’t arrived yet.
Will ESP32’s extra processor core still get latency problems?
And cause I haven’t tried an ESP8266 yet, could I turn off the wifi and make it a normal board like STM32 to avoid the latency problem?
And another question for ESP32 and ESP8266.
They got 520k and 50k SRAM, but how much resource is consumed by the WIFI function? Are 520k and 50k 100% available for my sketch?
[human890209 – Fri Aug 03, 2018 5:53 am] –
And cause I haven’t tried an ESP8266 yet, could I turn off the wifi and make it a normal board like STM32 to avoid the latency problem?
…
They got 520k and 50k SRAM, but how much resource is consumed by the WIFI function? Are 520k and 50k 100% available for my sketch?
Although I am also interested to get the answers, I think these questions should be put on ESP forum.
But one should really stick to the topic of the first post.
[stevestrong – Fri Aug 03, 2018 12:14 pm] –
No problem, I have done myself a quick research on the net, and found a relevant link here: https://esp32.com/viewtopic.php?f=19&t=5308&start=10.But one should really stick to the topic of the first post.
Solely my fault for hijacking the discussion … In this forum, it is easy for me to go from an “engineer” prospective to an “architectural” prospective, thus many questions arise. To somewhat cap this discussion, let me say in general terms:
[*] ESP8266 is a single core uC like the STM32Fxxx. The “Arduino Core” of the ESP8266 uses a task-switcher called non-OS that allocates time slices between the RF stuff and housekeeping and the Arduino thread. Thus the programmer is entirely responsible for releasing the Arduino thread before the RF section becomes stale (the cause of many crashes.)[*] ESP32 Arduino core includes FreeRTOS such that by default, one core is for the Espressif stuff and one core is for the Arduino.
[*] An Operating System such as the Linux implementation in Raspberry Pi generally adds more latency than an RTOS and much more than Arduino on a uC.
A PhD friend of mine who is retired and deeply into robotics and machine learning is building his latest robot with 3 tiers of microcontrollers with the top level being an ESP32 hosting the aggregation of signals on a webpage … ESP32 likely to be replaced with an RPi Zero in the future.
Overview of Interrupt Latency issues
Ray


