Difference between revisions of "STM32L432Kx Flash Size"
(6 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
Inspired by this, I decided to test the STM32L432KB on my own board. As per the datasheet this processor is supposed to have 128 kB of flash ranging from 0x8000000 to 0x801FFFF. | Inspired by this, I decided to test the STM32L432KB on my own board. As per the datasheet this processor is supposed to have 128 kB of flash ranging from 0x8000000 to 0x801FFFF. | ||
− | == Testing == | + | == Testing == |
+ | [[File:Flash Size Test Setup.jpg|thumb|300px|STM32L432 Test Setup]] | ||
+ | |||
+ | === Checking device === | ||
+ | |||
+ | <pre> | ||
+ | lth@ncpws04:~/tmp$ st-info --probe | ||
+ | Found 1 stlink programmers | ||
+ | version: V2J45S31 | ||
+ | serial: 066CFF3933584B3043184346 | ||
+ | flash: 131072 (pagesize: 2048) | ||
+ | sram: 49152 | ||
+ | chipid: 0x435 | ||
+ | dev-type: STM32L41x_L42x | ||
+ | </pre> | ||
+ | |||
+ | Notice that the device reports 128 kB of flash - as is expected. | ||
=== Generating Test Data === | === Generating Test Data === | ||
Line 29: | Line 45: | ||
=== Writing data to MCU === | === Writing data to MCU === | ||
− | The random.bin file is of a size which | + | The random.bin file is of a size which should only be possible to flash on STM32L432KC. |
First step is to flash normal: | First step is to flash normal: | ||
Line 43: | Line 59: | ||
</pre> | </pre> | ||
− | As expected this | + | As expected this failed. The [[MCU]] reports 128 kB of flash and we attempt to write 256 kB. We can however instruct st-flash to ignore that and attempt to write the entire file: |
<pre> | <pre> | ||
Line 52: | Line 68: | ||
file random.bin md5 checksum: 5f7ebd5c822e7408e6279445eb1444a, stlink checksum: 0x01fe53dd | file random.bin md5 checksum: 5f7ebd5c822e7408e6279445eb1444a, stlink checksum: 0x01fe53dd | ||
2024-09-02T10:30:26 INFO common_flash.c: Attempting to write 262144 (0x40000) bytes to stm32 address: 134217728 (0x8000000) | 2024-09-02T10:30:26 INFO common_flash.c: Attempting to write 262144 (0x40000) bytes to stm32 address: 134217728 (0x8000000) | ||
− | EraseFlash - Page:0x10 Size:0x800 -> Flash page at 0x8008000 erased (size: 0x800EraseFlash - Page:0x11 Size:0x800 -> Flash page at 0x8008800 erased (size: 0x800EraseFlash - Page:0x12 Size:0x800 -> Flash page at 0x8009000 erased (size: | + | EraseFlash - Page:0x10 Size:0x800 -> Flash page at 0x8008000 erased (size: 0x800EraseFlash - Page:0x11 Size:0x800 -> Flash page at 0x8008800 erased (size: 0x800EraseFlash - Page:0x12 Size:0x800 -> Flash page at 0x8009000 erased (size: 0x800 |
+ | EraseFlash - Page:0x13 Size:0x800 -> Flash page at 0x8009800 erased (size: 0x800EraseFlash - Page:0x14 Size:0x800 -> Flash page at 0x800a000 erased (size: 0x800EraseFlash - Page:0x15 Size:0x800 -> Flash page at 0x800a800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x16 Size:0x800 -> Flash page at 0x800b000 erased (size: 0x800EraseFlash - Page:0x17 Size:0x800 -> Flash page at 0x800b800 erased (size: 0x800EraseFlash - Page:0x18 Size:0x800 -> Flash page at 0x800c000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x19 Size:0x800 -> Flash page at 0x800c800 erased (size: 0x800EraseFlash - Page:0x1a Size:0x800 -> Flash page at 0x800d000 erased (size: 0x800EraseFlash - Page:0x1b Size:0x800 -> Flash page at 0x800d800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x1c Size:0x800 -> Flash page at 0x800e000 erased (size: 0x800EraseFlash - Page:0x1d Size:0x800 -> Flash page at 0x800e800 erased (size: 0x800EraseFlash - Page:0x1e Size:0x800 -> Flash page at 0x800f000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x1f Size:0x800 -> Flash page at 0x800f800 erased (size: 0x800EraseFlash - Page:0x20 Size:0x800 -> Flash page at 0x8010000 erased (size: 0x800EraseFlash - Page:0x21 Size:0x800 -> Flash page at 0x8010800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x22 Size:0x800 -> Flash page at 0x8011000 erased (size: 0x800EraseFlash - Page:0x23 Size:0x800 -> Flash page at 0x8011800 erased (size: 0x800EraseFlash - Page:0x24 Size:0x800 -> Flash page at 0x8012000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x25 Size:0x800 -> Flash page at 0x8012800 erased (size: 0x800EraseFlash - Page:0x26 Size:0x800 -> Flash page at 0x8013000 erased (size: 0x800EraseFlash - Page:0x27 Size:0x800 -> Flash page at 0x8013800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x28 Size:0x800 -> Flash page at 0x8014000 erased (size: 0x800EraseFlash - Page:0x29 Size:0x800 -> Flash page at 0x8014800 erased (size: 0x800EraseFlash - Page:0x2a Size:0x800 -> Flash page at 0x8015000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x2b Size:0x800 -> Flash page at 0x8015800 erased (size: 0x800EraseFlash - Page:0x2c Size:0x800 -> Flash page at 0x8016000 erased (size: 0x800EraseFlash - Page:0x2d Size:0x800 -> Flash page at 0x8016800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x2e Size:0x800 -> Flash page at 0x8017000 erased (size: 0x800EraseFlash - Page:0x2f Size:0x800 -> Flash page at 0x8017800 erased (size: 0x800EraseFlash - Page:0x30 Size:0x800 -> Flash page at 0x8018000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x31 Size:0x800 -> Flash page at 0x8018800 erased (size: 0x800EraseFlash - Page:0x32 Size:0x800 -> Flash page at 0x8019000 erased (size: 0x800EraseFlash - Page:0x33 Size:0x800 -> Flash page at 0x8019800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x34 Size:0x800 -> Flash page at 0x801a000 erased (size: 0x800EraseFlash - Page:0x35 Size:0x800 -> Flash page at 0x801a800 erased (size: 0x800EraseFlash - Page:0x36 Size:0x800 -> Flash page at 0x801b000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x37 Size:0x800 -> Flash page at 0x801b800 erased (size: 0x800EraseFlash - Page:0x38 Size:0x800 -> Flash page at 0x801c000 erased (size: 0x800EraseFlash - Page:0x39 Size:0x800 -> Flash page at 0x801c800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x3a Size:0x800 -> Flash page at 0x801d000 erased (size: 0x800EraseFlash - Page:0x3b Size:0x800 -> Flash page at 0x801d800 erased (size: 0x800EraseFlash - Page:0x3c Size:0x800 -> Flash page at 0x801e000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x3d Size:0x800 -> Flash page at 0x801e800 erased (size: 0x800EraseFlash - Page:0x3e Size:0x800 -> Flash page at 0x801f000 erased (size: 0x800EraseFlash - Page:0x3f Size:0x800 -> Flash page at 0x801f800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x40 Size:0x800 -> Flash page at 0x8020000 erased (size: 0x800EraseFlash - Page:0x41 Size:0x800 -> Flash page at 0x8020800 erased (size: 0x800EraseFlash - Page:0x42 Size:0x800 -> Flash page at 0x8021000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x43 Size:0x800 -> Flash page at 0x8021800 erased (size: 0x800EraseFlash - Page:0x44 Size:0x800 -> Flash page at 0x8022000 erased (size: 0x800EraseFlash - Page:0x45 Size:0x800 -> Flash page at 0x8022800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x46 Size:0x800 -> Flash page at 0x8023000 erased (size: 0x800EraseFlash - Page:0x47 Size:0x800 -> Flash page at 0x8023800 erased (size: 0x800EraseFlash - Page:0x48 Size:0x800 -> Flash page at 0x8024000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x49 Size:0x800 -> Flash page at 0x8024800 erased (size: 0x800EraseFlash - Page:0x4a Size:0x800 -> Flash page at 0x8025000 erased (size: 0x800EraseFlash - Page:0x4b Size:0x800 -> Flash page at 0x8025800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x4c Size:0x800 -> Flash page at 0x8026000 erased (size: 0x800EraseFlash - Page:0x4d Size:0x800 -> Flash page at 0x8026800 erased (size: 0x800EraseFlash - Page:0x4e Size:0x800 -> Flash page at 0x8027000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x4f Size:0x800 -> Flash page at 0x8027800 erased (size: 0x800EraseFlash - Page:0x50 Size:0x800 -> Flash page at 0x8028000 erased (size: 0x800EraseFlash - Page:0x51 Size:0x800 -> Flash page at 0x8028800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x52 Size:0x800 -> Flash page at 0x8029000 erased (size: 0x800EraseFlash - Page:0x53 Size:0x800 -> Flash page at 0x8029800 erased (size: 0x800EraseFlash - Page:0x54 Size:0x800 -> Flash page at 0x802a000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x55 Size:0x800 -> Flash page at 0x802a800 erased (size: 0x800EraseFlash - Page:0x56 Size:0x800 -> Flash page at 0x802b000 erased (size: 0x800EraseFlash - Page:0x57 Size:0x800 -> Flash page at 0x802b800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x58 Size:0x800 -> Flash page at 0x802c000 erased (size: 0x800EraseFlash - Page:0x59 Size:0x800 -> Flash page at 0x802c800 erased (size: 0x800EraseFlash - Page:0x5a Size:0x800 -> Flash page at 0x802d000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x5b Size:0x800 -> Flash page at 0x802d800 erased (size: 0x800EraseFlash - Page:0x5c Size:0x800 -> Flash page at 0x802e000 erased (size: 0x800EraseFlash - Page:0x5d Size:0x800 -> Flash page at 0x802e800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x5e Size:0x800 -> Flash page at 0x802f000 erased (size: 0x800EraseFlash - Page:0x5f Size:0x800 -> Flash page at 0x802f800 erased (size: 0x800EraseFlash - Page:0x60 Size:0x800 -> Flash page at 0x8030000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x61 Size:0x800 -> Flash page at 0x8030800 erased (size: 0x800EraseFlash - Page:0x62 Size:0x800 -> Flash page at 0x8031000 erased (size: 0x800EraseFlash - Page:0x63 Size:0x800 -> Flash page at 0x8031800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x64 Size:0x800 -> Flash page at 0x8032000 erased (size: 0x800EraseFlash - Page:0x65 Size:0x800 -> Flash page at 0x8032800 erased (size: 0x800EraseFlash - Page:0x66 Size:0x800 -> Flash page at 0x8033000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x67 Size:0x800 -> Flash page at 0x8033800 erased (size: 0x800EraseFlash - Page:0x68 Size:0x800 -> Flash page at 0x8034000 erased (size: 0x800EraseFlash - Page:0x69 Size:0x800 -> Flash page at 0x8034800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x6a Size:0x800 -> Flash page at 0x8035000 erased (size: 0x800EraseFlash - Page:0x6b Size:0x800 -> Flash page at 0x8035800 erased (size: 0x800EraseFlash - Page:0x6c Size:0x800 -> Flash page at 0x8036000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x6d Size:0x800 -> Flash page at 0x8036800 erased (size: 0x800EraseFlash - Page:0x6e Size:0x800 -> Flash page at 0x8037000 erased (size: 0x800EraseFlash - Page:0x6f Size:0x800 -> Flash page at 0x8037800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x70 Size:0x800 -> Flash page at 0x8038000 erased (size: 0x800EraseFlash - Page:0x71 Size:0x800 -> Flash page at 0x8038800 erased (size: 0x800EraseFlash - Page:0x72 Size:0x800 -> Flash page at 0x8039000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x73 Size:0x800 -> Flash page at 0x8039800 erased (size: 0x800EraseFlash - Page:0x74 Size:0x800 -> Flash page at 0x803a000 erased (size: 0x800EraseFlash - Page:0x75 Size:0x800 -> Flash page at 0x803a800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x76 Size:0x800 -> Flash page at 0x803b000 erased (size: 0x800EraseFlash - Page:0x77 Size:0x800 -> Flash page at 0x803b800 erased (size: 0x800EraseFlash - Page:0x78 Size:0x800 -> Flash page at 0x803c000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x79 Size:0x800 -> Flash page at 0x803c800 erased (size: 0x800EraseFlash - Page:0x7a Size:0x800 -> Flash page at 0x803d000 erased (size: 0x800EraseFlash - Page:0x7b Size:0x800 -> Flash page at 0x803d800 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x7c Size:0x800 -> Flash page at 0x803e000 erased (size: 0x800EraseFlash - Page:0x7d Size:0x800 -> Flash page at 0x803e800 erased (size: 0x800EraseFlash - Page:0x7e Size:0x800 -> Flash page at 0x803f000 erased (size: 0x800 | ||
+ | EraseFlash - Page:0x7f Size:0x800 -> Flash page at 0x803f800 erased (size: 0x800) | ||
2024-09-02T10:30:29 INFO flash_loader.c: Starting Flash write for F2/F4/F7/L4 | 2024-09-02T10:30:29 INFO flash_loader.c: Starting Flash write for F2/F4/F7/L4 | ||
2024-09-02T10:30:29 INFO flash_loader.c: Successfully loaded flash loader in sram | 2024-09-02T10:30:29 INFO flash_loader.c: Successfully loaded flash loader in sram |
Latest revision as of 07:37, 2 September 2024
The STM32L432Kx is available with two different flash sizes. The STM32L432KB has got 128 kB while the STM32L432KC has got 256 kB. I recently created a USB "key" using the STM32L432. The reason for using this specific STM32 MCU was twofold:
- It is small
- It's got a built-in 48 MHz oscillator precise enough to use USB without an external crystal
Unfortunately, while I wanted the 256 kB version, only the 128 kB version was available.
The STM32 Blue Pill boards mostly use Chinese clone MCUs but there has been a lot of writing about the original ones having 128 kB of flash rather than the 64 kB specified by the datasheet. There is even a test tool available which can test for the hidden flash.
Inspired by this, I decided to test the STM32L432KB on my own board. As per the datasheet this processor is supposed to have 128 kB of flash ranging from 0x8000000 to 0x801FFFF.
Testing
Checking device
lth@ncpws04:~/tmp$ st-info --probe Found 1 stlink programmers version: V2J45S31 serial: 066CFF3933584B3043184346 flash: 131072 (pagesize: 2048) sram: 49152 chipid: 0x435 dev-type: STM32L41x_L42x
Notice that the device reports 128 kB of flash - as is expected.
Generating Test Data
First step is to create a 256 kB file with random data.
lth@ncpws04:~/tmp$ dd if=/dev/urandom of=random.bin bs=1k count=256 256+0 records in 256+0 records out 262144 bytes (262 kB, 256 KiB) copied, 0.0012241 s, 214 MB/s
Writing data to MCU
The random.bin file is of a size which should only be possible to flash on STM32L432KC.
First step is to flash normal:
lth@ncpws04:~/tmp$ st-flash write random.bin 0x8000000 st-flash 1.8.0 2024-09-02T10:30:01 INFO common.c: STM32L41x_L42x: 48 KiB SRAM, 128 KiB flash in at least 2 KiB pages. file random.bin md5 checksum: 5f7ebd5c822e7408e6279445eb1444a, stlink checksum: 0x01fe53dd 2024-09-02T10:30:01 INFO common_flash.c: Attempting to write 262144 (0x40000) bytes to stm32 address: 134217728 (0x8000000) 2024-09-02T10:30:01 ERROR common_flash.c: The size exceeds the size of the flash (0x00020000 bytes available) stlink_fwrite_flash() == -1
As expected this failed. The MCU reports 128 kB of flash and we attempt to write 256 kB. We can however instruct st-flash to ignore that and attempt to write the entire file:
lth@ncpws04:~/tmp$ st-flash --flash=256k write random.bin 0x8000000 st-flash 1.8.0 2024-09-02T10:30:26 INFO common.c: STM32L41x_L42x: 48 KiB SRAM, 128 KiB flash in at least 2 KiB pages. Forcing flash size: --flash=0x00040000 file random.bin md5 checksum: 5f7ebd5c822e7408e6279445eb1444a, stlink checksum: 0x01fe53dd 2024-09-02T10:30:26 INFO common_flash.c: Attempting to write 262144 (0x40000) bytes to stm32 address: 134217728 (0x8000000) EraseFlash - Page:0x10 Size:0x800 -> Flash page at 0x8008000 erased (size: 0x800EraseFlash - Page:0x11 Size:0x800 -> Flash page at 0x8008800 erased (size: 0x800EraseFlash - Page:0x12 Size:0x800 -> Flash page at 0x8009000 erased (size: 0x800 EraseFlash - Page:0x13 Size:0x800 -> Flash page at 0x8009800 erased (size: 0x800EraseFlash - Page:0x14 Size:0x800 -> Flash page at 0x800a000 erased (size: 0x800EraseFlash - Page:0x15 Size:0x800 -> Flash page at 0x800a800 erased (size: 0x800 EraseFlash - Page:0x16 Size:0x800 -> Flash page at 0x800b000 erased (size: 0x800EraseFlash - Page:0x17 Size:0x800 -> Flash page at 0x800b800 erased (size: 0x800EraseFlash - Page:0x18 Size:0x800 -> Flash page at 0x800c000 erased (size: 0x800 EraseFlash - Page:0x19 Size:0x800 -> Flash page at 0x800c800 erased (size: 0x800EraseFlash - Page:0x1a Size:0x800 -> Flash page at 0x800d000 erased (size: 0x800EraseFlash - Page:0x1b Size:0x800 -> Flash page at 0x800d800 erased (size: 0x800 EraseFlash - Page:0x1c Size:0x800 -> Flash page at 0x800e000 erased (size: 0x800EraseFlash - Page:0x1d Size:0x800 -> Flash page at 0x800e800 erased (size: 0x800EraseFlash - Page:0x1e Size:0x800 -> Flash page at 0x800f000 erased (size: 0x800 EraseFlash - Page:0x1f Size:0x800 -> Flash page at 0x800f800 erased (size: 0x800EraseFlash - Page:0x20 Size:0x800 -> Flash page at 0x8010000 erased (size: 0x800EraseFlash - Page:0x21 Size:0x800 -> Flash page at 0x8010800 erased (size: 0x800 EraseFlash - Page:0x22 Size:0x800 -> Flash page at 0x8011000 erased (size: 0x800EraseFlash - Page:0x23 Size:0x800 -> Flash page at 0x8011800 erased (size: 0x800EraseFlash - Page:0x24 Size:0x800 -> Flash page at 0x8012000 erased (size: 0x800 EraseFlash - Page:0x25 Size:0x800 -> Flash page at 0x8012800 erased (size: 0x800EraseFlash - Page:0x26 Size:0x800 -> Flash page at 0x8013000 erased (size: 0x800EraseFlash - Page:0x27 Size:0x800 -> Flash page at 0x8013800 erased (size: 0x800 EraseFlash - Page:0x28 Size:0x800 -> Flash page at 0x8014000 erased (size: 0x800EraseFlash - Page:0x29 Size:0x800 -> Flash page at 0x8014800 erased (size: 0x800EraseFlash - Page:0x2a Size:0x800 -> Flash page at 0x8015000 erased (size: 0x800 EraseFlash - Page:0x2b Size:0x800 -> Flash page at 0x8015800 erased (size: 0x800EraseFlash - Page:0x2c Size:0x800 -> Flash page at 0x8016000 erased (size: 0x800EraseFlash - Page:0x2d Size:0x800 -> Flash page at 0x8016800 erased (size: 0x800 EraseFlash - Page:0x2e Size:0x800 -> Flash page at 0x8017000 erased (size: 0x800EraseFlash - Page:0x2f Size:0x800 -> Flash page at 0x8017800 erased (size: 0x800EraseFlash - Page:0x30 Size:0x800 -> Flash page at 0x8018000 erased (size: 0x800 EraseFlash - Page:0x31 Size:0x800 -> Flash page at 0x8018800 erased (size: 0x800EraseFlash - Page:0x32 Size:0x800 -> Flash page at 0x8019000 erased (size: 0x800EraseFlash - Page:0x33 Size:0x800 -> Flash page at 0x8019800 erased (size: 0x800 EraseFlash - Page:0x34 Size:0x800 -> Flash page at 0x801a000 erased (size: 0x800EraseFlash - Page:0x35 Size:0x800 -> Flash page at 0x801a800 erased (size: 0x800EraseFlash - Page:0x36 Size:0x800 -> Flash page at 0x801b000 erased (size: 0x800 EraseFlash - Page:0x37 Size:0x800 -> Flash page at 0x801b800 erased (size: 0x800EraseFlash - Page:0x38 Size:0x800 -> Flash page at 0x801c000 erased (size: 0x800EraseFlash - Page:0x39 Size:0x800 -> Flash page at 0x801c800 erased (size: 0x800 EraseFlash - Page:0x3a Size:0x800 -> Flash page at 0x801d000 erased (size: 0x800EraseFlash - Page:0x3b Size:0x800 -> Flash page at 0x801d800 erased (size: 0x800EraseFlash - Page:0x3c Size:0x800 -> Flash page at 0x801e000 erased (size: 0x800 EraseFlash - Page:0x3d Size:0x800 -> Flash page at 0x801e800 erased (size: 0x800EraseFlash - Page:0x3e Size:0x800 -> Flash page at 0x801f000 erased (size: 0x800EraseFlash - Page:0x3f Size:0x800 -> Flash page at 0x801f800 erased (size: 0x800 EraseFlash - Page:0x40 Size:0x800 -> Flash page at 0x8020000 erased (size: 0x800EraseFlash - Page:0x41 Size:0x800 -> Flash page at 0x8020800 erased (size: 0x800EraseFlash - Page:0x42 Size:0x800 -> Flash page at 0x8021000 erased (size: 0x800 EraseFlash - Page:0x43 Size:0x800 -> Flash page at 0x8021800 erased (size: 0x800EraseFlash - Page:0x44 Size:0x800 -> Flash page at 0x8022000 erased (size: 0x800EraseFlash - Page:0x45 Size:0x800 -> Flash page at 0x8022800 erased (size: 0x800 EraseFlash - Page:0x46 Size:0x800 -> Flash page at 0x8023000 erased (size: 0x800EraseFlash - Page:0x47 Size:0x800 -> Flash page at 0x8023800 erased (size: 0x800EraseFlash - Page:0x48 Size:0x800 -> Flash page at 0x8024000 erased (size: 0x800 EraseFlash - Page:0x49 Size:0x800 -> Flash page at 0x8024800 erased (size: 0x800EraseFlash - Page:0x4a Size:0x800 -> Flash page at 0x8025000 erased (size: 0x800EraseFlash - Page:0x4b Size:0x800 -> Flash page at 0x8025800 erased (size: 0x800 EraseFlash - Page:0x4c Size:0x800 -> Flash page at 0x8026000 erased (size: 0x800EraseFlash - Page:0x4d Size:0x800 -> Flash page at 0x8026800 erased (size: 0x800EraseFlash - Page:0x4e Size:0x800 -> Flash page at 0x8027000 erased (size: 0x800 EraseFlash - Page:0x4f Size:0x800 -> Flash page at 0x8027800 erased (size: 0x800EraseFlash - Page:0x50 Size:0x800 -> Flash page at 0x8028000 erased (size: 0x800EraseFlash - Page:0x51 Size:0x800 -> Flash page at 0x8028800 erased (size: 0x800 EraseFlash - Page:0x52 Size:0x800 -> Flash page at 0x8029000 erased (size: 0x800EraseFlash - Page:0x53 Size:0x800 -> Flash page at 0x8029800 erased (size: 0x800EraseFlash - Page:0x54 Size:0x800 -> Flash page at 0x802a000 erased (size: 0x800 EraseFlash - Page:0x55 Size:0x800 -> Flash page at 0x802a800 erased (size: 0x800EraseFlash - Page:0x56 Size:0x800 -> Flash page at 0x802b000 erased (size: 0x800EraseFlash - Page:0x57 Size:0x800 -> Flash page at 0x802b800 erased (size: 0x800 EraseFlash - Page:0x58 Size:0x800 -> Flash page at 0x802c000 erased (size: 0x800EraseFlash - Page:0x59 Size:0x800 -> Flash page at 0x802c800 erased (size: 0x800EraseFlash - Page:0x5a Size:0x800 -> Flash page at 0x802d000 erased (size: 0x800 EraseFlash - Page:0x5b Size:0x800 -> Flash page at 0x802d800 erased (size: 0x800EraseFlash - Page:0x5c Size:0x800 -> Flash page at 0x802e000 erased (size: 0x800EraseFlash - Page:0x5d Size:0x800 -> Flash page at 0x802e800 erased (size: 0x800 EraseFlash - Page:0x5e Size:0x800 -> Flash page at 0x802f000 erased (size: 0x800EraseFlash - Page:0x5f Size:0x800 -> Flash page at 0x802f800 erased (size: 0x800EraseFlash - Page:0x60 Size:0x800 -> Flash page at 0x8030000 erased (size: 0x800 EraseFlash - Page:0x61 Size:0x800 -> Flash page at 0x8030800 erased (size: 0x800EraseFlash - Page:0x62 Size:0x800 -> Flash page at 0x8031000 erased (size: 0x800EraseFlash - Page:0x63 Size:0x800 -> Flash page at 0x8031800 erased (size: 0x800 EraseFlash - Page:0x64 Size:0x800 -> Flash page at 0x8032000 erased (size: 0x800EraseFlash - Page:0x65 Size:0x800 -> Flash page at 0x8032800 erased (size: 0x800EraseFlash - Page:0x66 Size:0x800 -> Flash page at 0x8033000 erased (size: 0x800 EraseFlash - Page:0x67 Size:0x800 -> Flash page at 0x8033800 erased (size: 0x800EraseFlash - Page:0x68 Size:0x800 -> Flash page at 0x8034000 erased (size: 0x800EraseFlash - Page:0x69 Size:0x800 -> Flash page at 0x8034800 erased (size: 0x800 EraseFlash - Page:0x6a Size:0x800 -> Flash page at 0x8035000 erased (size: 0x800EraseFlash - Page:0x6b Size:0x800 -> Flash page at 0x8035800 erased (size: 0x800EraseFlash - Page:0x6c Size:0x800 -> Flash page at 0x8036000 erased (size: 0x800 EraseFlash - Page:0x6d Size:0x800 -> Flash page at 0x8036800 erased (size: 0x800EraseFlash - Page:0x6e Size:0x800 -> Flash page at 0x8037000 erased (size: 0x800EraseFlash - Page:0x6f Size:0x800 -> Flash page at 0x8037800 erased (size: 0x800 EraseFlash - Page:0x70 Size:0x800 -> Flash page at 0x8038000 erased (size: 0x800EraseFlash - Page:0x71 Size:0x800 -> Flash page at 0x8038800 erased (size: 0x800EraseFlash - Page:0x72 Size:0x800 -> Flash page at 0x8039000 erased (size: 0x800 EraseFlash - Page:0x73 Size:0x800 -> Flash page at 0x8039800 erased (size: 0x800EraseFlash - Page:0x74 Size:0x800 -> Flash page at 0x803a000 erased (size: 0x800EraseFlash - Page:0x75 Size:0x800 -> Flash page at 0x803a800 erased (size: 0x800 EraseFlash - Page:0x76 Size:0x800 -> Flash page at 0x803b000 erased (size: 0x800EraseFlash - Page:0x77 Size:0x800 -> Flash page at 0x803b800 erased (size: 0x800EraseFlash - Page:0x78 Size:0x800 -> Flash page at 0x803c000 erased (size: 0x800 EraseFlash - Page:0x79 Size:0x800 -> Flash page at 0x803c800 erased (size: 0x800EraseFlash - Page:0x7a Size:0x800 -> Flash page at 0x803d000 erased (size: 0x800EraseFlash - Page:0x7b Size:0x800 -> Flash page at 0x803d800 erased (size: 0x800 EraseFlash - Page:0x7c Size:0x800 -> Flash page at 0x803e000 erased (size: 0x800EraseFlash - Page:0x7d Size:0x800 -> Flash page at 0x803e800 erased (size: 0x800EraseFlash - Page:0x7e Size:0x800 -> Flash page at 0x803f000 erased (size: 0x800 EraseFlash - Page:0x7f Size:0x800 -> Flash page at 0x803f800 erased (size: 0x800) 2024-09-02T10:30:29 INFO flash_loader.c: Starting Flash write for F2/F4/F7/L4 2024-09-02T10:30:29 INFO flash_loader.c: Successfully loaded flash loader in sram 2024-09-02T10:30:29 INFO flash_loader.c: Clear DFSR 2024-09-02T10:30:35 INFO common_flash.c: Starting verification of write complete 2024-09-02T10:30:37 INFO common_flash.c: Flash written and verified! jolly good!
That went well - no errors reported. Now let's try to read that flash into a file:
Reading data from the MCU
To be absolutely certain, read the data back into a new file:
lth@ncpws04:~/tmp$ st-flash --flash=256k read random2.bin 0x8000000 0x40000 st-flash 1.8.0 2024-09-02T10:31:51 INFO common.c: STM32L41x_L42x: 48 KiB SRAM, 128 KiB flash in at least 2 KiB pages. Forcing flash size: --flash=0x00040000 2024-09-02T10:31:51 INFO common.c: read from address 0x08000000 size 262144
No complaints!
Compare data
Finally we can verify that the data read from the MCU matches the data we wrote to the MCU:
lth@ncpws04:~/tmp$ md5sum random* 5f7ebd5c822e07408e6279445eb1444a random2.bin 5f7ebd5c822e07408e6279445eb1444a random.bin
They are identical, so it is absolutely confirmed that this particular STM32L432KB is in fact a STM32L432KC which identifies as a STM32L432KB.