You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,17 @@
8
8
9
9
This port gives you a py-board-like experience using the BlackPill created by WeAct Studio.
10
10
11
-
There are 2 major versions of the BlackPills, they differ only in terms of crystal speed. A total of 6 versions of Firmware are provided, 3 for the 8MHz crystal version and 3 for the regular 25MHz crystal version. They differ only in the SPI flash size (0MB, 8MB and 16MB). All of them can be found in the `firmware` folder and they come in both `.dfu` and `.hex` format. You can also define your own SPI flash size as described in the `How to build` section.
11
+
There are 2 major versions of the BlackPills, they differ only in terms of crystal speed. A total of 6 versions of Firmware are provided, 3 for the 8MHz crystal version and 3 for the regular 25MHz crystal version. They differ only in the SPI flash size (0MB, 8MB, and 16MB). All of them can be found in the `firmware` folder and they come in both `.dfu` and `.hex` format. You can also define your own SPI flash size as described in the `How to build` section.
12
12
13
-
The 8MHz version has the advantage to be more stable in terms of dfu-bootloader connectivity, as it tolerates a bigger margin of errors caused by ambient temperature.
13
+
The 8MHz version has the advantage of being more stable in terms of dfu-bootloader connectivity, as it tolerates a bigger margin of errors caused by ambient temperature.
14
14
15
-
A BlackPill with spi flash has roughtly 12KB more RAM available. This is due to smaller cache required for the filesystem.
15
+
A BlackPill with SPI flash has roughly 12KB more RAM available. This is due to the smaller cache required for the filesystem.
16
16
17
17
The pins/features-configurations are final, changes will only be done when forced by Micropython updates.
18
18
19
19
## Pins definition
20
20
21
-
Things that in `()` are available in the pre-built firmware but they might interfere with other interfaces, so be caucious. These are only my choices, you may use any other pins, which were stated in the comment as `Valid`. For the 8MB version, the `SPI1` bus is used for SPI flash.
21
+
Things that in `()` are available in the pre-built firmware but they might interfere with other interfaces, so be cautious. These are only my choices, you may use any other pins, which were stated in the comment as `Valid`. For the 8MB version, the `SPI1` bus is used for SPI flash.
22
22
23
23
| USART | USART1 | USART2 |(USART6)|
24
24
| ------ | ------ | ------ | ------ |
@@ -43,9 +43,9 @@ Things that in `()` are available in the pre-built firmware but they might inter
43
43
44
44
## Lfs2 Support
45
45
46
-
`Lfs2` is a little fail-safe filesystem designed for microcontrollers to support dynamic wear leveling, which is quiet useful when you are using the internal flash to log data. Since `FAT` does not have a wear leveling implementation, you will be wearing off your 10K cycles of the leading sectors quiet fast.
46
+
`Lfs2` is a little fail-safe filesystem designed for microcontrollers to support dynamic wear leveling, which is quite useful when you are using the internal flash to log data. Since `FAT` does not have a wear leveling implementation, you will be wearing off your 10K cycles of the leading sectors quite fast.
47
47
48
-
To format the filesystem to `Lfs2`, you can simply excute the following code:
48
+
To format the filesystem to `Lfs2`, you can simply execute the following code:
To avoid the annoying Windows formatation message, add the following to `boot.py`:
58
+
To avoid the annoying Windows formation message, add the following to `boot.py`:
59
59
60
60
```python
61
61
import pyb
@@ -88,12 +88,12 @@ os.chdir('/flash')
88
88
89
89
## Storage modification
90
90
91
-
### Flash layout (Only useful for the internal flash version)
92
-
If changing the flash layout is at your interest, you can modify the following section in the `stm32f411.ld` file. However, there is this one rule: **never assign a sector of size more than your `FS_CACHE` size for `Flash_FS`.** Otherwise corruption will occur. This is caused by the fact that F4 series has very big sectors and every sector has to be erased before writting data to it. In case the `FS_CACHE` is not big enough to cache the biggest sector, when you are trying to write to the reset part of the sector, the sector itself will be erased but only part of its content was cached, as a result: you lost your uncached data and hence a corruption.
91
+
### Flash layout (Only useful for the internal Flash version)
92
+
If changing the flash layout is of interest, you can modify the following section in the `stm32f411.ld` file. However, there is this one rule: **Never assign a sector of size more than your `FS_CACHE` size for `Flash_FS`.** Otherwise corruption will occur. This is caused by the fact that F4 series has very big sectors and every sector has to be erased before writing data to it. In case the `FS_CACHE` is not big enough to cache the biggest sector, when you are trying to write to the reset part of the sector, the sector itself will be erased but only part of its content was cached, as a result: you lost your uncached data and hence corruption.
93
93
94
94
The default one is almost optimized for the RAM and flash ratio. The following are 2 suggestions/examples of working modifications:
95
95
96
-
Example 1: Get a tiny little more flash (16K) at cost of the same amount of RAM. You are using sector 1, 2, 3 (each has 16K) and a part of sector 4 (has 64K total, but only 32K of it is used) for your filesystem. The increased size can be anything between 0K to 32K (not including 0K and 32K). And you have to caculate the address accordingly.
96
+
Example 1: Get a tiny little more flash (16K) at a cost of the same amount of RAM. You are using sectors 1, 2, 3 (each has 16K) and a part of sector 4 (which has 64K total, but only 32K of it is used) for your filesystem. The increased size can be anything between 0K to 32K (not including 0K and 32K). And you have to calculate the address accordingly.
97
97
```ld
98
98
MEMORY
99
99
{
@@ -108,7 +108,7 @@ MEMORY
108
108
}
109
109
```
110
110
111
-
Example 2: Maximizing flash size. You are using sector 1, 2, 3 (each has 16K) and 4 (has 64K total) for your filesystem. This is the maximum amount of flash you can get at the cost of reducing maximum firmware size by 128K and 64K of ram. This is the max flash size, because for the next step you need 128K RAM, and you only have 128K RAM on the stm32f411ce. Also, the maximum firmware size is reduced by 128K because when you earse sector 5, the part of the firmware stored on it will also be removed, causing the system to fail.
111
+
Example 2: Maximizing flash size. You are using sectors 1, 2, 3 (each has 16K), and 4 (has 64K total) for your filesystem. This is the maximum amount of flash you can get at the cost of reducing the maximum firmware size by 128K and 64K of RAM. This is the max flash size, because for the next step, you need 128K RAM, and you only have 128K RAM on the stm32f411ce. Also, the maximum firmware size is reduced by 128K because when you erase sector 5, the part of the firmware stored on it will also be removed, causing the system to fail.
Note that you have to wipe the whole flash during flashing the firmware for the modifications to take effect.
125
+
Note that you have to wipe the whole flash while flashing the firmware for the modifications to take effect.
126
126
127
127
### Using external SPI-Flash
128
-
You can either solder a external SPI-Flash directly on the board or connect the first SPI interface (`A4, A5, A6, A7`) to the external SPI-Flash module. Both way you can use a e.g. `8MB` version of firmware directly. Assuming your external SPI-Flash has `8MB` of storage.
128
+
You can either solder an external SPI-Flash directly on the board or connect the first SPI interface (`A4, A5, A6, A7`) to the external SPI-Flash module. Both ways you can use an e.g. `8MB` version of firmware directly. Assuming your external SPI-Flash has `8MB` of storage.
129
129
If the SPI-Flash is not wired/soldered correctly, the firmware still boots but you do not have access to the flash storage.
130
130
131
131
## How to build
132
132
### Vanilla
133
-
First of all, you have to have a linux enviroment and get the compilers. On ubuntu 23.10 and above or debian 12 and above, it's called `gcc-arm-none-eabi`. On arch linux, it's called `arm-none-eabi-gcc`.
133
+
First of all, you have to have a Linux environment and get the compilers. On Ubuntu 23.10 and above or Debian 12 and above, it's called `gcc-arm-none-eabi`. On arch Linux, it's called `arm-none-eabi-gcc`.
134
134
```shell
135
135
sudo apt-get -y install gcc-arm-none-eabi build-essential # On Ubuntu or Debian
136
136
sudo pacman -S arm-none-eabi-gcc base-devel # On Arch Linux
@@ -147,18 +147,18 @@ Copy `WEACTF411CE` to the `micropython/ports/stm32/boards` folder. To build the
147
147
```shell
148
148
make -j LTO=1 BOARD=WEACTF411CE # With recent update, the LTO=1 can be omitted.
149
149
```
150
-
There are 4 possible variants for the both of the base firmware: `DP`, `THREAD`, `DP_THREAD` and `NETWORK`. The `NETWORK` variant requires other components that has to be purchased separately. And there are 2 variables that controls both the crystal frequency and the spi flash size, namely `CRYSTAL_FREQ` and `SPI_FLASH_SIZE`.
150
+
There are 4 possible variants for both of the base firmware: `DP`, `THREAD`, `DP_THREAD`, and `NETWORK`. The `NETWORK` variant requires other components that have to be purchased separately. And there are 2 variables that controls both the crystal frequency and the spi flash size, namely `CRYSTAL_FREQ` and `SPI_FLASH_SIZE`.
151
151
```shell
152
152
# replace VARIANTS with DP, THREAD or DP_THREAD
153
153
# DP: Use double precision for floats, each float number takes twice as much memory.
154
-
# THREAD: Enables Thread. This is an experiemental feature
154
+
# THREAD: Enables Thread. This is an experimental feature
155
155
# DP_THREAD: Enables Thread and use double precision.
156
156
# CRYSTAL_FREQ: You can assign any value to this, if this keyword is defined,
157
157
# the 8MHz crystal firmware will be built. You can not make it
158
158
# take the given value, because plli2svalues.py reads the .h files
159
159
# directly. (More of a reminder for myself.)
160
160
# SPI_FLASH_SIZE: You can set the SPI_FLASH_SIZE here to build your firmware accordingly.
161
-
# LTO: Wether to optimize for firmware size at the cost of some performance.
161
+
# LTO: Whether to optimize for firmware size at the cost of some performance.
162
162
make -j LTO=1 BOARD=WEACTF411CE BOARD_VARIANT=VARIANTS CRYSTAL_FREQ=ANY_VALUE SPI_FLASH_SIZE=SIZE_IN_MB # With recent update, the LTO=1 can be omitted.
In addtion to that, if you were using `STM32CubeProgrammer` with a GUI, everything should be very straight foward. And this is the most easy way to flash your device imo. There are 3 options available: `ST-Link, UART and USB` each corresponding to using a `st-link`, using a `uart-bridge` and using the built-in `dfu`.
224
+
In addition to that, if you were using `STM32CubeProgrammer` with a GUI, everything should be very straightforward. This is the easiest way to flash your device imo. There are 3 options available: `ST-Link, UART, and USB` each corresponding to using a `st-link`, using a `uart-bridge`, and using the built-in `dfu`.
225
225
226
226
### Side note
227
227
228
-
If you were unlucky and got a clone/pirated board, you might find it difficult to flash the firmware using `dfu`. (`st-link` and `uart-bridge` works just fine.) You can try to connect `A10` to the `GND` pin before you booting the board into dfu. This might solve your issue.
228
+
If you were unlucky and got a clone/pirated board, you might find it difficult to flash the firmware using `dfu`. (`st-link` and `uart-bridge` works just fine.) You can try to connect `A10` to the `GND` pin before you boot the board into dfu. This might solve your issue.
229
229
230
230
If you know for a fact, that your boards are official, try to heat the board up with a hairdryer and try again. This should solve your problem.
0 commit comments