Skip to content
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
5 changes: 5 additions & 0 deletions .github/workflows/build-firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ jobs:
cd /src/firmware/src
west build -p -b dtqsys_ht
cp ./build/zephyr/*.bin build_bins/
- name: Build Firmware Licardo Ht
run: |
cd /src/firmware/src
west build -p -b licardo_ht
cp ./build/zephyr/*.bin build_bins/

# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
Expand Down
6 changes: 4 additions & 2 deletions firmware/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ set (BOARD_HW_REV "")
if((${BOARD} STREQUAL "arduino_nano_33_ble") OR
(${BOARD} STREQUAL "xiao_ble/nrf52840/sense") OR
(${BOARD} STREQUAL "xiao_ble/nrf52840") OR
(${BOARD} STREQUAL "dtqsys_ht"))
(${BOARD} STREQUAL "dtqsys_ht") OR
(${BOARD} STREQUAL "licardo_ht"))
message(STATUS " Board is a NRF52 based board")

# Pick the correct project file for this architecture
Expand All @@ -52,7 +53,8 @@ if((${BOARD} STREQUAL "arduino_nano_33_ble") OR
endif()

#DTQ Board, use local board file from /zephyr/boards
if((${BOARD} STREQUAL "dtqsys_ht"))
if((${BOARD} STREQUAL "dtqsys_ht") OR
(${BOARD} STREQUAL "licardo_ht"))
set (BOARD_ROOT "${CMAKE_SOURCE_DIR}/zephyr")
endif()

Expand Down
3 changes: 3 additions & 0 deletions firmware/src/build_all.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ west build -p -b rpi_pico/rp2040/w || exit /b
copy .\build\zephyr\rpi*.uf2 build_bins\

west build -p -b dtqsys_ht || exit /b
copy .\build\zephyr\*.bin build_bins\

west build -p -b licardo_ht || exit /b
copy .\build\zephyr\*.bin build_bins\
2 changes: 2 additions & 0 deletions firmware/src/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ cp ./build/zephyr/*.bin build_bins/ &&
west build -p -b rpi_pico/rp2040/w &&
cp ./build/zephyr/*.uf2 build_bins/ &&
west build -p -b dtqsys_ht &&
cp ./build/zephyr/*.bin build_bins/ &&
west build -p -b licardo_ht &&
cp ./build/zephyr/*.bin build_bins/
35 changes: 35 additions & 0 deletions firmware/src/headtracker.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,23 @@
"preLaunchTask": "Build (DTQSYS HT) - Debug",
"svdFile": "${workspaceRoot:src}/nrf52840.svd",
},
{
"name": "Jlink - Licardo HT",
"device": "nRF52840_XXAA",
"cwd": "${workspaceRoot:src}",
"executable": "build/zephyr/zephyr.elf",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
"servertype": "jlink",
"rtos": "Zephyr",
//"showDevDebugOutput":"raw",
"serverpath": "C:/Program Files/SEGGER/JLink/JLinkGDBServerCL.exe", // Check path to Jlink installation
"armToolchainPath": "${workspaceRoot:src}/../zephyr-sdk/arm-zephyr-eabi/bin", // NOTE Check version & path of SDK here
"toolchainPrefix": "arm-zephyr-eabi",
"preLaunchTask": "Build (Licardo HT) - Debug",
"svdFile": "${workspaceRoot:src}/nrf52840.svd",
},
{
"name": "OpenOCD - ESP32C3_DevKitM (RISC-V)",
"type": "cppdbg",
Expand Down Expand Up @@ -271,6 +288,24 @@
"reveal": "always"
},
"group": "build"
},
{
"label": "Build (LICARDO HT) - Debug",
"type": "shell",
"command": "west",
"args": [
"build",
"-p", "auto",
"-b", "licardo_ht",
"--", "-DCMAKE_BUILD_TYPE=Debug"
],
"problemMatcher": [
"$tsc"
],
"presentation": {
"reveal": "always"
},
"group": "build"
}
]
}
Expand Down
84 changes: 84 additions & 0 deletions firmware/src/src/boards/licardo_ht.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#pragma once

#include <stdint.h>

#include "boardsdefs.h"

// Pull up pin mode
#define INPUT_PULLUP (GPIO_INPUT | GPIO_PULL_UP)

// Board features
#define HAS_WS2812
#define HAS_BUZZER
#define HAS_NOTIFYLED
#define HAS_MPU6500
#define HAS_QMC5883
#define HAS_AUXSERIAL
#define HAS_CENTERBTN
#define HAS_PPMOUT
#define HAS_PPMIN
#define HAS_3CH_ANALOG
#define HAS_VOLTMON

#define AN0 5 // Pin 0.29
#define AN1 0 // Pin 0.02
#define AN2 4 // Pin 0.28
#define ANVOLTMON 1 // Battery Voltage
#define ANVOLTMON_SCALE 2.0f
#define ANVOLTMON_OFFSET 0.0f

/* Pins (name, number, description)
NOTE: These pins are an enum entry. e.g. IO_CENTER_BTN = 0
- Use PIN_NAME_TO_NUM(IO_D2) to get actual the pin number
- The pin number can be converted back into the NRF port/pin
using functions PIN_TO_GPORT & PIN_TO_GPIN
- The string descrition for CENTER_BTN would be StrPinDescriptions[IO_CENTER_BTN]
- The string of the pin name would be StrPins[CENTER_BTN]

Change the pins to whatever you wish here. Some pins might be defined in the
board's devicetree overlay file (e.g. UART). You will have to change them there
& should make sure they match here so the GUI can show the correct pinout.

Leave descriptions empty for pins if you don't want it to
show up in the pinout on the GUI
*/

