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
> The first `load` writes the Wifi Firmware into one of the partitions set aside for that. The second `load -x` loads the main application code into one of the main partitions, then resets the chip to start execution
51
51
52
+
The device should now have the following firmware layout.
53
+
54
+
| Partition | Purpose |
55
+
| ----------|-------- |
56
+
| 0 | Partition A for the application firmware |
57
+
| 1 | Partition B for the application firmware |
58
+
| 2 | Partition A for the wifi firmware |
59
+
| 3 | Partition B for the wifi firmware |
60
+
52
61
## Operation
53
62
54
63
This example will send debug output text on the default UART. On startup it displays the current boot partition (from where the firmware is running) and IP address of the Pico 2 W
This will update the Pico 2 W at `192.168.0.103` with the specified image.
66
75
67
76
```
68
-
Code Target partition is fc6d21b6 fc061003
69
-
Start 1b6000, End 36a000, Size 1b4000
70
-
Done - rebooting for a flash update boot 0
71
-
Chosen CYW43 firmware in partition 2
72
77
Boot partition was 1
73
-
Someone updated into me
74
-
Flash update base was 101b6000
75
-
Update info 1
76
-
Update info now 4
77
-
Starting server at 192.168.0.103 on port 4242
78
78
```
79
79
80
80
The update is downloaded into the main partition that's not currently in use, before rebooting the Pico 2 W to run the new version of the software. This choice of software is made by the RP2350 bootrom based on the version number of the software
81
+
82
+
## Try before you Buy
83
+
84
+
The `picow_ota_update.uf2` application is marked with the "Try Before You Buy" (TBYB) attribute by specifying `PICO_CRT0_IMAGE_TYPE_TBYB=1` in its compile definitions.
85
+
86
+
This means that if a newly downloaded image partition is not explicitly "bought" by calling the `rom_explicit_buy` function within 16.7 seconds, the device will reboot and revert to the previously used partition. This gives some protection against a bad OTA update being applied. See section 5.1.17 of [RP2350 datasheet](https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf) for more details about Try Before You Buy.
87
+
88
+
### Wifi Firmware
89
+
90
+
This example also demonstrates how TBYB can be applied to other partitions - in this case the Wifi firmware. In debug builds you should see debug output which shows the partition that's currently being used for the wifi firmware.
91
+
92
+
The example uses the `pico_use_wifi_firmware_partition` keyword to make the Wifi firmware appear in its own partition rather than embedded in the application as is usually the case.
93
+
94
+
```
95
+
Chosen CYW43 firmware in partition 2
96
+
```
97
+
98
+
Two UF2 files are generated for the wifi firmware, `picow_ota_update_wifi_firmware.uf2` and `picow_ota_update_wifi_firmware_tbyb.uf2`. These images are the same except only the latter image has the TBYB attribute set.
99
+
100
+
You can update the current Wifi partition with these UF2 files using [python_ota_update.py](python_ota_update.py).
101
+
102
+
If you use `picow_ota_update_wifi_firmware_tbyb.uf2` for the update then if something goes wrong before the partition is explicitly "bought" by calling the `rom_explicit_buy` function, then the device will switch back to the previous working Wifi firmware partition after a reboot. This does not happen if you use `picow_ota_update_wifi_firmware.uf2` for the update. In this way the TBYB attribute gives you some protection against an OTA update applying bad Wifi firmware.
0 commit comments