BluePill: Difference between revisions
Created page with " The BluePill is an inexpensive Arduino style microcontroller board built around the STMicroelectronics ARM Cortex-M3 STM32F103CT6 microcontroller. frameless|501x501px The 32-bit microcontroller runs at 72MHz, has 20k of RAM, 128k of flash, and a shitload of GPIO pins. At around $5 each, it's basically superior to all the Arduino options, at a fraction of the price. VBAT can accept from 3 - 5VDC. 3V3 pins can alternatively be used to..." |
No edit summary |
||
| Line 3: | Line 3: | ||
[[File:BluePill pinout.png|frameless|501x501px]] | [[File:BluePill pinout.png|frameless|501x501px]] | ||
The 32-bit microcontroller runs at 72MHz, has 20k of RAM, 128k of flash, and a shitload of GPIO pins. At around $5 each, it's basically superior to all the Arduino options, at a fraction of the price. | The 32-bit microcontroller runs at 72MHz, has 20k of RAM, 128k of flash, and a shitload of GPIO pins. At around $5 each, it's basically superior to all the Arduino options, at a fraction of the price. | ||
| Line 13: | Line 15: | ||
VBAT is not connected directly to USB P+. '''Do not power it from one of the pins and from the USB port at the same time.''' | VBAT is not connected directly to USB P+. '''Do not power it from one of the pins and from the USB port at the same time.''' | ||
| Line 28: | Line 31: | ||
''The program will execute immediately upon uploading, but not upon reset until you set the "boot" jumper back to 0.'' | ''The program will execute immediately upon uploading, but not upon reset until you set the "boot" jumper back to 0.'' | ||
| Line 33: | Line 37: | ||
''platform: ststm32; board: bluepill_f103c8; framework: arduino'' | ''platform: ststm32; board: bluepill_f103c8; framework: arduino'' | ||
'''platformio.ini''' settings using arduino framework and TTL Serial Upload: | '''platformio.ini''' settings using arduino framework and TTL Serial Upload: | ||
<code> | <code>[env:bluepill_f103c8]</code> | ||
[env:bluepill_f103c8] | |||
platform = ststm32 | <code>platform = ststm32</code> | ||
board = bluepill_f103c8 | |||
framework = arduino | <code>board = bluepill_f103c8</code> | ||
upload_protocol = serial | |||
upload_port = /dev/ttyUSB0 | <code>framework = arduino</code> | ||
</code> | |||
<code>upload_protocol = serial</code> | |||
<code>upload_port = /dev/ttyUSB0 # correct as needed</code> | |||
| Line 50: | Line 59: | ||
'''Analog (0-3.3v) measurement:''' | '''Analog (0-3.3v) measurement:''' | ||
The 10 analog | The 10 analog input pins are 12-bit resolution. | ||
Analog inputs: PA0 - PA7, PB0, PB1 | Analog inputs: PA0 - PA7, PB0, PB1 | ||
'''PWM Output:''' | |||
There are 15 PWM pins total. | |||
PA0 - PA3, PA6 - PA10, PB0 - PB1, PB6 - PB9 | |||
''!! First set the PWM settings for the chip in your setup():'' | |||
<code>analogWriteResolution(8); # of bits of PWM resolution, max 16 bits</code> | |||
<code>analogWriteFrequency(1000); # PWM frequency in Hz, max unknown</code> | |||
Then you can use <code>analogWrite(PIN, VALUE)</code> as per usual. | |||
''N.B.: If you want to drive a PWM output from an analog reading, you can just set the analogWriteResolution to 12 and then you don't have to map the values!'' | |||
'''Misc:''' | |||
The user-definable LED on the board is sink-ground through PC13. Set PC13 LOW to turn it on. '''Note: PC13 is not a PWM output.''' | |||
Revision as of 16:10, 5 November 2023
The BluePill is an inexpensive Arduino style microcontroller board built around the STMicroelectronics ARM Cortex-M3 STM32F103CT6 microcontroller.
The 32-bit microcontroller runs at 72MHz, has 20k of RAM, 128k of flash, and a shitload of GPIO pins. At around $5 each, it's basically superior to all the Arduino options, at a fraction of the price.
VBAT can accept from 3 - 5VDC.
3V3 pins can alternatively be used to power the chip directly.
VBAT is not connected directly to USB P+. Do not power it from one of the pins and from the USB port at the same time.
To flash:
The USB port is basically useless.
- Connect a TTL-Serial adapter connected to UART1 (Pins PA9 & PA10 above, A9 A10 on the silkscreen).
- Set the "boot" jumper (top) to 1 (rightmost position).
- Press the [RESET] button
- Start your upload
The program will execute immediately upon uploading, but not upon reset until you set the "boot" jumper back to 0.
PlatformIO Configuration:
platform: ststm32; board: bluepill_f103c8; framework: arduino
platformio.ini settings using arduino framework and TTL Serial Upload:
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = serial
upload_port = /dev/ttyUSB0 # correct as needed
Analog (0-3.3v) measurement:
The 10 analog input pins are 12-bit resolution.
Analog inputs: PA0 - PA7, PB0, PB1
PWM Output:
There are 15 PWM pins total.
PA0 - PA3, PA6 - PA10, PB0 - PB1, PB6 - PB9
!! First set the PWM settings for the chip in your setup():
analogWriteResolution(8); # of bits of PWM resolution, max 16 bits
analogWriteFrequency(1000); # PWM frequency in Hz, max unknown
Then you can use analogWrite(PIN, VALUE) as per usual.
N.B.: If you want to drive a PWM output from an analog reading, you can just set the analogWriteResolution to 12 and then you don't have to map the values!
Misc:
The user-definable LED on the board is sink-ground through PC13. Set PC13 LOW to turn it on. Note: PC13 is not a PWM output.