Skip to content
Open

DFSDM #614

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
90ca98e
add all enums needed, I hope
oganigl Jan 28, 2026
8732116
CLK finished, half way from finishing DFSDM.HPP
oganigl Feb 13, 2026
3445aa2
First total draft of dfsdm finished
oganigl Feb 27, 2026
4f13110
Merge branch 'development' into feat/DFSDM
oganigl Feb 27, 2026
fd1b967
fix some errors from the merge, mia culpa
oganigl Feb 27, 2026
894d60e
eliminate right bit shift in execution time
oganigl Feb 27, 2026
e8216f7
added some changes to compile clk
oganigl Feb 28, 2026
5cc4af8
change a bit of AF in PB0 for dfsdm_clk_out
oganigl Feb 28, 2026
27f2b93
clock works for every possible pin
oganigl Feb 28, 2026
71661b1
added a config, you're welcome Boris
oganigl Mar 1, 2026
7b07dcd
compiles let's see if it works
oganigl Mar 1, 2026
342c9a9
add buffer and callbacks in compile time
oganigl Mar 4, 2026
6c67c0c
some more changes in the dfsdm
oganigl Mar 6, 2026
12d51ca
fix some minor errors
oganigl Mar 6, 2026
691b396
add again max_instances
oganigl Mar 6, 2026
0cb2cbe
Add dma safety, not implemented yet
oganigl Mar 6, 2026
412e133
Masinstances updated to max_instances
oganigl Mar 6, 2026
22ab26d
now the callbacks works
oganigl Mar 6, 2026
0e0235b
some more more changes
oganigl Mar 7, 2026
fbfc0d6
the trigger works gg
oganigl Mar 8, 2026
574abd8
okay this might work
oganigl Mar 9, 2026
63cb9e8
okay dma works, something to look is how to allow to use the 16 entri…
oganigl Mar 14, 2026
457a791
dma tested, don't ask how, don't ask why but it works fine. Or at lea…
oganigl Mar 14, 2026
dfd5340
Robust TCP/IP Hardening (#582)
jorgesg82 Mar 2, 2026
2dfdf38
Prescaler was not initialized in init (#584)
Cantonplas Mar 4, 2026
3a12e39
Fix/scheduler timerdomain (#585)
victor-Lopez25 Mar 4, 2026
47efb88
Fixed issues with MSVC on windows in tests (#583)
victor-Lopez25 Mar 4, 2026
9cfa240
Fix: rcc_enable_timer for scheduler timer (#586)
victor-Lopez25 Mar 5, 2026
10688b5
Feat/no virtual on State Machine (#581)
Cantonplas Mar 13, 2026
b5846fd
fix(MDMA): Fix, MDMA AHBS is 32-bit only (#588)
FoniksFox Mar 15, 2026
cc4e9bc
Fix Scheduler race conditions (#591)
victor-Lopez25 Mar 15, 2026
24738ff
Max out ARR for encoder (#587)
victor-Lopez25 Mar 16, 2026
5cbb065
Hotfix/sched register b4 start (#593)
victor-Lopez25 Mar 16, 2026
21bc1b8
Change the frequency if this can be called frequency of the leds (#580)
oganigl Mar 20, 2026
1466802
Releases are back bitches (#596)
jorgesg82 Mar 20, 2026
c088c60
merge development to main
oganigl Mar 22, 2026
683b056
compiles, but not tested
oganigl Mar 25, 2026
12a4c0f
OKay tested this works fine with dma and without.
oganigl Mar 26, 2026
0e3d73b
readme version
oganigl Mar 26, 2026
8683e31
indentation done
oganigl Mar 26, 2026
9df3168
change start() to static functions
oganigl Mar 26, 2026
18705ce
add more safety
oganigl Mar 26, 2026
2ed7947
Merge branch 'development' into feat/DFSDM
oganigl Mar 29, 2026
80be128
change changeset
oganigl Mar 29, 2026
c06bd0f
Remove duplicity
oganigl Mar 29, 2026
7af2239
add indentation for 14 time
oganigl Mar 29, 2026
969f5d9
add defines for the simulator
oganigl Mar 29, 2026
7fc4709
modify stm32.cmake so everyone can use it and not only people with an…
oganigl Mar 29, 2026
50cff63
done again changes do to indentation
oganigl Mar 29, 2026
bd0a760
change for clarity
oganigl Apr 1, 2026
ef7edd0
change for clarity
oganigl Apr 1, 2026
9d39767
more changes done
oganigl Apr 1, 2026
8530a9f
fuck code was right
oganigl Apr 1, 2026
dcc1634
eliminate an array that is not used
oganigl Apr 1, 2026
75c3154
merge development
oganigl Apr 1, 2026
afa5f24
test dfdsm creo que no se puede llamar ni vibe coding, se debería de …
oganigl Apr 1, 2026
c8261ad
feat(DFSDM): Re-add DFSDM_CLK_DOMAIN tests (13 tests)
oganigl Apr 1, 2026
97681aa
add fucking iindent
oganigl Apr 1, 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 .changesets/dfsdm-module-minor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
release: minor
summary: Added module dfsdm tested
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ set(HALAL_CPP_NO_ETH
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Time/RTC.cpp
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Time/Scheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/Watchdog/Watchdog.cpp
${CMAKE_CURRENT_LIST_DIR}/Src/HALAL/Services/DFSDM/DFSDM.cpp
)


Expand Down
2 changes: 2 additions & 0 deletions Inc/HALAL/HALAL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include "HALAL/Models/Packets/MdmaPacket.hpp"

#include "HALAL/Benchmarking_toolkit/DataWatchpointTrace/DataWatchpointTrace.hpp"

#include "HALAL/Services/DFSDM/DFSDM.hpp"
#include "HALAL/HardFault/HardfaultTrace.h"
#include "HALAL/Services/Communication/Ethernet/NewEthernet.hpp"
#ifdef STLIB_ETH
Expand Down
34 changes: 30 additions & 4 deletions Inc/HALAL/Models/DMA/DMA2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ struct DMADomain {
spi4,
spi5,
spi6,
fmac
fmac,
dfsdm_filter0,
dfsdm_filter1,
dfsdm_filter2,
dfsdm_filter3
};

enum class Stream : uint8_t {
Expand Down Expand Up @@ -98,7 +102,7 @@ struct DMADomain {
}
return nullptr;
}

static inline consteval bool shares_dma(Peripheral p) { return is_dfsdm(p); }
struct Entry {
Peripheral instance;
Stream stream;
Expand Down Expand Up @@ -217,6 +221,16 @@ struct DMADomain {

static consteval bool is_none(Peripheral instance) { return instance == Peripheral::none; }

static consteval bool is_dfsdm(Peripheral instance) {
return is_one_of(
instance,
Peripheral::dfsdm_filter0,
Peripheral::dfsdm_filter1,
Peripheral::dfsdm_filter2,
Peripheral::dfsdm_filter3
);
}

static consteval uint32_t get_Request(Peripheral instance, uint8_t i) {
if (instance == Peripheral::none)
return DMA_REQUEST_MEM2MEM;
Expand Down Expand Up @@ -272,8 +286,20 @@ struct DMADomain {
return DMA_REQUEST_FMAC_WRITE;
if (instance == Peripheral::fmac && i == 2)
return DMA_REQUEST_FMAC_READ;

if (instance == Peripheral::dfsdm_filter0) {
return DMA_REQUEST_DFSDM1_FLT0;
}
if (instance == Peripheral::dfsdm_filter1) {
return DMA_REQUEST_DFSDM1_FLT1;
}
if (instance == Peripheral::dfsdm_filter2) {
return DMA_REQUEST_DFSDM1_FLT2;
}
if (instance == Peripheral::dfsdm_filter3) {
return DMA_REQUEST_DFSDM1_FLT3;
}
compile_error("Invalid DMA request configuration");

return 0;
}

Expand Down Expand Up @@ -303,7 +329,7 @@ struct DMADomain {
static consteval uint32_t get_PeriphDataAlignment(Peripheral instance, uint8_t i) {
if (is_spi(instance) || is_i2c(instance)) {
return DMA_PDATAALIGN_BYTE;
} else if (is_none(instance)) {
} else if (is_none(instance) || (is_dfsdm(instance))) {
return DMA_PDATAALIGN_WORD;
}
return DMA_PDATAALIGN_HALFWORD;
Expand Down
74 changes: 59 additions & 15 deletions Inc/HALAL/Models/TimerDomain/TimerDomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,32 @@ enum TimerRequest : uint8_t {
Basic_6 = 6,
Basic_7 = 7,
};
enum class SelectionTrigger1 : uint32_t {
Reset = TIM_TRGO_RESET,
Enable = TIM_TRGO_ENABLE,
Update = TIM_TRGO_UPDATE,
General_Compare = TIM_TRGO_OC1,
Compare_channel1 = TIM_TRGO_OC1REF,
Compare_channel2 = TIM_TRGO_OC2REF,
Compare_channel3 = TIM_TRGO_OC3REF,
Compare_channel4 = TIM_TRGO_OC4REF
};
enum class SelectionTrigger2 : uint32_t {
Reset = TIM_TRGO2_RESET,
Enable = TIM_TRGO2_ENABLE,
Update = TIM_TRGO2_UPDATE,
General_Compare = TIM_TRGO2_OC1,
Compare_channel1 = TIM_TRGO2_OC1REF,
Compare_channel2 = TIM_TRGO2_OC2REF,
Compare_channel3 = TIM_TRGO2_OC3REF,
Compare_channel4 = TIM_TRGO2_OC4REF,
Compare_channel5 = TIM_TRGO2_OC5REF,
Compare_channel6 = TIM_TRGO2_OC6REF,
Compare_channel4_R_channel6_F = TIM_TRGO2_OC4REF_RISING_OC6REF_FALLING,
Compare_channel4_R_channel6_R = TIM_TRGO2_OC4REF_RISING_OC6REF_RISING,
Compare_channel5_R_channel6_F = TIM_TRGO2_OC5REF_RISING_OC6REF_FALLING,
Compare_channel5_R_channel6_R = TIM_TRGO2_OC5REF_RISING_OC6REF_RISING
};

// Alternate functions for timers
enum class TimerAF {
Expand Down Expand Up @@ -261,10 +287,14 @@ struct TimerDomain {
TimerRequest request;
uint8_t pin_count;
std::array<TimerPin, 7> pins; /* this won't be read in Timer constructor */
SelectionTrigger1 trgo1{SelectionTrigger1::Reset};
SelectionTrigger2 trgo2{SelectionTrigger2::Reset};
};

struct Config {
uint8_t timer_idx;
SelectionTrigger1 trgo1;
SelectionTrigger2 trgo2;
};

static constexpr TIM_HandleTypeDef* hal_handles[16] = { // general purpose timers
Expand Down Expand Up @@ -498,15 +528,17 @@ struct TimerDomain {
: e(ent.name,
ent.request,
sizeof...(pinargs),
std::array<TimerPin, 7>(
{GetPinFromIdx(pinargs, 0),
GetPinFromIdx(pinargs, 1),
GetPinFromIdx(pinargs, 2),
GetPinFromIdx(pinargs, 3),
GetPinFromIdx(pinargs, 4),
GetPinFromIdx(pinargs, 5),
GetPinFromIdx(pinargs, 6)}
)),
std::array<TimerPin, 7>({
GetPinFromIdx(pinargs, 0),
GetPinFromIdx(pinargs, 1),
GetPinFromIdx(pinargs, 2),
GetPinFromIdx(pinargs, 3),
GetPinFromIdx(pinargs, 4),
GetPinFromIdx(pinargs, 5),
GetPinFromIdx(pinargs, 6),
}),
ent.trgo1,
ent.trgo2),
gpio0(GetGPIOFromIdx(pinargs, ent.request, 0)),
gpio1(GetGPIOFromIdx(pinargs, ent.request, 1)),
gpio2(GetGPIOFromIdx(pinargs, ent.request, 2)),
Expand Down Expand Up @@ -551,6 +583,8 @@ struct TimerDomain {
.request = e.request,
.pin_count = e.pin_count,
.pins = e.pins,
.trgo1 = e.trgo1,
.trgo2 = e.trgo2
};
ctx.template add<TimerDomain>(local_entry, this);
}
Expand Down Expand Up @@ -604,6 +638,8 @@ struct TimerDomain {

Config cfg = {
.timer_idx = timer_idxmap[reqint],
.trgo1 = requests[i].trgo1,
.trgo2 = requests[i].trgo2
};
cfgs[cfg_idx++] = cfg;

Expand Down Expand Up @@ -634,9 +670,8 @@ struct TimerDomain {
}

uint8_t reqint = remaining_32bit_timers[count_32bit_requests];
Config cfg = {
.timer_idx = timer_idxmap[reqint],
};
Config cfg =
{.timer_idx = timer_idxmap[reqint], .trgo1 = e.trgo1, .trgo2 = e.trgo2};
cfgs[cfg_idx++] = cfg;

// unordered remove
Expand Down Expand Up @@ -683,9 +718,7 @@ struct TimerDomain {
ST_LIB::compile_error("This only processes TimerRequest::AnyGeneralPurpose");
}
uint8_t reqint = remaining_timers[i];
Config cfg = {
.timer_idx = timer_idxmap[reqint],
};
Config cfg = {.timer_idx = timer_idxmap[reqint], .trgo1 = e.trgo1, .trgo2 = e.trgo2};
cfgs[cfg_idx++] = cfg;
}

Expand All @@ -696,6 +729,7 @@ struct TimerDomain {
struct Instance {
TIM_TypeDef* tim;
TIM_HandleTypeDef* hal_tim;
TIM_MasterConfigTypeDef master{};
uint8_t timer_idx;
};

Expand Down Expand Up @@ -737,6 +771,7 @@ struct TimerDomain {

TIM_HandleTypeDef* handle = hal_handles[e.timer_idx];
TIM_TypeDef* tim = cmsis_timers[e.timer_idx];

handle->Instance = tim;
handle->Init.Period = 0;
handle->Init.Prescaler = 0;
Expand Down Expand Up @@ -766,6 +801,15 @@ struct TimerDomain {
inst->tim = tim;
inst->hal_tim = handle;
inst->timer_idx = e.timer_idx;
TIM_MasterConfigTypeDef sMasterConfig = {};
sMasterConfig.MasterOutputTrigger = static_cast<uint32_t>(e.trgo1);
sMasterConfig.MasterOutputTrigger2 = static_cast<uint32_t>(e.trgo2);
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
inst->master = sMasterConfig;
if (HAL_TIMEx_MasterConfigSynchronization(inst->hal_tim, &sMasterConfig) !=
HAL_OK) {
ErrorHandler("Unable to configure master synch");
}
}
}
};
Expand Down
Loading
Loading