diff --git a/boards/bronco_space/proves_flight_control_board_v4b/Kconfig.proves_flight_control_board_v4b b/boards/bronco_space/proves_flight_control_board_v4b/Kconfig.proves_flight_control_board_v4b new file mode 100644 index 00000000..7e6096e8 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/Kconfig.proves_flight_control_board_v4b @@ -0,0 +1,12 @@ +config SOC_RP2040 + bool "Enable Cortex-M0+ core" + default y + +config USB_SELF_POWERED + default n + +config USB_CDC_ACM_LOG_LEVEL + default 0 + +config USB_DEVICE_LOG_LEVEL + default 1 diff --git a/boards/bronco_space/proves_flight_control_board_v4b/board.cmake b/boards/bronco_space/proves_flight_control_board_v4b/board.cmake new file mode 100644 index 00000000..9b592443 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/board.cmake @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: Apache-2.0 + +if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "") + set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap") +endif() + +board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]") + + + +# The adapter speed is expected to be set by interface configuration. +# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at +# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd +board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000") + + +board_runner_args(openocd --cmd-pre-init "source [find target/rp2040.cfg]") +board_runner_args(jlink "--device=RP2040_M0_0") +board_runner_args(uf2 "--board-id=RP2040") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) diff --git a/boards/bronco_space/proves_flight_control_board_v4b/board.yml b/boards/bronco_space/proves_flight_control_board_v4b/board.yml new file mode 100644 index 00000000..a6d9a7b9 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/board.yml @@ -0,0 +1,6 @@ +board: + name: proves_flight_control_board_v4b + full_name: PROVES Flight Control Board v4b + vendor: Bronco Space + socs: + - name: rp2040 diff --git a/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040-pinctrl.dtsi b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040-pinctrl.dtsi new file mode 100644 index 00000000..4b47b572 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040-pinctrl.dtsi @@ -0,0 +1,20 @@ +#include + +&pinctrl { + spi1_default: spi1_default { + group1 { + pinmux = , ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + input-enable; + }; + }; +}; diff --git a/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.dts b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.dts new file mode 100644 index 00000000..9583614c --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.dts @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2024 Andrew Featherstone + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +/* The build system assumes that there's a cpucluster-specific file. + * + * This file provides composition of the device tree: + * 1. The common features of the SoC + * 2. Core-specific configuration. + * 3. Board-specific configuration. + */ +#include + + +#include + +#include +#include + +#include "proves_flight_control_board_v4b_rp2040-pinctrl.dtsi" + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &cdc_acm_uart0; + zephyr,shell-uart = &cdc_acm_uart0; + zephyr,code-partition = &code_partition; + }; + + aliases { + watchdog0 = &wdt0; + }; + + leds { + compatible = "gpio-leds"; + led0: led0 { + gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>; + label = "User LED GPIO24"; + }; + }; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; + +&zephyr_udc0 { + cdc_acm_uart0: cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; + +&flash0 { + reg = <0x10000000 DT_SIZE_M(4)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Reserved memory for an image definition block. The block is much + * smaller than 256 bytes, but in practice the linker places the vector + * table at a much larger alignment offset. + */ + image_def: partition@0 { + label = "image_def"; + reg = <0x00000000 0x100>; + read-only; + }; + + /* + * Usable flash. Starts at 0x100, after the image definition block. + * The partition size is 4MB minus the 0x100 bytes taken by the + * image definition. + */ + code_partition: partition@100 { + label = "code-partition"; + reg = <0x100 (DT_SIZE_M(4) - 0x100)>; + read-only; + }; + }; +}; + +&timer { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&spi1 { + status = "okay"; + cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&spi1_default>; + pinctrl-names = "default"; + + lora0: sx1276@0 { + compatible = "semtech,sx1276"; + reg = <0>; + spi-max-frequency = <125000>; + dio-gpios = <&gpio0 23 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; + reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + power-amplifier-output = "pa-boost"; + label = "HOPE_RF"; + }; +}; + +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + clock-frequency = <100000>; + + lsm6dso0: lsm6dso0@6b { + compatible = "st,lsm6dso"; + reg = <0x6b>; + label = "LSM6DSO"; + }; + + lis2mdl: lis2mdl@1e { + compatible = "st,lis2mdl"; + reg = <0x1e>; + label = "LIS2MDL"; + }; + rv3028: rv3028@52 { + compatible = "microcrystal,rv3028"; + reg = <0x52>; + int-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; + backup-switch-mode = "level"; + label = "RV3028"; + }; +}; diff --git a/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.yaml b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.yaml new file mode 100644 index 00000000..c05f4de6 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040.yaml @@ -0,0 +1,22 @@ +identifier: proves_flight_control_board_v4b/rp2040 +name: PROVES Flight Control Board v4b (RP2040, Cortex-M0+) +type: mcu +arch: arm +flash: 4096 +ram: 264 +toolchain: + - zephyr + - gnuarmemb +supported: + - adc + - clock + - counter + - dma + - gpio + - hwinfo + - i2c + - pwm + - spi + - uart + - usbd + - watchdog diff --git a/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040_defconfig b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040_defconfig new file mode 100644 index 00000000..148c7ee3 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/proves_flight_control_board_v4b_rp2040_defconfig @@ -0,0 +1,26 @@ +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_BUILD_OUTPUT_UF2=y +CONFIG_CLOCK_CONTROL=y +CONFIG_CONSOLE=y +CONFIG_GPIO=y +CONFIG_RESET=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="PROVES Flight Control Board v4b" +CONFIG_USB_DEVICE_VID=0x1209 + +# Sensors +CONFIG_LSM6DSO=y +CONFIG_LSM6DSO_ENABLE_TEMP=y +CONFIG_LIS2MDL=y + +# Radio +CONFIG_LORA=y +CONFIG_LORA_SX127X=y + +# RTC +CONFIG_RTC=y +CONFIG_RTC_RV3028=y diff --git a/boards/bronco_space/proves_flight_control_board_v4b/support/openocd.cfg b/boards/bronco_space/proves_flight_control_board_v4b/support/openocd.cfg new file mode 100644 index 00000000..82666bb5 --- /dev/null +++ b/boards/bronco_space/proves_flight_control_board_v4b/support/openocd.cfg @@ -0,0 +1,11 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +# Checking and set 'adapter speed'. +# Set the adaptor speed, if unset, and given as an argument. +proc set_adapter_speed_if_not_set { speed } { + puts "checking adapter speed..." + if { [catch {adapter speed} ret] } { + adapter speed $speed + } +} diff --git a/settings.ini b/settings.ini index d27e929f..fcfd4bb7 100644 --- a/settings.ini +++ b/settings.ini @@ -7,4 +7,4 @@ default_toolchain: zephyr default_cmake_options: FPRIME_ENABLE_FRAMEWORK_UTS=OFF FPRIME_ENABLE_AUTOCODER_UTS=OFF BOARD_ROOT=. - BOARD=proves_flight_control_board_v5c/rp2350a/m33 + BOARD=proves_flight_control_board_v4b/rp2040