2з. STM32C5: the first series on HAL2 — the Cortex-M33 core, memory, peripherals, the NUCLEO-C562RE board and how the C5 differs from the C0, G0 and F1
Section 2 went through the STM32 portfolio using the older series, 2б and 2д covered the STM32U5 with TrustZone, 2ж the BlackPill board with the F411. All of them live on the classic HAL (here called HAL1, sections 5 and 5а). The STM32C5 is the first series that has no HAL1 at all: the ST package for it came out straight on the second generation of the library (HAL2) and for STM32CubeMX 2.
Here is what the C5 is according to the files of the package itself: which devices it describes, what core, where Flash, RAM and the peripherals are, where the clock comes from, which blocks each line has. Then the NUCLEO-C562RE board, the first program on HAL2 (a hello over UART and blinking), the same task on HAL1 for the C0, a comparison with the C0, G0 and F1 and when the C5 makes sense for a new product. How HAL2 itself and CubeMX 2 work is covered in sections 5б and 4г.
Prerequisites: the STM32CubeC5 package 2.1.0 — inside it the device description package
stm32c5xx_dfp 2.1.0 (the .pdsc file, CMSIS headers, SVD files, startup
code), the HAL2 and LL drivers stm32c5xx_drivers 2.1.0, the board part drivers
(LED, button) and project templates for three Nucleo boards. For
comparison — the STM32CubeMX device database DB.6.0.181 (C0, G0, F1, F4) and the
Keil pack STM32C0xx_DFP 1.0.0 with HAL1 for the C0. The numbers about the series are computed by a
script from the .pdsc and the headers, the builds are done with arm-none-eabi-gcc
12.2.1 in Docker. There is no board, and QEMU does not model the C5 series: nothing
was run on hardware.
Terms used in the documentation
Term Meaning Dtz = NO_TZ (in the core description of the package) the core has no TrustZone DSP extension (SMLAD etc.) instructions on pairs of 16-bit numbers: two multiplications and an addition in one instruction FPv5-SP, single precision FPU a floating-point unit for floatonlyMSPLIM, PSPLIM the stack lower-limit registers of ARMv8-M HSIS, HSIDIV3, HSIK the three outputs of the internal 144 MHz RC: direct, divided by 3, for peripherals PSI; PSIS, PSIDIV3, PSIK a frequency synthesizer instead of a PLL and its three outputs FLASH high-cycle data (EDATA) a Flash area for frequently rewritten data part driver (LED, button) a driver for a board part on top of HAL USE_EXTERNAL_ENV, stm32_external_env.h the flag and the file where the crystal frequency is set .ioc2 an STM32CubeMX 2 project file
2з.1 The place of the C5 in the range: nine lines, three subfamilies
The package .pdsc file describes 80 devices and 157 ordering variants
(package, temperature, packing). They fall into three subfamilies of three
lines each; each subfamily has its own die code in the DBGMCU register
at address 0xE0044000:
| Subfamily | Lines | Flash, KB | RAM, KB | Pins | Devices / variants | Die code |
|---|---|---|---|---|---|---|
| C53x/542 | C531, C532, C542 | 128, 256 | 64 | 20…64 | 25 / 58 | 0x44F |
| C55x/562 | C551, C552, C562 | 256, 512 | 128 | 32…100 | 25 / 51 | 0x44E |
| C59x/5A3 | C591, C593, C5A3 | 512, 1024 | 256 | 32…144 | 30 / 48 | 0x45A |
The core frequency is the same for all — 144 MHz. Inside a subfamily the lines differ not in memory but in the set of blocks (2з.4): the lowest (C531, C551, C591) has no CAN FD and no AES, the middle one (C532, C552, C593) has CAN FD, the top one (C542, C562, C5A3) has CAN FD and AES. Packages range from TSSOP-20 and UFQFPN 20 to LQFP 144.
The temperature is encoded in the last digit of the part number. The C562RE has four
variants: RET6 and RET6J — from −40 to 85 °C, RET3 and RET3TR — from
−40 to 125 °C. The NUCLEO-C562RE board carries an STM32C562RET6 (that is the name of the
startup code folder in the package templates): LQFP 64, 52 I/O
lines, 512 KB of Flash, 128 KB of RAM.
2з.2 The Cortex-M33 core: FPU, DSP, MPU — and no TrustZone
The core description in the .pdsc is one for the whole series: Cortex-M33 revision r0p4,
Dfpu = SP_FPU, Ddsp = DSP, Dmpu = MPU, Dtz = NO_TZ,
Dclock = 144000000. The headers of all nine lines confirm it:
__FPU_PRESENT, __DSP_PRESENT and __MPU_PRESENT are 1,
__NVIC_PRIO_BITS is 4 (16 priority levels), and
__SAUREGION_PRESENT is 0. There is no SAU block, so there is no split into
secure and non-secure worlds either: everything sections 2б and 2е do on the U585
does not apply to the C5. The package build template says so: TZ-disabled.
Protection is built on the MPU and on privileged mode.
The number of interrupts differs between lines: 68 on the C531, 82 on the C562, 98 on the C5A3.
From ARMv8-M the core inherited the stack limit registers. The package startup code
(it is written in C, not assembly) first writes the lower stack limit
into MSPLIM and PSPLIM: if the stack goes below it, the core raises a
UsageFault instead of quietly corrupting the data below the stack.
What the FPU and DSP give is visible from one source built for three cores
(-O2):
int32_t dot_q15(const int16_t *a, const int16_t *b, unsigned n) /* n чётное: по два отсчёта за раз */
{
int32_t s = 0;
for (unsigned i = 0; i < n; i += 2) {
#if defined(__ARM_FEATURE_SIMD32)
int16x2_t x, y;
__builtin_memcpy(&x, &a[i], 4);
__builtin_memcpy(&y, &b[i], 4);
s = __smlad(x, y, s); /* два умножения с накоплением */
#else
s += a[i] * b[i] + a[i + 1] * b[i + 1];
#endif
}
return s;
}
core m33 vmul=1 vadd=1 smlad=1 aeabi_fmul=0 aeabi_fadd=0 aeabi_dmul=1 text=96
core m3 vmul=0 vadd=0 smlad=0 aeabi_fmul=1 aeabi_fadd=1 aeabi_dmul=1 text=112
core m0p vmul=0 vadd=0 smlad=0 aeabi_fmul=1 aeabi_fadd=1 aeabi_dmul=1 text=128
On the C5 the float dot product runs on vmul.f32 and
vadd.f32 instructions, the convolution of 16-bit samples on one smlad per two samples.
On the Cortex-M3 (F1) and Cortex-M0+ (C0, G0) the same float turns into
calls to __aeabi_fmul and __aeabi_fadd, and there is no smlad at all. double
is in software everywhere, on the C5 too: its FPU is single precision only.
The code of the three functions is 96, 112 and 128 bytes.
2з.3 Memory map and clock
Flash. From address 0x08000000, in blocks of 8 KB: the C562RE has 64 of them.
The write unit in the package description is 16 bytes. Next to it are the service
areas: OTP from 0x08FFE000, the unique ID at 0x08FFF800, the Flash size
at 0x08FFF80C, the package code at 0x08FFF80E; the EDATA area for
frequently rewritten data from 0x09000000; system memory with the
factory bootloader from 0x0BF80000. The CubeMX 2 template for the board
closes the area 0x8FFE000…0x8FFFFFF with the MPU: read only, no
execution.
RAM. SRAM1 from 0x20000000, SRAM2 right after it, so the memory is
contiguous. The boundary depends on the subfamily: 0x20008000 on the C53x (32 + 32
KB), 0x20010000 on the C55x (64 + 64 KB), 0x20020000 on the C59x (128 + 128
KB). The C562 linker script from the package describes it as one piece
RAM of length 0x20000 — 128 KB; ROM is 0x80000, 512 KB.
Where the ST script puts the stack. Not at the end of RAM, but right after the data and
the heap: in the built program from 2з.7 the stack occupies
0x20000360…0x20000760, the first word of the vector table is
0x20000760. The heap is 0x200, the stack 0x400 bytes; the remaining almost 126
KB are free. Overrunning the 1 KB stack is caught by MSPLIM (2з.2), not by heap corruption.
Peripherals sit on six buses: APB1 from 0x40000000, APB2 from 0x40010000,
AHB1 from 0x40020000, AHB2 from 0x42020000, APB3 from 0x44000000, AHB3 from
0x44020000. Addresses of familiar blocks: USART2 — 0x40004400, GPIOA
— 0x42020000, RCC — 0x44020C00, EXTI — 0x44022000. The GPIO ports
moved to AHB2, and RCC and PWR to AHB3: register code from the F1 or
G0 does not carry over by addresses.
Clock. The C5 has no PLL: the word PLL does not occur in the C562 header even
once. Instead there is the PSI synthesizer: its input is the HSE crystal, the LSE watch
crystal or HSI divided by 18 (8 MHz); the reference frequency is chosen
from a fixed list (32768 Hz, 8, 16, 24, 25, 32, 48 or 50 MHz), and so is the output:
100, 144 or 160 MHz. From the LSE the output is not exact: by the
HAL RCC table it is 144015000 Hz instead of 144 MHz.
The internal RC runs at 144 MHz straight away. After reset the core runs from HSIDIV3,
that is, at 48 MHz. There are four SYSCLK sources: HSIS (144 MHz), HSIDIV3
(48 MHz), HSE and PSIS. The core limit is 144 MHz (the package Dclock); the 160 MHz PSI
output is not fed to the core in the templates. The NUCLEO-C562RE template takes the
24 MHz crystal, PSI with a 24 MHz reference and a 144 MHz output, undivided buses and
4 Flash wait states, which are set before switching to PSI.
2з.4 Peripherals by the headers
The pdsc2i.py script collects block instances from every header —
lines like #define USART2 ((USART_TypeDef *) USART2_BASE). The result by
subfamily:
| Block | C531 / C532 / C542 | C551 / C552 / C562 | C591 / C593 / C5A3 |
|---|---|---|---|
| Timers | 7: TIM1, 2, 6, 7, 8, 12, 15 | 10: plus TIM5, 16, 17 | 12: plus TIM3, 4 |
| LPTIM | 1 | 1 | 1 |
| USART / UART / LPUART | 2 / 2 / 1 | 3 / 2 / 1 | 4 / 3 / 1 |
| SPI | 2 | 3 | 3 |
| I2C / I3C | 1 / 1 | 2 / 1 | 2 / 1 |
| ADC / DAC | 1 / 1 | 2 / 1 | 3 / 1 |
| Comparators / op-amps | 2 / 1 | 1 / 0 | 1 / 0 |
| USB | USB_DRD_FS |
USB_DRD_FS |
USB_DRD_FS |
| FDCAN | 0 / 2 / 2 | 0 / 1 / 1 | 0 / 2 / 2 |
| AES | C542 only | C562 only | C5A3 only, which also has SAES and CCB |
| HASH, RNG, CORDIC, CRC, ICACHE | yes | yes | yes |
| PKA, Ethernet, XSPI | no | no | yes |
| GPIO ports | A…E, H | A…E, H | A…H |
| DMA | LPDMA1, LPDMA2 | LPDMA1, LPDMA2 | LPDMA1, LPDMA2 |
On the C562 LPDMA1 has 8 channels, LPDMA2 has 4. I3C is present in all nine
lines, while the C0, G0 and F1 do not have it (2з.5). Ethernet and the XSPI external memory
interface appear only in the C59x. The ICACHE instruction cache is everywhere,
and the package templates enable it even before the clock is configured.
HAL2 in the package is 44 module files stm32c5xx_hal_*.c and 33 LL
headers; the list in the release notes repeats the table: ADC, COMP, DAC,
OPAMP, TIM, LPTIM, FDCAN, I2C, I3C, SPI, I2S, UART, USB, ETH, XSPI, AES,
HASH, PKA, RNG, CCB, CORDIC, CRC.
2з.5 How the C5 differs from the C0, G0 and F1 — and when to take it
The C5 is taken from the package and the headers, the other three from the STM32CubeMX device database DB.6.0.181:
| C0 | G0 | F1 | C5 | |
|---|---|---|---|---|
| Core | Cortex-M0+ | Cortex-M0+ | Cortex-M3 | Cortex-M33 |
| Frequency, MHz | 48 | 64 | 72 | 144 |
| FPU, DSP | no | no | no | float, DSP |
| Flash, KB | 16…256 | 16…512 | 16…1024 | 128…1024 |
| RAM, KB | 6…36 | 8…144 | 4…96 | 64…256 |
| Pins | 8…64 | 8…100 | 36…144 | 20…144 |
| CAN | FDCAN, 1 | FDCAN, 2 | bxCAN, 2 | FDCAN, 2 |
| USB | yes | yes | yes | yes |
| I3C | no | no | no | yes |
| AES / HASH / RNG | no | AES, RNG | no | AES, HASH, RNG |
| CORDIC, ICACHE | no | no | no | yes |
| ST library | HAL1 | HAL1 | HAL1 | HAL2 only |
For the F4 the same database gives a Cortex-M4 up to 180 MHz, Flash up to 2048 KB and RAM up to
320 KB — in frequency and memory the F4 is larger than the C5. The CubeMX DB.6.0.181
database itself has not a single STM32C5 file: the classic CubeMX does not know the series, its
projects are .ioc2 only (the package examples contain 860 of them and 0 .ioc files).
When the C5 is a sensible choice. A new product that needs float or
DSP while an F4 is overkill; where CAN FD, USB and I3C are needed on one inexpensive
chip; where it matters that the library and tools are the ones ST is moving
all new series to. Then learning HAL2 on the C5 pays off better than
learning HAL1 on an old chip and relearning later.
When to stay with the old. The F1 — if the product is already in production and works, and there is debugged register or HAL1 code. The F4 — if you need more than 144 MHz, more than 256 KB of RAM, a camera or a parallel memory bus. The G0 — if a 64 MHz Cortex-M0+ is enough and price matters in a simple product. And in all cases — if the team has deadlines and no HAL2 experience.
2з.6 The NUCLEO-C562RE board by the package files
There is no board schematic in the package. What is known for sure comes from the code that CubeMX 2
generated for the start_from_nucleo template, and from the pin tables in
286 tables from the example descriptions (the "On board NUCLEO-C562RE" blocks):
| What | Pin | How it is connected |
|---|---|---|
| User LED | PA5 (D13) |
lit on a one |
| User button | PC13 |
pressed — a one; interrupt EXTI13 on both edges |
| Console | PA2 — TX, PA3 — RX |
USART2, function AF7, 115200 baud; routed to the ST-LINK |
| HSE crystal | PH0, PH1 |
24 MHz |
| LSE watch crystal | — | 32768 Hz in the template .ioc2 file |
The Arduino connectors, from the same tables: D13 — PA5, D12 — PA6, D11 —
PA7, D10 — PC9, D9 — PC6, D7 — PA8, D14 — PB7, D15 — PB6,
A2 — PA4, A4 — PC5. D14 and D15 in the examples are I2C1 or I3C1, D11…D13
are SPI1. The debugger is the on-board ST-LINK with a virtual COM port; the ST-LINK
version is not named in the package files.
The package has 300 examples for this board: 161 on HAL, 65 on LL, 58 with software components, the rest are templates, parts, utilities. For NUCLEO-C542RC there are 273, for NUCLEO-C5A3ZG 294.
2з.7 The first program on HAL2: hello and blinking
The ST template already does almost what is needed, but hides everything in
generated code. To see HAL2 itself, the program below is written
without it: the clock, the LED and the UART are set up by direct HAL2 calls, the way
CubeMX 2 would do it. Only two settings files are taken from the template
(stm32c5xx_hal_conf.h, stm32_external_env.h), plus the startup code and the
linker script.
/* Раздел 2з: первая программа на HAL2 для NUCLEO-C562RE — привет в USART2 и мигание светодиода.
Без кода CubeMX2: такт 144 МГц от кварца 24 МГц через PSI, PA5 — светодиод,
PA2 — USART2_TX (виртуальный COM-порт ST-LINK), 115200 8N1.
Конфигурация модулей — stm32c5xx_hal_conf.h и stm32_external_env.h из шаблона пакета. */
#include "stm32_hal.h"
#define LED_PORT HAL_GPIOA
#define LED_PIN HAL_GPIO_PIN_5 /* светодиод платы, горит при единице */
#define TX_PORT HAL_GPIOA
#define TX_PIN HAL_GPIO_PIN_2 /* USART2_TX, AF7 */
static hal_uart_handle_t huart2;
static const char hello[] = "Привет, STM32C562RE!\r\n";
void SysTick_Handler(void)
{
HAL_IncTick();
}
static void fail(void)
{
for (;;) {
}
}
/* 24 МГц HSE -> PSI 144 МГц -> SYSCLK; шины без деления; Flash — 4 такта */
static hal_status_t clock_144mhz(void)
{
hal_rcc_psi_config_t psi = {
.psi_source = HAL_RCC_PSI_SRC_HSE,
.psi_ref = HAL_RCC_PSI_REF_24MHZ,
.psi_out = HAL_RCC_PSI_OUT_144MHZ,
};
if (HAL_RCC_HSE_Enable(HAL_RCC_HSE_ON) != HAL_OK
|| HAL_RCC_PSI_SetConfig(&psi) != HAL_OK
|| HAL_RCC_PSIS_Enable() != HAL_OK) {
return HAL_ERROR;
}
HAL_FLASH_ITF_SetLatency(HAL_FLASH, HAL_FLASH_ITF_LATENCY_4); /* до повышения частоты */
if (HAL_RCC_SetSYSCLKSource(HAL_RCC_SYSCLK_SRC_PSIS) != HAL_OK) {
return HAL_ERROR;
}
HAL_FLASH_ITF_SetProgrammingDelay(HAL_FLASH, HAL_FLASH_ITF_PROGRAM_DELAY_2);
return HAL_UpdateCoreClock(); /* SystemCoreClock и SysTick */
}
static hal_status_t led_init(void)
{
hal_gpio_config_t g = {
.mode = HAL_GPIO_MODE_OUTPUT,
.output_type = HAL_GPIO_OUTPUT_PUSHPULL,
.pull = HAL_GPIO_PULL_NO,
.speed = HAL_GPIO_SPEED_FREQ_LOW,
.init_state = HAL_GPIO_PIN_RESET,
};
HAL_RCC_GPIOA_EnableClock();
return HAL_GPIO_Init(LED_PORT, LED_PIN, &g);
}
static hal_status_t uart_init(void)
{
hal_uart_config_t u = {
.baud_rate = 115200u,
.clock_prescaler = HAL_UART_PRESCALER_DIV1,
.word_length = HAL_UART_WORD_LENGTH_8_BIT,
.stop_bits = HAL_UART_STOP_BIT_1,
.parity = HAL_UART_PARITY_NONE,
.direction = HAL_UART_DIRECTION_TX,
.hw_flow_ctl = HAL_UART_HW_CONTROL_NONE,
.oversampling = HAL_UART_OVERSAMPLING_16,
.one_bit_sampling = HAL_UART_ONE_BIT_SAMPLE_DISABLE,
};
hal_gpio_config_t g = {
.mode = HAL_GPIO_MODE_ALTERNATE,
.output_type = HAL_GPIO_OUTPUT_PUSHPULL,
.pull = HAL_GPIO_PULL_NO,
.speed = HAL_GPIO_SPEED_FREQ_LOW,
.alternate = HAL_GPIO_AF_7,
};
if (HAL_UART_Init(&huart2, HAL_UART2) != HAL_OK) { /* ручка привязана к экземпляру */
return HAL_ERROR;
}
HAL_RCC_USART2_EnableClock();
if (HAL_RCC_USART2_SetKernelClkSource(HAL_RCC_USART2_CLK_SRC_PCLK1) != HAL_OK
|| HAL_UART_SetConfig(&huart2, &u) != HAL_OK) { /* настройки — отдельным шагом */
return HAL_ERROR;
}
HAL_RCC_GPIOA_EnableClock();
return HAL_GPIO_Init(TX_PORT, TX_PIN, &g);
}
int main(void)
{
if (HAL_Init() != HAL_OK || clock_144mhz() != HAL_OK || led_init() != HAL_OK || uart_init() != HAL_OK) {
fail();
}
(void)HAL_UART_Transmit(&huart2, hello, sizeof hello - 1u, 100u);
for (;;) {
HAL_GPIO_TogglePin(LED_PORT, LED_PIN);
HAL_Delay(500u);
}
}
What is not as in HAL1. The UART handle is bound to the instance by the very first
call HAL_UART_Init(&huart2, HAL_UART2), and the speed and frame format are
set separately — HAL_UART_SetConfig. The program itself turns on the block clock
(HAL_RCC_USART2_EnableClock), and the UART clock source is chosen
explicitly. The settings structures are ordinary structs with clear fields, and the
LED and port are given as a "port, pin" pair right in
HAL_GPIO_Init. HAL2 is covered in detail in 5б.
The same task on HAL1 — the NUCLEO-C031C6 board, STM32C031C6 (Keil pack STM32C0xx_DFP 1.0.0). The UART part:
huart2.Instance = USART2; /* экземпляр — поле структуры */
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart2) != HAL_OK) { /* настройка и запуск — одним вызовом */
fail();
}
The build build2i.sh in the stm-arm:1 image: our own files with -Wall -Wextra
-Werror, ST files with the ST project flags (-Os -Wall). There are
no warnings in any file, although the package targets GCC 13 and 14 and this is
12.2.1. Sizes:
size tmpl text=12160 data=112 bss=1872
size app text=6656 data=112 bss=1776
size hal1 text=4500 data=20 bss=176
tmpl— the ST template as is (LED, button,printfto the console): 64 files, the.binimage is 12272 bytes, 56 HAL2 functions.app— the program above: 49 files, the image is 6768 bytes, 34 HAL2 functions. The vector table is 98 words: 16 system ones and 82 interrupts of the C562.hal1— HAL1 on the C031: the image is 4520 bytes, 11 HAL1 functions.
app and hal1 cannot be compared head-on: different cores (Thumb-2 and Thumb),
on the C5 the clock is raised by the crystal and PSI to 144 MHz, on the C031 it is just HSI
48 MHz. But the difference in approach is visible: HAL2 splits the work into many small
functions (34 versus 11), HAL1 does more with macros and one big
HAL_UART_Init.
2з.8 Pitfalls
A "by hand" build cannot find HAL_RCC_HSE_ON. The crystal frequency
is defined in stm32_external_env.h, and it is included only if
USE_EXTERNAL_ENV is set. That flag is set by the file
Pre_Include_Global.h, and only under the component macro
CMSIS_USE_generated_Device_STM32CubeMX2_Config_RCC_2_1_0, which
the CubeMX 2 CMake wrapper sets. Your own Makefile without this macro fails:
norte error: 'HAL_RCC_HSE_ON' undeclared
SystemCoreClock after an RCC reset is 10 times too small. In all nine
headers HSI_RESET_VALUE equals 4800000UL — 4.8 MHz, while the table in the
RCC driver itself and system_stm32c5xx.c speak of 48 MHz.
HAL_RCC_Reset() and HAL_RCC_ResetSystemClock() assign exactly this value to
SystemCoreClock. The HAL tick does not suffer — it takes the
frequency from the RCC registers — but everything that reads SystemCoreClock after
such a reset is off by a factor of 10 until HAL_UpdateCoreClock() is called.
The header comment lies about the Flash size. In all nine lines the
FLASH_BASE line says "512 KB" — both on the C531 with 256 KB and on the C5A3 with
1024 KB. The chip size is read from 0x08FFF80C, not from the comment.
HAL2 is incompatible with HAL1. Different type names (hal_uart_handle_t
instead of UART_HandleTypeDef), a different initialization order, different
port macros. HAL1 code does not build even after replacing the header —
it is rewritten. Classic CubeMX .ioc projects do not open in CubeMX 2:
the .ioc2 format is different, and the CubeMX DB.6.0.181 database has not a
single C5.
Register code from the F1 and G0 does not carry over. The GPIO ports are on AHB2 from
0x42020000, RCC on AHB3, the clock goes through PSI rather than a PLL. Porting
starts from the map in 2з.3.
The stack is not at the end of RAM. In the ST linker script the 1 KB stack sits right
after the heap. A big array in a local variable goes past MSPLIM, and
the program falls into a UsageFault although there are many free kilobytes of RAM.
The stack size is changed in the script's STACK_SIZE.
The LED and SPI1 on one pin. PA5 is both the board LED and
Arduino D13, and SPI1_SCK in the package examples. An expansion board with SPI on
D13 blinks the LED on every transfer.
Few third-party examples. The series is new: almost everything available is the 300 package examples for the NUCLEO-C562RE. Forum answers and third-party libraries are mostly written for HAL1 and do not fit the C5 directly.
The chip still has to be bought. Before laying out the board, check that the required
part number in full — line, memory, package and temperature (RET6 versus
RET3) — is actually shipped and will keep shipping, not just
described in the package.
2з.9 Summary
- The STM32C5 is 9 lines in 3 subfamilies, 80 devices and 157 variants: Flash 128…1024 KB, RAM 64…256 KB, packages of 20…144 pins, the core at 144 MHz.
- A Cortex-M33 r0p4 with an FPU for
float, DSP and MPU; no TrustZone (Dtz = NO_TZ,__SAUREGION_PRESENT= 0). floaton the C5 isvmul.f32andvadd.f32instructions, on the M3 and M0+ it is library calls;doubleis in software everywhere.- No PLL: the PSI synthesizer gives 100, 144 or 160 MHz; after reset — 48 MHz from HSIDIV3; NUCLEO-C562RE — a 24 MHz crystal and 144 MHz, Flash 4 wait states.
- Every line has USB, I3C, HASH, RNG, CORDIC; CAN FD is in the middle and top lines, AES in the top ones, Ethernet and XSPI only in the C59x.
- The first program on HAL2 is 6656 bytes of code, the ST template 12160, the same task on HAL1 for the C031 4500; 34 HAL2 functions versus 11 HAL1.
- In the headers
HSI_RESET_VALUE= 4.8 MHz instead of 48; without the CubeMX 2 component macro the build does not see the HSE.
Next: section 3 "The C language for embedded systems" — types, bit operations,
volatile and why the compiler sometimes throws your code away.