Category: Geen categorie

32F103 Comparison (part 7)

A while ago, I wrote a post about discovering performance difference between the STM32F103 and the CS32F103. With this in mind, I decided to run the Dhrystone benchmark on all of them. A benchmark as old as I am. I have compiled a firmware such that it contains the benchmark with O0, O1, O2, O3…


The Cortex M Series

Once upon a time, I wrote some code to identify a Cortex M core: cpuid_t *cpuid = (cpuid_t*) (&SCB->CPUID); if ((cpuid->PartNo & (0b11 Revision; where cpuid_t is defined as typedef union { uint32_t cpuid; struct { unsigned int Revision : 4; // p value in r_p_ unsigned int PartNo : 12; unsigned int Architecture :…


32F103 Comparison (part 6)

After the I²C test, showing problems with GigaDevice running at 400 kHz, and MegaHunt at either speed, this time I am running an SPI test. In this test, I have hooked up an MFRC522 and a CLRC663 PDC (RFID/NFC reader). Using this reader I will scan an ISO 14443 A tag (PICC), specifically an NTAG213….


32F103 Comparison (part 5)

It has been a while since I compared some 32F103 chips. Most recent posts has been about identifying them, but let’s now have a look at how they perform. In this post I will have a look at the I²C peripheral. The test is simple: A number of I²C peripherals is connected to the chip…


It’s a compiler bug!!!!

It’s a compiler bug!!! Yes!! It is!! Seriously, it is!!! Well… is it? Let’s have a look. What is going on with my RISCV debugging issue. So, last time, I mentioned, a binary built with GCC 8 could be debugged fine with GDB, however, building the same code with GCC 12 gave issues with GDB…


On RISCV bare metal toolchains (part 2)

I’m going to look into some more details regarding the debugging issues I am experiencing with a GCC12 toolchain that do not appear in a GCC8 toolchain on RISCV microcontrollers. I’m loading the binary, set a breakpoint, run the code until the breakpoint hits, and request a backtrace. Compiled with the MounRiver GCC8 toolchain I…


On RISCV bare metal toolchains

Some notes on RISCV bare metal toolchains, regarding building and debugging code on GigaDevice GD32VF103 and WinChipHead CH32V103 microcontrollers. In the past I’ve made some start-up code and linker files that allow building firmwares abstracting the differences between these two chips, allowing one unified firmware image for both of the MCUs. I’ll look at three…


I²C issues on GigaDevice microcontrollers

When I was looking into microcontrollers with 32F103 peripherals, but with a RISCV-core, I ran the stm32f1xx HAL on them. The assumption was, their peripherals were the same. (Except USB). Using this on a GD32VF103, I was able to communicate with most I²C sensors I connected to the bus, but I ran into issues with…


Wait a microsecond (part 2)

When running some tests regarding delay loops in assembly, I ran across some differences in timing between a CKS32F103 and an STM32F103 based Blue Pill. This lead me to run some tests across my collection of 32F103 chips. All chips involved have implemented the cycle counter in the DWT. We will use this to determine…


Wait a microsecond

Delaying a millisecond on a microcontroller. While, of course, we could use timer peripherals specific to our MCU, I’m looking for a more generic solution. On a Cortex M3 (or better) I’d check for the DWT, and if fitted, check whether it implements the cycle counter. However, on a Cortex M0 or (M0+) we have…