Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
99f55a8
REVERT ME --- Nucleo blinky demo
dchansen06 Jul 9, 2026
c2ddb0a
Revert "REVERT ME --- Nucleo blinky demo"
dchansen06 Jul 9, 2026
38504fb
Initial skeleton commit
dchansen06 Jul 10, 2026
06d4e89
Completely random test project
dchansen06 Jul 10, 2026
ccd3255
In progress --- Work on getting initial CAN peripheral abstraction co…
dchansen06 Jul 10, 2026
3a9bae0
In progress --- Resolve a few include errors
dchansen06 Jul 10, 2026
4ff8289
Add template from [Discord](https://discord.com/channels/756738476887…
dchansen06 Jul 15, 2026
db97ad3
New changes to template can_cfg_h.ftl; aimed to preserve user-changed…
TrainmanR Jul 15, 2026
4e6c644
Added comments to explain new functionality in the can_cfg_h.ftl temp…
TrainmanR Jul 15, 2026
d0b6d3f
Modify how we handle templates within the monorepo based on new infor…
dchansen06 Jul 16, 2026
31ed257
Modify line placement and ensure ordering has no precedence on broken…
dchansen06 Jul 16, 2026
2165e6d
Copy ftl from [Discord](https://discord.com/channels/7567384768876381…
dchansen06 Jul 16, 2026
e2f90e2
In progress --- Computer seconds from dying so it probably doesn't co…
dchansen06 Jul 16, 2026
4e2ae81
Timer Update
TrainmanR Jul 16, 2026
1f0324c
README_CAN_Timer_Configuration.md Added
TrainmanR Jul 17, 2026
b12e68f
Template Autogen Folders
TrainmanR Jul 19, 2026
3f3cb81
Critical section macro that needs testing still
dchansen06 Jul 19, 2026
0766e79
Critical section safe code
dchansen06 Jul 19, 2026
cd6d818
HOOTL testing of critical sections is very important
dchansen06 Jul 19, 2026
cdfcea8
Make variable names harder to accidentally cross
dchansen06 Jul 19, 2026
a2e00ba
Scripting for CubeMX Templates IOC Generation
TrainmanR Jul 20, 2026
95ac64b
Advanced critical section usage
dchansen06 Jul 19, 2026
c37742d
In progress --- Check point save while working with atomics
dchansen06 Jul 20, 2026
f3ba46a
Getting pretty close to a compiling build, needs timer integration work
dchansen06 Jul 21, 2026
a3ca31e
Further improvements to internal setup
dchansen06 Jul 23, 2026
7948dd8
Fix locking and atomics, and cleanup
dchansen06 Jul 23, 2026
b439bf2
Ensure proper handling of tick
dchansen06 Jul 23, 2026
029ec1b
Cleanup defines
dchansen06 Jul 23, 2026
71fc021
Redundancy checking on max instances
dchansen06 Jul 31, 2026
0f992f1
Remove templates, very broken sadly
dchansen06 Jul 31, 2026
4fe8f19
Harden testing of the critical section code
dchansen06 Jul 31, 2026
4c9dd0b
Harden CubeCAN
dchansen06 Jul 31, 2026
c3eed8a
Tweak CUBEMXTESTING to align with new pattern
dchansen06 Jul 31, 2026
cfb3238
Add helper oneshot functions, harden init
dchansen06 Jul 31, 2026
ad675b8
So much peripheral lockdown
dchansen06 Jul 31, 2026
db0cc42
Reorganize ownership patterns, finalize api
dchansen06 Jul 31, 2026
4d9b159
Remove tools
dchansen06 Jul 31, 2026
7d54de7
Peripheral schema rename
dchansen06 Jul 31, 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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"github.vscode-pull-request-github",
"eamodio.gitlens",
"davidanson.vscode-markdownlint",
"ms-vscode.vscode-serial-monitor"
"ms-vscode.vscode-serial-monitor",
"dcortes92.freemarker"
]
}
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(CubeCAN_Handle *const handle, void *const user_context);

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

