Skip to content

Commit 2d3292a

Browse files
authored
Add support for Adafruit ItsyBitsy RP2040 and Feather RP2040 Scorpio (#49)
* Add support for Adafruit ItsyBitsy RP2040 * Change SPI MOSI->MISO is GPIO28 (A2) for Adafruit_ItsyBitsy_RP2040 * Add support for Adafruit Feather RP2040 Scorpio * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update push-master-pico.yml * Update push-master-pico.yml * Update push-master.yml * Update push-master.yml
1 parent be49554 commit 2d3292a

File tree

4 files changed

+157
-53
lines changed

4 files changed

+157
-53
lines changed

.github/workflows/push-master-pico.yml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run:
1515
working-directory: ./rp2040
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
with:
1919
submodules: recursive
2020

@@ -30,45 +30,83 @@ jobs:
3030
cd build
3131
cmake ..
3232
cmake --build . --config Release
33+
zip -j ../HyperSerialPico/firmware/hyperspi_pico_rp2040.zip ../HyperSerialPico/firmware/*.uf2
3334
34-
- uses: actions/upload-artifact@v3
35+
- uses: actions/upload-artifact@v4
3536
name: Upload artifacts (commit)
3637
if: (startsWith(github.event.ref, 'refs/tags') != true)
3738
with:
39+
name: commit-artifact-pico
3840
path: |
39-
rp2040/HyperSerialPico/firmware/*.uf2
41+
rp2040/HyperSerialPico/firmware/*.zip
4042
41-
- uses: actions/upload-artifact@v3
43+
- uses: actions/upload-artifact@v4
4244
name: Upload artifacts (release)
4345
if: startsWith(github.ref, 'refs/tags/')
4446
with:
45-
name: firmware-release
47+
name: release-artifact-pico
4648
path: |
47-
rp2040/HyperSerialPico/firmware/*.uf2
49+
rp2040/HyperSerialPico/firmware/*.zip
4850
4951
- name: Build packages for Adafruit Feather RP2040 Scorpio
5052
shell: bash
5153
run: |
5254
cd build
5355
rm *.*
5456
rm ../HyperSerialPico/firmware/*
55-
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../HyperSerialPico/firmware/Firmwares_for_Adafruit_Feather_RP2040_Scorpio.txt
56-
cmake -DOVERRIDE_DATA_PIN=16 -DCMAKE_BUILD_TYPE=Release ..
57+
echo "Neopixel is using GPIO16(OUTPUT_DATA_PIN) on output 0." > ../HyperSerialPico/firmware/Firmware_for_Adafruit_Feather_RP2040_Scorpio.txt
58+
echo "SPI MOSI->MISO is GPIO28 (A2)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_Feather_RP2040_Scorpio.txt
59+
echo "SPI SCK is GPIO26 (A0)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_Feather_RP2040_Scorpio.txt
60+
echo "SPI CHIP_SELECT is GPIO29 (A3)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_Feather_RP2040_Scorpio.txt
61+
echo "SPI interface is spi1" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_Feather_RP2040_Scorpio.txt
62+
cmake -DOVERRIDE_DATA_PIN=16 -DOVERRIDE_SPI_DATA_PIN=28 -DOVERRIDE_SPI_CLOCK_PIN=26 -DOVERRIDE_SPI_CHIP_SELECT=29 -DOVERRIDE_SPI_INTERFACE=spi1 -DCMAKE_BUILD_TYPE=Release ..
5763
cmake --build .
5864
zip -j ../HyperSerialPico/firmware/Adafruit_Feather_RP2040_Scorpio.zip ../HyperSerialPico/firmware/*
5965
60-
- uses: actions/upload-artifact@v3
66+
- uses: actions/upload-artifact@v4
6167
name: Upload artifacts (Adafruit_Feather)
6268
if: (startsWith(github.event.ref, 'refs/tags') != true)
6369
with:
70+
name: commit-artifact-Adafruit_Feather
6471
path: |
6572
rp2040/HyperSerialPico/firmware/*.zip
6673
67-
- uses: actions/upload-artifact@v3
74+
- uses: actions/upload-artifact@v4
6875
name: Upload artifacts (release for Adafruit_Feather)
6976
if: startsWith(github.ref, 'refs/tags/')
7077
with:
71-
name: firmware-release
78+
name: release-artifact-Adafruit_Feather
79+
path: |
80+
rp2040/HyperSerialPico/firmware/*.zip
81+
82+
- name: Build packages for Adafruit ItsyBitsy RP2040
83+
shell: bash
84+
run: |
85+
cd build
86+
rm *.*
87+
rm ../HyperSerialPico/firmware/*
88+
echo "Neopixel is using GPIO14(OUTPUT_DATA_PIN) on output D5." > ../HyperSerialPico/firmware/Firmware_for_Adafruit_ItsyBitsy_RP2040.txt
89+
echo "SPI MOSI->MISO is GPIO28 (A2)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_ItsyBitsy_RP2040.txt
90+
echo "SPI SCK is GPIO26 (A0)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_ItsyBitsy_RP2040.txt
91+
echo "SPI CHIP_SELECT is GPIO29 (A3)" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_ItsyBitsy_RP2040.txt
92+
echo "SPI interface is spi1" >> ../HyperSerialPico/firmware/Firmware_for_Adafruit_ItsyBitsy_RP2040.txt
93+
cmake -DOVERRIDE_DATA_PIN=14 -DOVERRIDE_SPI_DATA_PIN=28 -DOVERRIDE_SPI_CLOCK_PIN=26 -DOVERRIDE_SPI_CHIP_SELECT=29 -DOVERRIDE_SPI_INTERFACE=spi1 -DCMAKE_BUILD_TYPE=Release ..
94+
cmake --build .
95+
zip -j ../HyperSerialPico/firmware/Adafruit_ItsyBitsy_RP2040.zip ../HyperSerialPico/firmware/*
96+
97+
- uses: actions/upload-artifact@v4
98+
name: Upload artifacts (Adafruit_ItsyBitsy)
99+
if: (startsWith(github.event.ref, 'refs/tags') != true)
100+
with:
101+
name: commit-artifact-Adafruit_ItsyBitsy
102+
path: |
103+
rp2040/HyperSerialPico/firmware/*.zip
104+
105+
- uses: actions/upload-artifact@v4
106+
name: Upload artifacts (release for Adafruit_ItsyBitsy)
107+
if: startsWith(github.ref, 'refs/tags/')
108+
with:
109+
name: release-artifact-Adafruit_ItsyBitsy
72110
path: |
73111
rp2040/HyperSerialPico/firmware/*.zip
74112
@@ -95,20 +133,21 @@ jobs:
95133
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
96134
run: echo "preRelease=true" >> $GITHUB_ENV
97135

98-
- uses: actions/download-artifact@v3
136+
- name: Download artifacts
137+
uses: actions/download-artifact@v4
99138
with:
100-
name: firmware-release
139+
path: artifacts
140+
pattern: release-artifact-*
141+
merge-multiple: true
101142

102143
# create draft release and upload artifacts
103144
- name: Create draft release
104145
uses: softprops/action-gh-release@v1
105146
with:
106147
name: HyperSPI ${{ env.VERSION }}
107148
tag_name: ${{ env.TAG }}
108-
files: |
109-
*.uf2
110-
*.zip
149+
files: "artifacts/**"
111150
draft: true
112151
prerelease: ${{ env.preRelease }}
113152
env:
114-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push-master.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
restore-keys: |
2121
${{ runner.os }}-pip-
2222
- name: Cache PlatformIO
23-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2424
with:
2525
path: ~/.platformio
2626
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
@@ -38,15 +38,16 @@ jobs:
3838
zip -j .pio/build/recovery_firmware.zip .pio/build/*.factory.bin
3939
rm -f .pio/build/*.factory.bin
4040
41-
- uses: actions/upload-artifact@v3
41+
- uses: actions/upload-artifact@v4
4242
name: Upload artifacts (commit)
4343
if: (startsWith(github.event.ref, 'refs/tags') != true)
4444
with:
45+
name: firmware-archive
4546
path: |
4647
.pio/build/*.bin
4748
.pio/build/recovery_firmware.zip
4849
49-
- uses: actions/upload-artifact@v3
50+
- uses: actions/upload-artifact@v4
5051
name: Upload artifacts (release)
5152
if: startsWith(github.ref, 'refs/tags/')
5253
with:
@@ -76,7 +77,7 @@ jobs:
7677
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta')
7778
run: echo "preRelease=true" >> $GITHUB_ENV
7879

79-
- uses: actions/download-artifact@v3
80+
- uses: actions/download-artifact@v4
8081
with:
8182
name: firmware-release
8283

README.md

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Raspberry Pi acts as a master, ESP8266/ESP32/ESP32-S2/rp2040(Raspberry Pi Pico)
1616
- SPI doesn't have any data integration check. But AWA protocol does have one
1717
- you don't need to have 2Mb capable serial port on your ESP board
1818
- SPI transmission is much lighter than serial communication
19-
- There is a hardware limitation for the Rpi current design...even if you connect your grabber using USB2.0 mode, working serial port driver (used by Adalight) results in quite a large overall USB transfer. So we can replace Adalight with a pure SPI data transfer as an alternative
19+
- There is a hardware limitation for the Rpi current design...even if you connect your grabber using USB2.0 mode, working serial port driver (used by Adalight) results in quite a large drop in overall USB transfer. So we can replace Adalight with a pure SPI data transfer as an alternative
2020
- I needed it and I was able to implemented it 😉
2121

2222
# Hardware connection
@@ -33,7 +33,11 @@ As you can also notice, the pinout of the SPI0 interface is identical for the en
3333
</tr>
3434
<tr>
3535
<td colspan="2"><img src="https://github.com/awawa-dev/HyperSPI/assets/69086569/7f24f87e-f7e0-43f3-a568-39d0f6beced1"/></td>
36-
</tr>
36+
</tr>
37+
<tr>
38+
<td><img src="https://github.com/awawa-dev/HyperSPI/assets/69086569/170f5718-df88-4ef2-9ed8-7d92d913aeec"/></td>
39+
<td><img src="https://github.com/awawa-dev/HyperSPI/assets/69086569/9235c689-062e-4c62-b632-8c506b0e2e97"/></td>
40+
</tr>
3741
<tr>
3842
<td colspan="2"><p align="center">or if you prefer ESP32/ESP32-S2/Esp8266</p></td>
3943
</tr>
@@ -44,11 +48,15 @@ As you can also notice, the pinout of the SPI0 interface is identical for the en
4448
<tr>
4549
<td><img src="https://user-images.githubusercontent.com/69086569/216763154-ca4aa8fa-5855-43c1-86c2-d401010de675.png"/></td>
4650
<td><img src="https://user-images.githubusercontent.com/69086569/231207350-a670bfea-a96d-4d21-9e8f-f2ca027105da.png"/></td>
47-
</tr>
51+
</tr>
4852
</table>
4953

5054
# Example of supported boards
5155

56+
<p align="center">
57+
<b>Adafruit RP2040 Scorpio and ItsyBitsy with built-in level shifter (recommended!)</b><br/>
58+
<img src="https://github.com/awawa-dev/HyperSPI/assets/69086569/c7ef2768-357e-47ca-aa1c-543769eeb360" width="250" /><img src="https://github.com/awawa-dev/HyperSPI/assets/69086569/3e55948d-fd3d-44cb-908c-9aad8ce2715d" width="250" />
59+
</p>
5260

5361
<p align="center">
5462
<b>Esp8266 Wemos D1 mini (CH340) and Wemos D1 mini pro (CP2104)</b><br/>
@@ -60,15 +68,15 @@ As you can also notice, the pinout of the SPI0 interface is identical for the en
6068
<img src="https://user-images.githubusercontent.com/69086569/207587620-1c4c53c8-426c-486e-a6d9-d429fd1b050d.png" width="250"/><img src="https://user-images.githubusercontent.com/69086569/207587635-b7816329-0e29-47ee-a75a-bc6c41cdc51f.png" width="250"/>
6169
</p>
6270

63-
## Default pinout (can be changed for esp32 and esp32-s2)
71+
## Default pinout (can be changed for esp32, esp32-s2 and rp2040 Pico)
6472

65-
| PINOUT | ESP8266 | ESP32 | ESP32-S2 lolin mini| Pico (rp2040)
66-
|-------------|-----------|-----------|-----------|-----------|
67-
| Clock (SCK) | GPIO 14 | GPIO 18 | GPIO 7 | GPIO 2 |
68-
| Data (MOSI) | GPIO 13 | GPIO 23 | GPIO 11 | GPIO 4 |
69-
| SPI Chip Select(e.g. CE0) | not used | GPIO 5 | GPIO 12 | GPIO 5 |
70-
| GROUND | mandatory | mandatory | mandatory | mandatory |
71-
| LED output | GPIO 2 | GPIO 2 | GPIO 2 | GPIO 14 |
73+
| PINOUT | ESP8266 | ESP32 | ESP32-S2 | Pico (rp2040) | Adafruit rp2040<br/>Scorpio / ItsyBitsy
74+
|-------------|-----------|-----------|-----------|-----------|-----------|
75+
| Clock (SCK) | GPIO 14 | GPIO 18 | GPIO 7 | GPIO 2 | GPIO 26 (A0) |
76+
| Data (MOSI) | GPIO 13 | GPIO 23 | GPIO 11 | GPIO 4 | GPIO 28 (A2) |
77+
| SPI Chip Select(e.g. CE0) | not used | GPIO 5 | GPIO 12 | GPIO 5 | GPIO 29 (A3) |
78+
| GROUND | mandatory | mandatory | mandatory | mandatory | mandatory |
79+
| LED output | GPIO 2 | GPIO 2 | GPIO 2 | GPIO 14 | GPIO16 / GPIO14 |
7280

7381
> [!CAUTION]
7482
> The ground connection between both GPIOs is as important as the other SPI data connections. The ground cable should be of a similar length as them and run directly next to them.
@@ -101,12 +109,25 @@ Or use `esptool.py` e.g.
101109
For **RGBW LED strip** like RGBW SK6812 NEUTRAL white choose: *hyperspi_..._SK6812_RGBW_NEUTRAL.bin*
102110
For **RGBW LED strip** like RGBW SK6812 COLD white choose: *hyperspi_..._SK6812_RGBW_COLD.bin*
103111
For **RGB LED strip** like WS8212b or RGB SK6812 variant choose: *hyperspi_..._WS281x_RGB.bin*
112+
113+
## Flashing Pico boards
114+
115+
It's very easy and you don't need any special flasher.
116+
117+
Use firmware from the `hyperspi_pico_rp2040.zip` archive. Adafruit boards have their own custom firmware package inside the archive: `Adafruit_ItsyBitsy_RP2040.zip` and `Adafruit_Feather_RP2040_Scorpio.zip`
118+
119+
Put your Pico board into DFU mode:
120+
* If your Pico board has only one button (`boot`) then press & hold it and connect the board to the USB port. Then you can release the button.
121+
* If your Pico board has two buttons, connect it to the USB port. Then press & hold `boot` and `reset` buttons, then release `reset` and next release `boot` button.
122+
123+
In the system file explorer you should find new drive (e.g. called `RPI-RP2` drive) exposed by the Pico board. Drag & drop (or copy) the selected firmware to this drive.
124+
The Pico will reset automaticly after the upload and after few seconds it will be ready to use.
104125

105126
# Software configuration (HyperHDR v17 and above)
106127

107128
**In HyperHDR `Image Processing→Smoothing→Update frequency` you should do not exceed the maximum capacity of the device. Read more here: [testing performance](https://github.com/awawa-dev/HyperSPI#performance-output)**
108129

109-
Select esp8266 protocol for ESP proprietary SPI protocol, esp32 for ESP32 boards or 'standard' for other devices.
130+
Select `esp8266` protocol for ESP proprietary SPI protocol, `esp32` for ESP32 boards, `rp2040 (Pico)` for Pico boards or `standard` for other devices.
110131
Make sure you set "Refresh time" to zero, "Baudrate" should be set to high but realistic value like ```25 000 000```.
111132
Enabling "White channel calibration" is optional, if you want to fine tune the white channel balance of your sk6812 RGBW LED strip.
112133

@@ -116,38 +137,44 @@ Enabling "White channel calibration" is optional, if you want to fine tune the w
116137

117138
## ESP32 & ESP32-S2 parallel multi-segment mode
118139

119-
| LED strip / Device | ESP32 MH-ET LIVE mini<br/>HyperSPI v9 | ESP32-S2 Lolin mini<br/>HyperSPI v9 |
140+
| sk6812 LED strip / Device | ESP32 MH-ET LIVE mini<br/>HyperSPI v9 | ESP32-S2 Lolin mini<br/>HyperSPI v9 |
120141
|-----------------------------------------------------------------------------------------|-----------------------|----------------------|
121-
| 300LEDs sk6812<br>Refresh rate/continues output=100Hz<br>SECOND_SEGMENT_START_INDEX=150 | 100 | 100 |
122-
| 600LEDs sk6812<br>Refresh rate/continues output=83Hz<br>SECOND_SEGMENT_START_INDEX=300 | 83 | 83 |
123-
| 900LEDs sk6812<br>Refresh rate/continues output=55Hz <br>SECOND_SEGMENT_START_INDEX=450 | 54-55 | 55 |
142+
| 300 RGBW LEDs<br>Refresh rate/continues output=100Hz<br>SECOND_SEGMENT_START_INDEX=150 | 100 | 100 |
143+
| 600 RGBW LEDs<br>Refresh rate/continues output=83Hz<br>SECOND_SEGMENT_START_INDEX=300 | 83 | 83 |
144+
| 900 RGBW LEDs<br>Refresh rate/continues output=55Hz <br>SECOND_SEGMENT_START_INDEX=450 | 54-55 | 55 |
124145

125-
## ESP32
146+
## SP8266 / ESP32
126147

127-
| LED strip / Device | ESP32 MH ET Live<br/>HyperSPI v9 | ESP32-S2 Lolin mini<br/>HyperSPI v9 |
128-
|------------------------------------------------|-----------------|--------------------|
129-
| 300LEDs RGBW<br>Refresh rate/continues output=83Hz | 83 | 83 |
130-
| 600LEDs RGBW<br>Refresh rate/continues output=43Hz | 42-43 | 42 |
131-
| 900LEDs RGBW<br>Refresh rate/continues output=28Hz | 28 | 28 |
148+
| sk6812 LED strip / Device | ESP32 MH ET Live<br/>HyperSPI v9 | ESP32-S2 Lolin mini<br/>HyperSPI v9 | ESP8266 Wemos D1 Pro<br/>HyperSPI v9 |
149+
|------------------------------------------------|-----------------|--------------------|---------------------|
150+
| 300 RGBW LEDs<br>continues output=83/70Hz | 83 | 83 | 70 |
151+
| 600 RGBW LEDs<br>continues output=43/33Hz | 42-43 | 42 | 33 |
152+
| 900 RGBW LEDs<br>continues output=28/22Hz | 28 | 28 | 22 |
132153

133-
## ESP8266
154+
# Compiling
134155

135-
| LED strip / Device | ESP8266 Wemos D1 Pro<br/>HyperSPI v9 |
136-
|------------------------------------------------|---------------------|
137-
| 300LEDs RGBW<br>Refresh rate/continues output=70Hz | 70 |
138-
| 600LEDs RGBW<br>Refresh rate/continues output=33Hz | 33 |
139-
| 900LEDs RGBW<br>Refresh rate/continues output=22Hz | 22 |
156+
## ESP8266 / ESP32
140157

141-
# Compiling
142-
143158
Currently we use PlatformIO to compile the project. Install [Visual Studio Code](https://code.visualstudio.com/) and add [PlatformIO plugin](https://platformio.org/).
144159
This environment will take care of everything and compile the firmware for you. Low-level LED strip support is provided by my highly optimizated (pre-fill I2S DMA modes, turbo I2S parallel mode for up to 2 segments etc) version of Neopixelbus library: [link](https://github.com/awawa-dev/NeoPixelBus).
145160

146-
But there is also an alternative and an easier way. Just fork the project and enable its Github Action. Use the online editor to make changes to the ```platformio.ini``` file, for example change default pin-outs or enable multi-segments support, and save it. Github Action will compile new firmware automatically in the Artifacts archive. It has never been so easy! **Just remember to follow the steps in the correct order otherwise the Github Action may not be triggered the first time after saving the changes.**
161+
## Pico rp2040
162+
163+
Use Pico SDK and Visual Code to open ```rp2040``` folder. Edit ```rp2040\CMakeLists.txt``` configuration file if you need to apply changes.
164+
165+
## Github Action
166+
167+
But there is also an alternative and an easier way. Just fork the project and enable its Github Action. Use the online editor to make changes:
168+
- esp8266/ESP32 boards: to the ```platformio.ini``` file
169+
- rp2040 Pico boards: to the ```rp2040\CMakeLists.txt``` file
170+
171+
for example change default pin-outs or enable multi-segments support, and save it. Github Action will compile new firmware automatically in the Artifacts archive. It has never been so easy! **Just remember to follow the steps in the correct order otherwise the Github Action may not be triggered the first time after saving the changes.**
147172

148173
Tutorial: https://github.com/awawa-dev/HyperSPI/wiki
149174

150-
# Multi-Segment Wiring (ESP32 and ESP32-S2 only)
175+
# Multi-Segment Wiring (ESP32, ESP32-S2 and Pico rp2040 boards only)
176+
177+
## ESP32
151178

152179
Using parallel multi-segment allows you to double your Neopixel (e.g. sk6812 RGBW) LED strip refresh rate by dividing it into two smaller equal parts. Both smaller segments are perfectly in sync so you don't need to worry about it. Proposed example of building a multisegment:
153180
- Divide a long or dense strip of LEDs into 2 smaller equal parts. So `SECOND_SEGMENT_START_INDEX` in the HyperSPI firmware is the total number of LEDs divided by 2.
@@ -173,6 +200,10 @@ build_flags = -DNEOPIXEL_RGB -DDATA_PIN=2 ${env.build_flags} -DSECOND_SEGMENT_ST
173200
Implementation example:
174201
- The diagram of the board for WS2812b/SK6812 including ESP32 and the SN74AHCT125N 74AHCT125 [level shifter](https://github.com/awawa-dev/HyperHDR/wiki/Level-Shifter).
175202

203+
## Pico rp2040
204+
205+
Edit ```rp2040\CMakeLists.txt``` file and recompile the project.
206+
176207
![HyperSPI](https://user-images.githubusercontent.com/85223482/222923979-f344349a-1f8b-4195-94ca-51721923359e.png)
177208

178209
# Performance/debug output

0 commit comments

Comments
 (0)