#define PIN_X \
PIN(CENTER_BTN, NRFPIN(1, 13), "") \
PIN(VOLTMON, NRFPIN(0, 3), "") \
PIN(AN0, NRFPIN(0, 29), "Analog 0 (AIN_5)") \
PIN(AN1, NRFPIN(0, 2), "Analog 1 (AIN_0)") \
PIN(AN2, NRFPIN(0, 28), "Analog 2 (AIN_4)") \
PIN(LEDWS, NRFPIN(1, 10), "") \
PIN(LED, NRFPIN(0, 13), "") \
PIN(PPMOUT, NRFPIN(0, 31), "") \
PIN(PPMIN, NRFPIN(0, 30), "") \
PIN(BUZZ, NRFPIN(1, 11), "") \
PIN(TX, NRFPIN(0, 9), "") \
PIN(RX, NRFPIN(0, 10), "") \
PIN(TXINV, NRFPIN(0, 4), "") \
PIN(RXINVO, NRFPIN(0, 0), "") \
PIN(RXINVI, NRFPIN(0, 1), "") \
PIN(I2CSDA, NRFPIN(0, 5), "") \
PIN(I2CSCL, NRFPIN(1, 9), "")

typedef enum {
#define PIN(NAME, PINNO, DESC) IO_##NAME,
PIN_X
#undef PIN
} pins_e;

const int8_t PinNumber[] = {
#define PIN(NAME, PINNO, DESC) PINNO,
PIN_X
#undef PIN
};

// Required pin setting functions
#define pinMode(pin, mode) gpio_pin_configure(gpios[PIN_TO_GPORT(PIN_NAME_TO_NUM(pin))], PIN_TO_GPIN(PIN_NAME_TO_NUM(pin)), mode)
#define digitalWrite(pin, value) gpio_pin_set(gpios[PIN_TO_GPORT(PIN_NAME_TO_NUM(pin))], PIN_TO_GPIN(PIN_NAME_TO_NUM(pin)), value)
#define digitalRead(pin) gpio_pin_get(gpios[PIN_TO_GPORT(PIN_NAME_TO_NUM(pin))], PIN_TO_GPIN(PIN_NAME_TO_NUM(pin)))

