Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

board: support for NRF51 HW-651 #4712

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,10 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=elecrow-rp2350 examples/blinky1
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=hw-651 examples/machinetest
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=hw-651-s110v8 examples/machinetest
@$(MD5SUM) test.hex
ifneq ($(WASM), 0)
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/export
$(TINYGO) build -size short -o wasm.wasm -target=wasm examples/wasm/main
Expand Down
77 changes: 77 additions & 0 deletions src/machine/board_hw-651.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//go:build hw_651

package machine
ysoldak marked this conversation as resolved.
Show resolved Hide resolved

// No-name brand board based on the nRF51822 chip with low frequency crystal on board.
// Pinout (reverse engineered from the board) can be found here:
// https://aviatorahmet.blogspot.com/2020/12/pinout-of-nrf51822-board.html
// https://cr0wg4n.medium.com/pinout-nrf51822-board-hw-651-78da2eda8894

const HasLowFrequencyCrystal = true

var DefaultUART = UART0

// GPIO pins on header J1
const (
J1_01 = P0_21
J1_03 = P0_23
J1_04 = P0_22
J1_05 = P0_25
J1_06 = P0_24
J1_09 = P0_29
J1_10 = P0_28
J1_11 = P0_30
J1_13 = P0_00
J1_15 = P0_02
J1_17 = P0_04
J1_16 = P0_01
J1_18 = P0_03
)

// GPIO pins on header J2
const (
J2_01 = P0_20
J2_03 = P0_18
J2_04 = P0_19
J2_07 = P0_16
J2_08 = P0_15
J2_09 = P0_14
J2_10 = P0_13
J2_11 = P0_12
J2_12 = P0_11
J2_13 = P0_10
J2_14 = P0_09
J2_15 = P0_08
J2_16 = P0_07
J2_17 = P0_06
J2_18 = P0_05
)

// UART pins
const (
UART_TX_PIN = P0_24 // J1_06 on the board
UART_RX_PIN = P0_25 // J1_05 on the board
)

// ADC pins
const (
ADC0 = P0_03 // J1_18 on the board
ADC1 = P0_02 // J1_15 on the board
ADC2 = P0_01 // J1_16 on the board
ADC3 = P0_04 // J1_17 on the board
ADC4 = P0_05 // J2_18 on the board
ADC5 = P0_06 // J2_17 on the board
)

// I2C pins
const (
SDA_PIN = P0_30 // J1_11 on the board
SCL_PIN = P0_00 // J1_13 on the board
)

// SPI pins
const (
SPI0_SCK_PIN = P0_23 // J1_03 on the board
SPI0_SDO_PIN = P0_21 // J1_01 on the board
SPI0_SDI_PIN = P0_22 // J1_04 on the board
)
3 changes: 3 additions & 0 deletions targets/hw-651-s110v8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"inherits": ["hw-651", "nrf51-s110v8"]
}
7 changes: 7 additions & 0 deletions targets/hw-651.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"inherits": ["nrf51"],
"build-tags": ["hw_651"],
"serial": "uart",
"flash-method": "openocd",
"openocd-interface": "cmsis-dap"
}
Loading