Skip to content

Commit d82809b

Browse files
committed
rp2: Allow pico and pico2 to use cyw43.
Signed-off-by: Peter Harper <[email protected]>
1 parent 22a7057 commit d82809b

File tree

8 files changed

+130
-0
lines changed

8 files changed

+130
-0
lines changed

ports/rp2/boards/RPI_PICO/manifest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is only used if cyw43 is enabled
2+
include("$(PORT_DIR)/boards/manifest.py")
3+
4+
require("bundle-networking")
5+
6+
# Bluetooth
7+
require("aioble")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# cmake file for Raspberry Pi Pico
22
set(PICO_BOARD "pico")
33
set(PICO_PLATFORM "rp2040")
4+
5+
if (PICO_CYW43_SUPPORTED)
6+
include(enable_cyw43.cmake)
7+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
8+
set(PICO_PINS_CSV_NAME pins_cyw43.csv)
9+
endif()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
11
// Board and hardware specific configuration
22
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
3+
4+
#if MICROPY_PY_NETWORK_CYW43
5+
#include "enable_cyw43.h"
6+
7+
// Enable the ability to pass cyw43 pins into WiFi, Bluetooth and Pin constructors
8+
#define CYW43_PIN_WL_DYNAMIC 1
9+
#define CYW43_PIO_CLOCK_DIV_DYNAMIC 1
10+
11+
// Set the default pins to gpios 2-5
12+
#define CYW43_DEFAULT_PIN_WL_REG_ON 2
13+
#define CYW43_DEFAULT_PIN_WL_CS 3
14+
#define CYW43_DEFAULT_PIN_WL_DATA_OUT 4
15+
#define CYW43_DEFAULT_PIN_WL_DATA_IN 4
16+
#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 4
17+
#define CYW43_DEFAULT_PIN_WL_CLOCK 5
18+
19+
// Default pio clock
20+
#define CYW43_PIO_CLOCK_DIV_INT 3
21+
22+
// we have to reduce the flash storage if cyw43 is enabled or else the firmware gets overwritten
23+
#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024)
24+
#else
325
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)
26+
#endif
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
GP0,GPIO0
2+
GP1,GPIO1
3+
GP2,GPIO2
4+
GP3,GPIO3
5+
GP4,GPIO4
6+
GP5,GPIO5
7+
GP6,GPIO6
8+
GP7,GPIO7
9+
GP8,GPIO8
10+
GP9,GPIO9
11+
GP10,GPIO10
12+
GP11,GPIO11
13+
GP12,GPIO12
14+
GP13,GPIO13
15+
GP14,GPIO14
16+
GP15,GPIO15
17+
GP16,GPIO16
18+
GP17,GPIO17
19+
GP18,GPIO18
20+
GP19,GPIO19
21+
GP20,GPIO20
22+
GP21,GPIO21
23+
GP22,GPIO22
24+
GP25,GPIO25
25+
GP26,GPIO26
26+
GP27,GPIO27
27+
GP28,GPIO28
28+
LED,GPIO25
29+
WL_GPIO0,EXT_GPIO0
30+
WL_GPIO1,EXT_GPIO1
31+
WL_GPIO2,EXT_GPIO2
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is only used if cyw43 is enabled
2+
include("$(PORT_DIR)/boards/manifest.py")
3+
4+
require("bundle-networking")
5+
6+
# Bluetooth
7+
require("aioble")

ports/rp2/boards/RPI_PICO2/mpconfigboard.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ set(PICO_BOARD "pico2")
33

44
# To change the gpio count for QFN-80
55
# set(PICO_NUM_GPIOS 48)
6+
7+
if (PICO_CYW43_SUPPORTED)
8+
include(enable_cyw43.cmake)
9+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
10+
set(PICO_PINS_CSV_NAME pins_cyw43.csv)
11+
endif()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
// Board and hardware specific configuration
22
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico2"
33
#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - 1024 * 1024)
4+
5+
#if MICROPY_PY_NETWORK_CYW43
6+
#include "enable_cyw43.h"
7+
8+
// Enable the ability to pass cyw43 pins into WiFi, Bluetooth and Pin constructors
9+
#define CYW43_PIN_WL_DYNAMIC 1
10+
#define CYW43_PIO_CLOCK_DIV_DYNAMIC 1
11+
12+
// Set the default pins to gpios 2-5
13+
#define CYW43_DEFAULT_PIN_WL_REG_ON 2
14+
#define CYW43_DEFAULT_PIN_WL_CS 3
15+
#define CYW43_DEFAULT_PIN_WL_DATA_OUT 4
16+
#define CYW43_DEFAULT_PIN_WL_DATA_IN 4
17+
#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 4
18+
#define CYW43_DEFAULT_PIN_WL_CLOCK 5
19+
20+
// Default pio clock
21+
#define CYW43_PIO_CLOCK_DIV_INT 3
22+
#endif
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
GP0,GPIO0
2+
GP1,GPIO1
3+
GP2,GPIO2
4+
GP3,GPIO3
5+
GP4,GPIO4
6+
GP5,GPIO5
7+
GP6,GPIO6
8+
GP7,GPIO7
9+
GP8,GPIO8
10+
GP9,GPIO9
11+
GP10,GPIO10
12+
GP11,GPIO11
13+
GP12,GPIO12
14+
GP13,GPIO13
15+
GP14,GPIO14
16+
GP15,GPIO15
17+
GP16,GPIO16
18+
GP17,GPIO17
19+
GP18,GPIO18
20+
GP19,GPIO19
21+
GP20,GPIO20
22+
GP21,GPIO21
23+
GP22,GPIO22
24+
GP25,GPIO25
25+
GP26,GPIO26
26+
GP27,GPIO27
27+
GP28,GPIO28
28+
LED,GPIO25
29+
WL_GPIO0,EXT_GPIO0
30+
WL_GPIO1,EXT_GPIO1
31+
WL_GPIO2,EXT_GPIO2

0 commit comments

Comments
 (0)