// Values below were determined by plotting Gyro Output (See sense.cpp, gyroCalibration())
#define GYRO_STABLE_DIFF 200.0f
#define ACC_STABLE_DIFF 3.5f
4 changes: 4 additions & 0 deletions firmware/src/src/include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#define FW_BOARD "DTQSYS"
#include "boards/dtqsys_ht.h"
#define ARDUINO_BOOTLOADER
#elif defined(CONFIG_BOARD_LICARDO_HT)
#define FW_BOARD "LICARDO"
#include "boards/licardo_ht.h"
#define ARDUINO_BOOTLOADER
#elif defined(CONFIG_BOARD_XIAO_BLE)
#include "boards/xiaoble.h"
#define SEEED_BOOTLOADER
Expand Down
2 changes: 2 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

zephyr_library()
12 changes: 12 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2020 Jefferson Lee.
# SPDX-License-Identifier: Apache-2.0

if BOARD_LICARDO_HT

config BT_CTLR
default BT

config I2C
default y

endif #board
6 changes: 6 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/Kconfig.licardo_ht
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2020 Jefferson Lee.
# SPDX-License-Identifier: Apache-2.0

config BOARD_LICARDO_HT
select SOC_NRF52840_QIAA

11 changes: 11 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
board_runner_args(trace32
"--startup-args"
"elfFile=${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}"
)

include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/trace32.board.cmake)
6 changes: 6 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: licardo_ht
vendor: licardo
socs:
- name: nrf52840

10 changes: 10 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DTQ Sys HT
#################################

Overview
********

This is a custom board built for use as a Headtracker, based on the NRF52840 cpu

Visit Headtracker.gitbook.io

149 changes: 149 additions & 0 deletions firmware/src/zephyr/boards/arm/licardo_ht/licardo_ht.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright (c) 2020 Jefferson Lee
* Modified for LICARDO board by Licardo
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;

#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/led/led.h>

/ {
model = "LICARDO Head Tracker";
compatible = "licardo_ht";

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &code_partition;
zephyr,ieee802154 = &ieee802154;
};

aliases {
adcctrl = &adc;
i2csensor = &i2c1;
guiuart = &cdc_acm_uart0;
};
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

code_partition: partition@10000 {
label = "code";
reg = <0x10000 0xEC000>;
read-only;
};

storage_partition: partition@FB000 {
label = "storagept";
reg = <0xFB000 0x3000>;
};

ht_data_partition: partition@FD000 {
label = "htdatapt";
reg = <0xFE000 0x2000>;
};
};
};

&adc {
status = "okay";
};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

&gpiote {
status = "okay";
};

&uart0 {
status = "disabled";
};

&i2c0 {
status = "disabled";
};

/* Disable Timer3, used by PPM output
*/
&timer3 {
status = "disabled";
};

/* Disable Timer4, used by PPM input
*/
&timer4 {
status = "disabled";
};

&pinctrl {
i2c1_dtq: i2c1_dtq {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 5)>,
<NRF_PSEL(TWIM_SCL, 1, 9)>;
};
};

spi2_dtq: spi2_dtq {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
<NRF_PSEL(SPIM_MOSI, 1, 10)>,
<NRF_PSEL(SPIM_MISO, 1, 8)>;
};
};
};

// Sensor I2C
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c1_dtq>;
pinctrl-names = "default";
clock-frequency = <400000>;
};

// RGB LED, SPI Interface
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi2_dtq>;
pinctrl-names = "default";
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
reg = <0>;
spi-max-frequency = <4000000>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
chain-length = <1>;
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};

zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};

// Uncomment the below lines for kernel logging to a second USB CDC port
/*
cdc_acm_uart1: cdc_acm_uart1 {
compatible = "zephyr,cdc-acm-uart";
}; */
};

&ieee802154 {
status = "okay";
};
Loading