[Solved] Questions from a newbie about Bluepill.

Working libraries, libraries being ported and related hardware
human890209
Posts: 34
Joined: Mon Jul 30, 2018 12:19 pm

[Solved] Questions from a newbie about Bluepill.

Post by 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?

(https://store.arduino.cc/usa/arduino-nano)
The wiki for pills is not very detailed.
-----------
A1. Not for now...
This post helps. Use google search site:stm32duinoforum.com/forum

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
http://stm32duinoforum.com/forum/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.
Last edited by human890209 on Wed Aug 15, 2018 12:59 pm, edited 6 times in total.

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by stevestrong » Tue Jul 31, 2018 7:27 am

The blue pill bible: https://www.st.com/content/ccc/resource ... 171190.pdf

After reading that you will find answers to many of your questions.

flyboy74
Posts: 231
Joined: Wed Jun 13, 2018 11:02 am

Re: ?Help! Questions from a newbie about Bluepill.

Post by flyboy74 » Tue Jul 31, 2018 7:51 am

I am a bit of noob myself but used this as a reference http://stm32duinoforum.com/forum/index.php?title=Blue_Pill

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

human890209
Posts: 34
Joined: Mon Jul 30, 2018 12:19 pm

Re: ?Help! Questions from a newbie about Bluepill.

Post by human890209 » Tue Jul 31, 2018 12:12 pm

Thanks, stevestrong,
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?

User avatar
Rick Kimball
Posts: 1400
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by Rick Kimball » Tue Jul 31, 2018 12:58 pm

flyboy74 wrote:
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.
-rick

User avatar
Rick Kimball
Posts: 1400
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by Rick Kimball » Tue Jul 31, 2018 1:09 pm

flyboy74 wrote:
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.
-rick

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by stevestrong » Tue Jul 31, 2018 2:17 pm

human890209 wrote:
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).

User avatar
Rick Kimball
Posts: 1400
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by Rick Kimball » Tue Jul 31, 2018 2:31 pm

What is your environment like stevestrong? I'm running an older 2009 iMac with a 2.0 USB powered hub running linux. Unless I deal with the resistor it never enumerates for me.
-rick

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: ?Help! Questions from a newbie about Bluepill.

Post by stevestrong » Tue Jul 31, 2018 3:37 pm

I work on win 10 x64 and tried also win xp x32. With or w/o hub, all work.

human890209
Posts: 34
Joined: Mon Jul 30, 2018 12:19 pm

Re: ?Help! Questions from a newbie about Bluepill.

Post by human890209 » Tue Jul 31, 2018 3:57 pm

Yes. I'm using a Win10 x64.

Any answer for the other questions is welcomed. :P

Post Reply