Skip to content
Open
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
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,25 @@ openmotordrive/framework is a framework for embedded applications, primarily tar
|uavcan_restart|Provides a uavcan.protocol.RestartNode server|
|worker_thread|Provides worker threads that can process timer tasks, which run after a delay, or listener tasks, which listen to pubsub messages|

## REQUIREMENTS
Some installations requirements and help.

### Submodules :
After cloning, get the submodules with :

```bash
git submodule update --init --recursive
```

### Toolchain :
Tested with gcc6 and gcc7

On Ubuntu 16.04, you can use [team-gcc-arm-embedded](https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa) version

### Others
It needs crcmod and uavcan python package

```bash
sudo pip install -U crcmod uavcan
```

8 changes: 8 additions & 0 deletions examples/basic_uavcan_functionality/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Usage
Set BOARD_DIR according to you board directory.

### Example

```bash
BOARD_DIR=boards/com.hex.cube_1.0 make
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
#include <stdint.h>
#include <modules/platform_stm32f302x8/platform_stm32f302x8.h>

#define BOARD_CONFIG_HW_NAME "org.proficnc.uwb"
#define BOARD_CONFIG_HW_MAJOR_VER 1
#define BOARD_CONFIG_HW_MINOR_VER 0

#define BOARD_CONFIG_HW_INFO_STRUCTURE { \
.hw_name = BOARD_CONFIG_HW_NAME, \
.hw_major_version = BOARD_CONFIG_HW_MAJOR_VER, \
.hw_minor_version = BOARD_CONFIG_HW_MINOR_VER, \
.board_desc_fmt = SHARED_HW_INFO_BOARD_DESC_FMT_NONE, \
.board_desc = 0, \
}

#define BOARD_PAL_LINE_SPI_SCK PAL_LINE(GPIOB,3)
#define BOARD_PAL_LINE_SPI_MISO PAL_LINE(GPIOB,4)
#define BOARD_PAL_LINE_SPI_MOSI PAL_LINE(GPIOB,5)
Expand Down
55 changes: 55 additions & 0 deletions examples/basic_uwb_functionality/.cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.114656749">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.114656749" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.114656749" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.114656749." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1182750861" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1182750861.169007201" name=""/>
<builder autoBuildTarget="all" cleanBuildTarget="clean" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.579570726" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.2143276802" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1873650595" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1337802279" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1707090075" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.338985256" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1165165914" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.714476670" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="usb.null.1703860681" name="usb"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.114656749">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/usb"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
2 changes: 2 additions & 0 deletions examples/basic_uwb_functionality/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.dep
90 changes: 90 additions & 0 deletions examples/basic_uwb_functionality/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>usb</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j1</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>os</name>
<type>2</type>
<locationURI>CHIBIOS/os</locationURI>
</link>
<link>
<name>test</name>
<type>2</type>
<locationURI>CHIBIOS/test</locationURI>
</link>
</linkedResources>
</projectDescription>
27 changes: 27 additions & 0 deletions examples/basic_uwb_functionality/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CSRC = $(shell find src -name "*.c")
INCDIR = ./include

MODULES_ENABLED = \
chibios_sys_init \
chibios_hal_init \
app_descriptor \
boot_msg \
timing \
system \
pubsub \
worker_thread \
can_driver_stm32 \
can \
can_autobaud \
uavcan \
uavcan_nodestatus_publisher \
uavcan_getnodeinfo_server \
uavcan_beginfirmwareupdate_server \
uavcan_allocatee \
uavcan_restart \
freemem_check

MESSAGES_ENABLED = \
uavcan.protocol.debug.LogMessage

include ../../include.mk
8 changes: 8 additions & 0 deletions examples/basic_uwb_functionality/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Usage
Set BOARD_DIR according to you board directory.

### Example

```bash
BOARD_DIR=boards/com.hex.cube_1.0 make
```
25 changes: 25 additions & 0 deletions examples/basic_uwb_functionality/boards/org.skt.uwb_1.0/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <hal.h>

void boardInit(void) {
palSetLineMode(BOARD_PAL_LINE_SPI_SCK, PAL_MODE_ALTERNATE(6) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_PULLDOWN); // SPI3 SCK
palSetLineMode(BOARD_PAL_LINE_SPI_MISO, PAL_MODE_ALTERNATE(6) | PAL_STM32_OSPEED_HIGHEST); // SPI3 MISO
palSetLineMode(BOARD_PAL_LINE_SPI_MOSI, PAL_MODE_ALTERNATE(6) | PAL_STM32_OSPEED_HIGHEST); // SPI3 MOSI
palSetLineMode(BOARD_PAL_LINE_SPI_UWB_CS, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); // UWB CS
palSetLineMode(PAL_LINE(GPIOB, 6), PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); // TEST POINT 1
palSetLineMode(PAL_LINE(GPIOB, 7), PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); // TEST POINT 2
palSetLineMode(BOARD_PAL_LINE_UWB_IRQ, PAL_STM32_MODE_INPUT | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_PULLDOWN); // UWB IRQ
palSetLineMode(BOARD_PAL_LINE_CAN_RX, PAL_MODE_ALTERNATE(9) | PAL_STM32_OSPEED_HIGHEST);
palSetLineMode(BOARD_PAL_LINE_CAN_TX, PAL_MODE_ALTERNATE(9) | PAL_STM32_OSPEED_HIGHEST);

palSetLineMode(LINE_UART2_RTS, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_LOWEST | PAL_STM32_PUPDR_PULLUP);
palSetLineMode(LINE_UART2_CTS, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_LOWEST | PAL_STM32_PUPDR_PULLUP);
palSetLineMode(LINE_UART2_RX, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_LOWEST | PAL_STM32_PUPDR_PULLUP);
palSetLineMode(LINE_UART2_TX, PAL_MODE_ALTERNATE(7) | PAL_STM32_OSPEED_LOWEST | PAL_STM32_PUPDR_PULLUP);

//palSetLineMode(LINE_OTG_HS_VBUS, PAL_MODE_ALTERNATE(10) | PAL_STM32_OSPEED_LOWEST | PAL_STM32_PUPDR_PULLDOWN);
//palSetLineMode(LINE_OTG_HS_DM, PAL_MODE_ALTERNATE(10) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
// palSetLineMode(LINE_OTG_HS_DP, PAL_MODE_ALTERNATE(10) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
palSetLineMode(LINE_SWDIO, PAL_MODE_ALTERNATE(0) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_PULLUP);
palSetLineMode(LINE_SWCLK, PAL_MODE_ALTERNATE(0) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_PULLDOWN);

}
63 changes: 63 additions & 0 deletions examples/basic_uwb_functionality/boards/org.skt.uwb_1.0/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#pragma once

#include <stdint.h>
#include <modules/platform_stm32f401/platform_stm32f401.h>

/*
* Board oscillators-related settings.
* NOTE: LSE not fitted.
*/
#if !defined(STM32_LSECLK)
#define STM32_LSECLK 0U
#endif

#if !defined(STM32_HSECLK)
#define STM32_HSECLK 24000000U
#endif

#define STM32F401xC
/*
* Board voltages.
* Required for performance limits calculation.
*/
#define STM32_VDD 330U

#define BOARD_CONFIG_HW_NAME "org.skt.uwb"
#define BOARD_CONFIG_HW_MAJOR_VER 1
#define BOARD_CONFIG_HW_MINOR_VER 0

#define BOARD_CONFIG_HW_INFO_STRUCTURE { \
.hw_name = BOARD_CONFIG_HW_NAME, \
.hw_major_version = BOARD_CONFIG_HW_MAJOR_VER, \
.hw_minor_version = BOARD_CONFIG_HW_MINOR_VER, \
.board_desc_fmt = SHARED_HW_INFO_BOARD_DESC_FMT_NONE, \
.board_desc = 0, \
}

#define BOARD_PAL_LINE_SPI_SCK PAL_LINE(GPIOB,3)
#define BOARD_PAL_LINE_SPI_MISO PAL_LINE(GPIOB,4)
#define BOARD_PAL_LINE_SPI_MOSI PAL_LINE(GPIOB,5)
#define BOARD_PAL_LINE_SPI_UWB_CS PAL_LINE(GPIOA,15) // NOTE: never drive high by external source
#define BOARD_PAL_LINE_UWB_NRST PAL_LINE(GPIOB,8)
#define BOARD_PAL_LINE_UWB_IRQ PAL_LINE(GPIOB,12)
#define BOARD_PAL_LINE_CAN_RX PAL_LINE(GPIOB,6)
#define BOARD_PAL_LINE_CAN_TX PAL_LINE(GPIOB,7)
#define DW1000_SPI_BUS 3

#define SERIAL_DEFAULT_BITRATE 57600

/*
* IO pins assignments.
*/

#define LINE_UART2_RTS PAL_LINE(GPIOA, 0U)
#define LINE_UART2_CTS PAL_LINE(GPIOA, 1U)
#define LINE_UART2_RX PAL_LINE(GPIOA, 2U)
#define LINE_UART2_TX PAL_LINE(GPIOA, 3U)

#define LINE_OTG_HS_VBUS PAL_LINE(GPIOA, 9U)
#define LINE_OTG_HS_DM PAL_LINE(GPIOA, 11U)
#define LINE_OTG_HS_DP PAL_LINE(GPIOA, 12U)

#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BOARD_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
BOARD_SRC = $(BOARD_DIR)/board.c
BOARD_INC = $(BOARD_DIR)
MODULES_ENABLED += platform_stm32f401
Loading