I wanted to know if my CS32F103C8T6 Blue Pill boards and my RobotDyn STM32F103C8T6 board have functioning I2C capability. The answer is yes.
- Using the Blue Pill boards instead of Arduino UNO or other boards from the tutorial.
- Using a 12V lead acid battery instead of AA cells.
- Using a 10Ω 100W power resistor instead of an LED.
Here is the diagram of the physical setup:
For the code, I just used the getcurrent example from Adafruit INA219 library. From Arduino IDE: File → Examples → Adafruit INA219 → getcurrent. My Arduino IDE settings to upload the program to the board were:
- Board: “Generic STM32F1 series”
- Board part number: “BluePill F103C8”
- U(S)ART support: “Enabled (generic ‘Serial’)”
- USB support (if available): “CDC (generic ‘Serial’ supersede U(S)ART)”
- USB speed (if available): “Low/Full Speed”
- Optimize: “Smallest (-Os default)”
- C Runtime Library: “Newlib Nano (default)”
- Upload method: “Maple DFU Bootloader 2.0”
- Port: “/dev/ttyACM0”
After all set, I clicked the upload button in Arduino IDE. The upload was successful. Then I opened the serial monitor in Arduino IDE. What I got from all my Blue Pills boards look like this:
Bus Voltage: 11.45 V Shunt Voltage: 97.07 mV Load Voltage: 11.55 V Current: 970.40 mA Power: 11108.00 mW Bus Voltage: 11.45 V Shunt Voltage: 96.90 mV Load Voltage: 11.54 V Current: 969.40 mA Power: 11096.00 mW
Here’s how it actually looked:
In the photo above the current shown by the multimeter was higher compared to the serial monitor output. This was because I took the photo first, then copied the serial monitor output later.
So It worked for all of my boards: two CS32F103C8T6 Blue Pill boards and one RobotDyn STM32F103C8T6 board. So both chip have functioning I2C capability. Could it be that CS32F103C8T6 are nearly identical to STM32F103C8T6? I have no idea whether China Key System, the company that produce CS32F103C8T6 chips, are actually licensed to produce Arm chips. I don’t even know if the CS32F103C8T6 that I got are genuine CKS32 or clones. Imagine that: clone of a clone. Browsing their website gave me this error page.
According to Google Translate, that means:
Your visit may be dangerous to the website and has been intercepted by Cloud Defense.Google Translate for China Key System 403 Error
So I am unable to check anything from China Key System.
How about other clones? As far as I am aware, there are several STM32 clones, such as:
- CKS32 (China Key System)
- APM32 (Apex Microelectronics)
Edit 2020-12-29: Gone. All mentions of APM32 disappeared from Apex Microelectronics website.
- GD32 (GigaDevice).
I’m not sure about calling GD32 as clone of STM32, I think I read somewhere that GigaDevice actually have license to produce Arm chips. No idea about the others. I found some links about these clones, some positive, some negative:
- CS32F103C8T6 datasheet and tests (was:”UNEXPECTED idcode” flashing bluepill)
- Chinese clones attack STM32 microcontrollers
- GD32F103: A STM32F103 on steroids!
Update 2020-07-24: Roger Clark deleted this article, so here is the 2019-12-22 snapshot of the article, from the Wayback Machine by the Internet Archive.
- GD32F3 not really clone of STM32F3
- 32F103 Comparison: part 1, part2, part 3, and lastly part 4.
I am just glad that the I2C functionality doesn’t require much drama. This is plug and play, just like with Arduino boards.