#include "GRCAN_NODE_ID.h"
#include "main.h"

#define CUBEMX_CAN_TX_QUEUE_SIZE 32U
#define CUBEMX_SENDING_NODE_ID GRCAN_ECU

#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
8 changes: 8 additions & 0 deletions CUBEMXTESTING/Application/Inc/vcp_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef VCP_CONFIG
#define VCP_CONFIG

#define VCP_CONFIG_CLAIM_USART2

#define VCP_TX_BUFFER_SIZE 128

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

#include "CubeCAN.h"

void CANdler_Callback(CubeCAN_Handle *const handle, void *const user_context)
{
LOGOMATIC("CANdler_Callback: Received CAN message on handle %p with user context %p\n", (void *)handle, user_context);
// TODO
}
17 changes: 17 additions & 0 deletions CUBEMXTESTING/Application/Src/loop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "loop.h"

#include "Logomatic.h"
#include "main.h"

void MainLoop(void)
{
LL_GPIO_TogglePin(USER_LED_GPIO_Port, USER_LED_Pin);

if (LL_GPIO_IsInputPinSet(USER_BUTTON_GPIO_Port, USER_BUTTON_Pin)) {
LL_GPIO_SetOutputPin(USER_LED_GPIO_Port, USER_LED_Pin);
} else {
LL_GPIO_ResetOutputPin(USER_LED_GPIO_Port, USER_LED_Pin);
}

LOGOMATIC("Doing things!\n");
}
44 changes: 44 additions & 0 deletions CUBEMXTESTING/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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/loop.c
Core/Src/fdcan.c
Core/Src/gpio.c
Core/Src/main.c
Core/Src/stm32g4xx_it.c
Core/Src/tim.c
)

target_link_libraries(${PROJECT_NAME}_USER_CODE INTERFACE VCP_LIB CUBEMX_CAN_LIB LOGOMATIC_LIB)

