Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
a5a6f8d
REVERT ME --- Nucleo blinky demo
dchansen06 Jul 9, 2026
aa01abe
Revert "REVERT ME --- Nucleo blinky demo"
dchansen06 Jul 9, 2026
a9597c7
Initial skeleton commit
dchansen06 Jul 10, 2026
cd91db0
Completely random test project
dchansen06 Jul 10, 2026
fae24b0
In progress --- Work on getting initial CAN peripheral abstraction co…
dchansen06 Jul 10, 2026
6efc2bc
In progress --- Resolve a few include errors
dchansen06 Jul 10, 2026
11f536a
Add template from [Discord](https://discord.com/channels/756738476887…
dchansen06 Jul 15, 2026
b844929
New changes to template can_cfg_h.ftl; aimed to preserve user-changed…
TrainmanR Jul 15, 2026
f00f3a7
Added comments to explain new functionality in the can_cfg_h.ftl temp…
TrainmanR Jul 15, 2026
dbd5d13
Modify how we handle templates within the monorepo based on new infor…
dchansen06 Jul 16, 2026
e68c5b6
Modify line placement and ensure ordering has no precedence on broken…
dchansen06 Jul 16, 2026
e0b2e0e
Copy ftl from [Discord](https://discord.com/channels/7567384768876381…
dchansen06 Jul 16, 2026
05e2989
In progress --- Computer seconds from dying so it probably doesn't co…
dchansen06 Jul 16, 2026
56c3365
Timer Update
TrainmanR Jul 16, 2026
acc9c36
README_CAN_Timer_Configuration.md Added
TrainmanR Jul 17, 2026
6c013d2
Template Autogen Folders
TrainmanR Jul 19, 2026
63de147
Critical section macro that needs testing still
dchansen06 Jul 19, 2026
e2d62dd
Critical section safe code
dchansen06 Jul 19, 2026
99ac3bf
HOOTL testing of critical sections is very important
dchansen06 Jul 19, 2026
f5a178c
Make variable names harder to accidentally cross
dchansen06 Jul 19, 2026
90a0c14
Scripting for CubeMX Templates IOC Generation
TrainmanR Jul 20, 2026
8f893a7
Advanced critical section usage
dchansen06 Jul 19, 2026
b547af1
In progress --- Check point save while working with atomics
dchansen06 Jul 20, 2026
6809e38
Getting pretty close to a compiling build, needs timer integration work
dchansen06 Jul 21, 2026
4841ca3
Further improvements to internal setup
dchansen06 Jul 23, 2026
71af319
Fix locking and atomics, and cleanup
dchansen06 Jul 23, 2026
fe782e5
Ensure proper handling of tick
dchansen06 Jul 23, 2026
590a2b1
Cleanup defines
dchansen06 Jul 23, 2026
27c7c50
Redundancy checking on max instances
dchansen06 Jul 31, 2026
da339e1
Remove templates, very broken sadly
dchansen06 Jul 31, 2026
63f07dc
Harden testing of the critical section code
dchansen06 Jul 31, 2026
569662c
Harden CubeCAN
dchansen06 Jul 31, 2026
c1fc729
Tweak CUBEMXTESTING to align with new pattern
dchansen06 Jul 31, 2026
f19ee5a
Add helper oneshot functions, harden init
dchansen06 Jul 31, 2026
1a62255
So much peripheral lockdown
dchansen06 Jul 31, 2026
0181bf6
Reorganize ownership patterns, finalize api
dchansen06 Jul 31, 2026
af97b1a
Remove tools
dchansen06 Jul 31, 2026
b2a275f
Peripheral schema rename
dchansen06 Jul 31, 2026
d8d1f72
Cleanup names and CUBEMXTESTING
dchansen06 Aug 14, 2026
987b8ff
Reorganize context and setup CUBEMXTESTING for testing
dchansen06 Aug 14, 2026
d153661
Remove last bit of VCP
dchansen06 Aug 14, 2026
6334fe9
Rename loop file
dchansen06 Aug 14, 2026
e7e54eb
Missed a loop rename
dchansen06 Aug 14, 2026
9660bf3
Documentation
dchansen06 Aug 14, 2026
f4a287b
Documentation tweaks
dchansen06 Aug 14, 2026
cede426
Fix tx message marker doc
dchansen06 Aug 14, 2026
f5df570
Interrupt safety docs
dchansen06 Aug 14, 2026
4447a7c
Setup VSCode for CUBEMXTESTING
dchansen06 Aug 15, 2026
c8ef73b
Forgot to enable interrupts
dchansen06 Aug 15, 2026
412dd52
Automatic CMake Format: Standardized formatting automatically
github-actions[bot] Aug 15, 2026
5633454
Automatic Clang-Format: Standardized formatting automatically
github-actions[bot] Aug 15, 2026
e46adda
Fix compile error
dchansen06 Aug 16, 2026
eef305c
Fix codeql warning on failed asserts
dchansen06 Aug 16, 2026
60dc0cb
Add unused for timer handle
dchansen06 Aug 16, 2026
f6d7b28
Increase can tick timer speed
dchansen06 Aug 16, 2026
0003288
Automatic Clang-Format: Standardized formatting automatically
github-actions[bot] Aug 16, 2026
d190442
Add back logomatic message on rx
dchansen06 Aug 16, 2026
449cbf2
Update docs
dchansen06 Aug 16, 2026
9a3b793
Fix stm32 assert header
dchansen06 Aug 16, 2026
8cc568e
Fix assert failed message
dchansen06 Aug 16, 2026
0d83071
Setup more handles
dchansen06 Aug 16, 2026
079097e
Automatic Clang-Format: Standardized formatting automatically
github-actions[bot] Aug 16, 2026
d4ff2c4
Speedup
dchansen06 Aug 16, 2026
ba817ae
Timer safety!
dchansen06 Aug 16, 2026
972cd1a
Automatic Clang-Format: Standardized formatting automatically
github-actions[bot] Aug 16, 2026
3ea3a5d
Documentation!
dchansen06 Aug 16, 2026
7beba21
Make things slightly easier
dchansen06 Aug 16, 2026
b4508cd
Mark `PERIPHERAL_TIMEDCAN_LIB` as deprecated and rename `CUBE_CAN_LIB`
dchansen06 Aug 16, 2026
1bdda51
Automatic CMake Format: Standardized formatting automatically
github-actions[bot] Aug 16, 2026
85ecf17
Mark `PERIPHERAL_CAN_LIB` as deprecated as well
dchansen06 Aug 16, 2026
ebcab70
Automatic CMake Format: Standardized formatting automatically
github-actions[bot] Aug 16, 2026
7b2c764
Add fancy mon get rid of ftl extension
dchansen06 Aug 16, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ EWARM
.mxproject
*/Core/Src/system_stm32*xx.c
*/*/Core/Src/system_stm32*xx.c
*/Core/Inc/stm32_assert.h
*/*/Core/Inc/stm32_assert.h
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"github.vscode-pull-request-github",
"eamodio.gitlens",
"davidanson.vscode-markdownlint",
"ms-vscode.vscode-serial-monitor"
"wombat.fancymon"
]
}
31 changes: 31 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,37 @@
]
}
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/CUBEMXTESTING.elf",
"name": "CUBEMXTESTING",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32g4x.cfg"
],
"searchDir": [],
"preLaunchTask": "CMake: configure and build CUBEMXTESTING",
"showDevDebugOutput": "raw",
"svdPath": "${workspaceFolder}/Lib/Vendor/CMSIS_5/SVD/STM32G474.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 160000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
},
{
"cwd": "${workspaceFolder}",
"executable": "${command:cmake.buildDirectory}/CCU.elf",
Expand Down
9 changes: 9 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
],
"command": "cmake --build --preset ${command:cmake.activeBuildPresetName} --target ECU"
},
{
"label": "CMake: configure and build CUBEMXTESTING",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"CMake: configure"
],
"command": "cmake --build --preset ${command:cmake.activeBuildPresetName} --target CUBEMXTESTING"
},
{
"label": "CMake: configure and build CCU",
"type": "shell",
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ include("Autogen/CAN/CANfigurator.cmake")
include("${lib_path}/Peripherals/USART/common.cmake")
include("${lib_path}/Peripherals/TimedCAN/common.cmake")
include("${lib_path}/Peripherals/CAN/common.cmake")
include("${lib_path}/Peripherals/CubeCAN/cube_can.cmake")

include("${lib_path}/FancyLayers-RENAME/GRCAN/grcan_fancylayer.cmake")
include("${lib_path}/FancyLayers-RENAME/ADC/adc.cmake")
Expand All @@ -161,6 +162,7 @@ add_gr_project(STM32G474xE G4PERTESTING)
add_gr_project(STM32G474xE G4SPITESTING)
add_gr_project(STM32G474xE G4ADCTESTING)
add_gr_project(STM32G474xE G4NEOTESTING)
add_gr_project(STM32G474xE CUBEMXTESTING)

# CAN Peripheral Testing
add_gr_project(STM32G474xE G474xE_CAN_TESTING CAN_BASIC_TEST)
Expand Down
8 changes: 8 additions & 0 deletions CUBEMXTESTING/Application/Inc/CANdler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "CubeCAN.h"

#ifndef CANDLER_H
#define CANDLER_H

void CANdler_Callback(const CubeCAN_Config_Context *const context, const CAN_Identifier *const identifier, const uint8_t *const data, const uint8_t size);

#endif
7 changes: 7 additions & 0 deletions CUBEMXTESTING/Application/Inc/CubeCAN_Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef CUBE_CAN_CONFIG_H
#define CUBE_CAN_CONFIG_H

#define CUBEMX_CAN_TX_QUEUE_SIZE 16U
#define CUBEMX_CAN_MAX_INSTANCES 3U

#endif
6 changes: 6 additions & 0 deletions CUBEMXTESTING/Application/Inc/Loop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef LOOP_H
#define LOOP_H

void MainLoop(void);

#endif
27 changes: 27 additions & 0 deletions CUBEMXTESTING/Application/Src/CANdler.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "CANdler.h"

#include "CubeCAN.h"
#include "GRCAN_BUS_ID.h"
#include "GRCAN_MSG_ID.h"
#include "GRCAN_NODE_ID.h"
#include "Logomatic.h"

int value;

void CANdler_Callback(const CubeCAN_Config_Context *const context, const CAN_Identifier *const identifier, const uint8_t *const data, const uint8_t size)
{
value++;

if (context == NULL || identifier == NULL || data == NULL || size == 0) {
LOGOMATIC("CANdler_Callback: Invalid parameters received. context: %u, identifier: %p, data: %p, size: %u\n", context->busid_user_context, (void *const)identifier, (void *const)data,
size);
return;
}

const GRCAN_BUS_ID busid = context->busid_user_context;
const GRCAN_NODE_ID tx_node = identifier->tx_node_id;
const GRCAN_NODE_ID rx_node = identifier->rx_node_id;
const GRCAN_MSG_ID msg_id = identifier->msg_id;

LOGOMATIC("Received on bus %d with node %d -> %d with message %d and size %u\t%.*s\n", busid, tx_node, rx_node, msg_id, size, size, (const char *const)data);
}
20 changes: 20 additions & 0 deletions CUBEMXTESTING/Application/Src/Loop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Loop.h"

#include <inttypes.h>

#include "CubeCAN.h"
#include "GRCAN_MSG_ID.h"
#include "GRCAN_NODE_ID.h"
#include "Logomatic.h"
#include "main.h"

extern int value;

void MainLoop(void)
{
LL_GPIO_TogglePin(USER_LED_GPIO_Port, USER_LED_Pin);
LOGOMATIC("Main Loop %d %" PRIu32 "\n", value, HAL_GetTick());
(void)CubeCAN_Send(primaryHandle, GRCAN_Debugger, GRCAN_DEBUG_2_0, "Hello0", 6);
(void)CubeCAN_Send(dataHandle, GRCAN_Debugger, GRCAN_DEBUG_2_0, "Hello1", 6);
(void)CubeCAN_Send(chargerHandle, GRCAN_Debugger, GRCAN_DEBUG_2_0, "Hello2", 6);
}
51 changes: 51 additions & 0 deletions CUBEMXTESTING/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cmake_minimum_required(VERSION 3.25)

# Setup compiler settings
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)

# Define the build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

# Enable CMake support for ASM and C languages
enable_language(
C
ASM
)

# Core project settings
project(${CMAKE_PROJECT_NAME})

# what, does in fact not get the filename of somthing but rather the name of the project from the path
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)

add_library(${PROJECT_NAME}_USER_CODE INTERFACE)
target_sources(
${PROJECT_NAME}_USER_CODE
INTERFACE
Application/Src/CANdler.c
Application/Src/Loop.c
Core/Src/fdcan.c
Core/Src/gpio.c
Core/Src/main.c
Core/Src/stm32g4xx_it.c
Core/Src/tim.c
Core/Src/usart.c
)

target_link_libraries(
${PROJECT_NAME}_USER_CODE
INTERFACE
CUBE_CAN_LIB
LOGOMATIC_LIB
)

target_include_directories(
${PROJECT_NAME}_USER_CODE
INTERFACE
Core/Inc
Application/Inc
)
Loading
Loading