mirror of
https://github.com/StefanHamminga/StepperDriverModuleCarrier
synced 2025-08-22 00:40:55 +03:00
Initial commit
This commit is contained in:
1
Firmware/.vscode/.cortex-debug.peripherals.state.json
vendored
Normal file
1
Firmware/.vscode/.cortex-debug.peripherals.state.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
1
Firmware/.vscode/.cortex-debug.registers.state.json
vendored
Normal file
1
Firmware/.vscode/.cortex-debug.registers.state.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
22
Firmware/.vscode/c_cpp_properties.json
vendored
Normal file
22
Firmware/.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
// "${workspaceFolder}/build/pico_sdk-src/src/common/**",
|
||||
// "/usr/share/pico-sdk/src/common/pico_base/**",
|
||||
// "/usr/share/pico-sdk/src/common/pico_base/include/**",
|
||||
// "/usr/share/pico-sdk/src/common/boot_picoboot/include/**",
|
||||
// "/usr/share/pico-sdk/src/common/pico_stdlib/include/**"
|
||||
],
|
||||
"defines": [
|
||||
],
|
||||
"compilerPath": "/usr/bin/arm-none-eabi-g++",
|
||||
"intelliSenseMode": "linux-gcc-arm",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++20"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
31
Firmware/.vscode/launch.json
vendored
Normal file
31
Firmware/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${workspaceRoot}/build/USBQuadStep.elf",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
// This may need to be arm-none-eabi-gdb depending on your system
|
||||
"gdbPath" : "arm-none-eabi-gdb",
|
||||
"device": "RP2040",
|
||||
"configFiles": [
|
||||
"interface/picoprobe.cfg",
|
||||
"target/rp2040.cfg"
|
||||
],
|
||||
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
|
||||
"runToMain": true,
|
||||
// Work around for stopping at main on restart
|
||||
"postRestartCommands": [
|
||||
"break main",
|
||||
"continue"
|
||||
]
|
||||
// "searchDir": ["<PATH TO TCL>"],
|
||||
}
|
||||
]
|
||||
}
|
20
Firmware/.vscode/settings.json
vendored
Normal file
20
Firmware/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"cmake.copyCompileCommands": "",
|
||||
"cmake.statusbar.advanced": {
|
||||
"debug": {
|
||||
"visibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"visibility": "hidden"
|
||||
},
|
||||
"build": {
|
||||
"visibility": "default"
|
||||
},
|
||||
"buildTarget": {
|
||||
"visibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.buildBeforeRun": true,
|
||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
|
||||
"cortex-debug.openocdPath": "/usr/local/bin/openocd"
|
||||
}
|
40
Firmware/CMakeLists.txt
Normal file
40
Firmware/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(PICO_BOARD "USBQuadStep")
|
||||
set(PICO_SDK_FETCH_FROM_GIT on)
|
||||
|
||||
# initalize pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
# set(PICO_SDK_PATH "/usr/share/pico-sdk")
|
||||
set(PICO_BOARD_HEADER_DIRS "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(${PICO_BOARD} C CXX ASM)
|
||||
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(${PICO_BOARD} ${PICO_BOARD}.cpp )
|
||||
|
||||
pico_set_program_name(${PICO_BOARD} "${PICO_BOARD}")
|
||||
pico_set_program_description(${PICO_BOARD} "Quad TMC2209 Stepper Driver Module Carrier Board")
|
||||
pico_set_program_version(${PICO_BOARD} "0.1")
|
||||
pico_set_program_url(${PICO_BOARD} "www.rbts.co/uqs")
|
||||
|
||||
pico_enable_stdio_uart(${PICO_BOARD} 0)
|
||||
pico_enable_stdio_usb(${PICO_BOARD} 1)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(${PICO_BOARD} pico_stdlib)
|
||||
|
||||
pico_add_extra_outputs(${PICO_BOARD})
|
||||
|
22
Firmware/USBQuadStep.cpp
Normal file
22
Firmware/USBQuadStep.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/bootrom.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
stdio_init_all();
|
||||
|
||||
uint32_t counter {0};
|
||||
|
||||
while (counter < 100) {
|
||||
// puts("Hello, world!");
|
||||
++counter;
|
||||
printf("Hello, world no. %i", counter);
|
||||
sleep_ms(100);
|
||||
}
|
||||
|
||||
reset_usb_boot(0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
91
Firmware/USBQuadStep.h
Normal file
91
Firmware/USBQuadStep.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------
|
||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// This header may be included by other board headers as "boards/pico.h"
|
||||
|
||||
#ifndef _BOARDS_PICO_H
|
||||
#define _BOARDS_PICO_H
|
||||
|
||||
// For board detection
|
||||
#define RASPBERRYPI_PICO
|
||||
|
||||
// --- UART ---
|
||||
// #ifndef PICO_DEFAULT_UART
|
||||
// #define PICO_DEFAULT_UART 0
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
// #define PICO_DEFAULT_UART_TX_PIN 0
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
// #define PICO_DEFAULT_UART_RX_PIN 1
|
||||
// #endif
|
||||
|
||||
// --- LED ---
|
||||
// #ifndef PICO_DEFAULT_LED_PIN
|
||||
// #define PICO_DEFAULT_LED_PIN 25
|
||||
// #endif
|
||||
// no PICO_DEFAULT_WS2812_PIN
|
||||
|
||||
// --- I2C ---
|
||||
// #ifndef PICO_DEFAULT_I2C
|
||||
// #define PICO_DEFAULT_I2C 0
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
// #define PICO_DEFAULT_I2C_SDA_PIN 4
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
// #define PICO_DEFAULT_I2C_SCL_PIN 5
|
||||
// #endif
|
||||
|
||||
// --- SPI ---
|
||||
// #ifndef PICO_DEFAULT_SPI
|
||||
// #define PICO_DEFAULT_SPI 0
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
// #define PICO_DEFAULT_SPI_SCK_PIN 18
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
// #define PICO_DEFAULT_SPI_TX_PIN 19
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
// #define PICO_DEFAULT_SPI_RX_PIN 16
|
||||
// #endif
|
||||
// #ifndef PICO_DEFAULT_SPI_CSN_PIN
|
||||
// #define PICO_DEFAULT_SPI_CSN_PIN 17
|
||||
// #endif
|
||||
|
||||
// --- FLASH ---
|
||||
|
||||
//TODO: Figure out how to make the W25Q128 work:
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
||||
// #define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (128/8 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
|
||||
#define PICO_SMPS_MODE_PIN 23
|
||||
|
||||
// Sadly we got a new-old batch of B0's
|
||||
// #ifndef PICO_FLOAT_SUPPORT_ROM_V1
|
||||
// #define PICO_FLOAT_SUPPORT_ROM_V1 1
|
||||
// #endif
|
||||
|
||||
// #ifndef PICO_DOUBLE_SUPPORT_ROM_V1
|
||||
// #define PICO_DOUBLE_SUPPORT_ROM_V1 1
|
||||
// #endif
|
||||
|
||||
#endif
|
62
Firmware/pico_sdk_import.cmake
Normal file
62
Firmware/pico_sdk_import.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
)
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
Reference in New Issue
Block a user