target_include_directories(
${PROJECT_NAME}_USER_CODE
INTERFACE
Core/Inc
Application/Inc
)
199 changes: 199 additions & 0 deletions CUBEMXTESTING/CUBEMXTESTING.ioc
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
#MicroXplorer Configuration settings - do not modify
CAD.formats=[]
CAD.pinconfig=Dual
CAD.provider=
FDCAN1.AutoRetransmission=ENABLE
FDCAN1.CalculateBaudRateNominal=1000000
FDCAN1.CalculateTimeBitNominal=1000
FDCAN1.CalculateTimeQuantumNominal=6.25
FDCAN1.DataPrescaler=8
FDCAN1.DataSyncJumpWidth=16
FDCAN1.DataTimeSeg1=14
FDCAN1.DataTimeSeg2=5
FDCAN1.ExtFiltersNbr=2
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,NominalSyncJumpWidth,AutoRetransmission,ProtocolException,DataPrescaler,DataSyncJumpWidth,DataTimeSeg1,DataTimeSeg2,ExtFiltersNbr,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2
FDCAN1.NominalPrescaler=1
FDCAN1.NominalSyncJumpWidth=16
FDCAN1.NominalTimeSeg1=119
FDCAN1.NominalTimeSeg2=40
FDCAN1.ProtocolException=ENABLE
FDCAN2.AutoRetransmission=ENABLE
FDCAN2.CalculateBaudRateNominal=1000000
FDCAN2.CalculateTimeBitNominal=1000
FDCAN2.CalculateTimeQuantumNominal=6.25
FDCAN2.DataPrescaler=8
FDCAN2.DataSyncJumpWidth=16
FDCAN2.DataTimeSeg1=14
FDCAN2.DataTimeSeg2=5
FDCAN2.ExtFiltersNbr=2
FDCAN2.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataPrescaler,DataSyncJumpWidth,DataTimeSeg1,DataTimeSeg2,ExtFiltersNbr,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2
FDCAN2.NominalPrescaler=1
FDCAN2.NominalSyncJumpWidth=16
FDCAN2.NominalTimeSeg1=119
FDCAN2.NominalTimeSeg2=40
FDCAN2.ProtocolException=ENABLE
FDCAN3.CalculateBaudRateNominal=3333333
FDCAN3.CalculateTimeBitNominal=300
FDCAN3.CalculateTimeQuantumNominal=100.0
FDCAN3.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal
File.Version=6
GPIO.groupedBy=Group By Peripherals
KeepUserPlacement=false
Mcu.CPN=STM32G474RET6
Mcu.Family=STM32G4
Mcu.IP0=FDCAN1
Mcu.IP1=FDCAN2
Mcu.IP2=FDCAN3
Mcu.IP3=NVIC
Mcu.IP4=RCC
Mcu.IP5=SYS
Mcu.IP6=TIM5
Mcu.IPNb=7
Mcu.Name=STM32G474R(B-C-E)Tx
Mcu.Package=LQFP64
Mcu.Pin0=PC13
Mcu.Pin1=PA5
Mcu.Pin10=VP_TIM5_VS_ClockSourceINT
Mcu.Pin2=PB12
Mcu.Pin3=PB13
Mcu.Pin4=PA8
Mcu.Pin5=PA15
Mcu.Pin6=PB8-BOOT0
Mcu.Pin7=PB9
Mcu.Pin8=VP_SYS_VS_Systick
Mcu.Pin9=VP_SYS_VS_DBSignals
Mcu.PinsNb=11
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32G474RETx
MxCube.Version=6.18.0
MxDb.Version=DB.6.0.180
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.ForceEnableDMAVector=false
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
NVIC.TIM5_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA15.Mode=FDCAN_Activate
PA15.Signal=FDCAN3_TX
PA5.GPIOParameters=GPIO_Label
PA5.GPIO_Label=USER_LED
PA5.Locked=true
PA5.Signal=GPIO_Output
PA8.Mode=FDCAN_Activate
PA8.Signal=FDCAN3_RX
PB12.Mode=FDCAN_Activate
PB12.Signal=FDCAN2_RX
PB13.Mode=FDCAN_Activate
PB13.Signal=FDCAN2_TX
PB8-BOOT0.Mode=FDCAN_Activate
PB8-BOOT0.Signal=FDCAN1_RX
PB9.Mode=FDCAN_Activate
PB9.Signal=FDCAN1_TX
PC13.GPIOParameters=GPIO_Label
PC13.GPIO_Label=USER_BUTTON
PC13.Locked=true
PC13.Signal=GPIO_Input
PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=true
ProjectManager.BackupPrevious=false
ProjectManager.CompilerLinker=GCC
ProjectManager.CompilerOptimize=6
ProjectManager.ComputerToolchain=false
ProjectManager.CoupleFile=true
ProjectManager.CustomerFirmwarePackage=
ProjectManager.DefaultFWLocation=true
ProjectManager.DeletePrevious=true
ProjectManager.DeviceId=STM32G474RETx
ProjectManager.FirmwarePackage=STM32Cube FW_G4 V1.6.3
ProjectManager.FreePins=true
ProjectManager.FreePinsContext=
ProjectManager.HalAssertFull=true
ProjectManager.HeapSize=0x200
ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=2
ProjectManager.MainLocation=Core/Src
ProjectManager.NoMain=false
ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=CUBEMXTESTING.ioc
ProjectManager.ProjectName=CUBEMXTESTING
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=EWARM V8.50
ProjectManager.TemplateDestinationPath=C\:\\Users\\maxnm\\Firmware\\CUBEMXTESTING
ProjectManager.TemplateSourcePath=C\:\\Users\\maxnm\\Firmware\\Lib\\CubeMXTemplates
ProjectManager.TemplatesList=\\Autogen\\Inc\\can_cfg_h.ftl,
ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=false
ProjectManager.UseDefaultDestinationPath=true
ProjectManager.UseDefaultSourcePath=true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_FDCAN1_Init-FDCAN1-false-HAL-true,4-MX_FDCAN2_Init-FDCAN2-false-HAL-true,5-MX_TIM5_Init-TIM5-false-HAL-true,6-MX_FDCAN3_Init-FDCAN3-false-HAL-true
RCC.ADC12Freq_Value=160000000
RCC.ADC345Freq_Value=160000000
RCC.AHBFreq_Value=160000000
RCC.APB1Freq_Value=160000000
RCC.APB1TimFreq_Value=160000000
RCC.APB2Freq_Value=160000000
RCC.APB2TimFreq_Value=160000000
RCC.CRSFreq_Value=48000000
RCC.CortexFreq_Value=160000000
RCC.EXTERNAL_CLOCK_VALUE=12288000
RCC.FCLKCortexFreq_Value=160000000
RCC.FDCANFreq_Value=160000000
RCC.FamilyName=M
RCC.HCLKFreq_Value=160000000
RCC.HRTIM1Freq_Value=160000000
RCC.HSE_VALUE=16000000
RCC.HSI48_VALUE=48000000
RCC.HSI_VALUE=16000000
RCC.I2C1Freq_Value=160000000
RCC.I2C2Freq_Value=160000000
RCC.I2C3Freq_Value=160000000
RCC.I2C4Freq_Value=160000000
RCC.I2SFreq_Value=160000000
RCC.IPParameters=ADC12Freq_Value,ADC345Freq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CRSFreq_Value,CortexFreq_Value,EXTERNAL_CLOCK_VALUE,FCLKCortexFreq_Value,FDCANFreq_Value,FamilyName,HCLKFreq_Value,HRTIM1Freq_Value,HSE_VALUE,HSI48_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I2SFreq_Value,LPTIM1Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PWRFreq_Value,QSPIFreq_Value,RNGFreq_Value,SAI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value
RCC.LPTIM1Freq_Value=160000000
RCC.LPUART1Freq_Value=160000000
RCC.LSCOPinFreq_Value=32000
RCC.LSE_VALUE=32768
RCC.LSI_VALUE=32000
RCC.MCO1PinFreq_Value=16000000
RCC.PLLN=20
RCC.PLLPoutputFreq_Value=160000000
RCC.PLLQoutputFreq_Value=160000000
RCC.PLLRCLKFreq_Value=160000000
RCC.PWRFreq_Value=160000000
RCC.QSPIFreq_Value=160000000
RCC.RNGFreq_Value=160000000
RCC.SAI1Freq_Value=160000000
RCC.SYSCLKFreq_VALUE=160000000
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
RCC.UART4Freq_Value=160000000
RCC.UART5Freq_Value=160000000
RCC.USART1Freq_Value=160000000
RCC.USART2Freq_Value=160000000
RCC.USART3Freq_Value=160000000
RCC.USBFreq_Value=160000000
RCC.VCOInputFreq_Value=16000000
RCC.VCOOutputFreq_Value=320000000
TIM5.IPParameters=Prescaler,PeriodNoDither
TIM5.PeriodNoDither=999
TIM5.Prescaler=15999
VP_SYS_VS_DBSignals.Mode=DisableDeadBatterySignals
VP_SYS_VS_DBSignals.Signal=SYS_VS_DBSignals
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM5_VS_ClockSourceINT.Mode=Internal
VP_TIM5_VS_ClockSourceINT.Signal=TIM5_VS_ClockSourceINT
board=custom
58 changes: 58 additions & 0 deletions CUBEMXTESTING/Core/Inc/fdcan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file fdcan.h
* @brief This file contains all the function prototypes for
* the fdcan.c file
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __FDCAN_H__
#define __FDCAN_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern FDCAN_HandleTypeDef hfdcan1;

extern FDCAN_HandleTypeDef hfdcan2;

extern FDCAN_HandleTypeDef hfdcan3;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_FDCAN1_Init(void);
void MX_FDCAN2_Init(void);
void MX_FDCAN3_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __FDCAN_H__ */

Loading
Loading