Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35a9b0b
rebase protobuff branch to origin/main
pasinponsww Feb 21, 2026
e953300
rebase orgin/main
pasinponsww Feb 21, 2026
e853537
Fixing nano pb encode + decode package
pasinponsww Feb 24, 2026
af2951a
2/3 protobuff build + usart 2/3 implementation still need to fix
pasinponsww Feb 24, 2026
ea8fd61
build protobuff pass + usart support (need testing)
pasinponsww Feb 25, 2026
bbd4830
rebase to origin/main + protbuff restructure + test
pasinponsww Apr 19, 2026
75b297b
protobuffer generated now I need to automated the network
pasinponsww Apr 20, 2026
f4cdabd
i/cd fix
pasinponsww Apr 20, 2026
7111a12
ci don't work
pasinponsww Apr 20, 2026
e8d5d55
Fix structure; need to fix build error
pasinponsww Apr 22, 2026
4751e0c
good structure
pasinponsww Apr 24, 2026
113ac8d
helper folder for telemetry packaging + rewrite the pipeline to add m…
pasinponsww Apr 27, 2026
36f46fe
adding draft priv functions + logic in send/recieve pipeline
pasinponsww Apr 27, 2026
6087827
normalized cmake
pasinponsww Jun 6, 2026
5ed2999
add todo-list
pasinponsww Jun 6, 2026
514f655
new changes: msg struct refactor, reconstruct the telemetry pipe
pasinponsww Jun 8, 2026
c42eea5
ci/cd fix + format_check ignore pb.c/pb.h
pasinponsww Jun 8, 2026
b2bc575
clangd fix:
pasinponsww Jun 8, 2026
c216bbb
fix dependencies
pasinponsww Jun 8, 2026
ad415ed
rebase; remove telem hot-fix
pasinponsww Jun 13, 2026
7fd7171
remove telemetry in cmake
pasinponsww Jun 13, 2026
bb9749e
refactor usart-pipe; main.cc new test; crc frame
pasinponsww Jun 13, 2026
e52fe36
rm todo.md
pasinponsww Jun 13, 2026
72c1c9c
refactor pipe-logic + re-frame
pasinponsww Jun 17, 2026
accaf12
refactor 2.0
pasinponsww Jun 17, 2026
43676a8
hot-fix-review & delayMs replacement
pasinponsww Jun 19, 2026
8b6c424
fix include cstdint
pasinponsww Jun 20, 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
12 changes: 11 additions & 1 deletion .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
run: |
git submodule update --init --recursive

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
Expand Down Expand Up @@ -108,6 +113,11 @@ jobs:
run: |
git submodule update --init --recursive

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler

- name: Configure CMake for testing
run: |
cmake --preset=native -DTARGET_APP="" -DCMAKE_BUILD_TYPE="Debug"
Expand All @@ -116,4 +126,4 @@ jobs:
run: cd build/native && cmake --build .

- name: Run GTest unit tests
run: cd build/native && ctest
run: cd build/native && ctest
40 changes: 32 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,36 @@
},
{
"cwd": "${workspaceFolder}",
"executable": "${workspaceRoot}/build/stm32h723/app/sysclk_test/sysclk_test",
"name": "DEBUG SYSCLK H7",
"executable": "${workspaceRoot}/build/stm32h723/app/nanopb_test/nanopb_test",
"name": "DEBUG NANOPB TEST",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"device": "STM32H7",
"svdFile": "${workspaceRoot}/mcu_support/h7xx/STM32H723.svd",
"searchDir": ["${workspaceRoot}/mcu_support/stm32"],
"runToMain": true,
"configFiles": [
"${workspaceRoot}/mcu_support/stm32/stlink-dap.cfg",
"${workspaceRoot}/mcu_support/stm32/h7xx/stm32h7x.cfg"
],
"debuggerArgs": ["-d", "${workspaceRoot}"],
"preRestartCommands": [
"add-symbol-file build/stm32h723/app/nanopb_test/nanopb_test",
"load",
"enable breakpoint",
"monitor reset"
],
"showDevDebugOutput": true,
"liveWatch": {
"enabled": true,
"samplesPerSecond": 2
}
},
{
"cwd": "${workspaceFolder}",
"executable": "${workspaceRoot}/build/stm32h723/app/nanopb_test/nanopb_test.elf",
"name": "DEBUG DATA PIPE H7",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
Expand All @@ -524,16 +552,12 @@
"${workspaceRoot}"
],
"preRestartCommands": [
"add-symbol-file build/stm32h723/app/sysclk_test/sysclk_test",
"add-symbol-file build/stm32h723/app/nanopb_test/nanopb_test.elf",
"load",
"enable breakpoint",
"monitor reset"
],
"showDevDebugOutput": true,
"liveWatch": {
"enabled": true,
"samplesPerSecond": 2
}
"showDevDebugOutput": true
},
{
"cwd": "${workspaceFolder}",
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ endif()

add_subdirectory(common)
add_subdirectory(external)
add_subdirectory(mcu_support)
add_subdirectory(mcu_support)
3 changes: 2 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ add_subdirectory(i2c_test)
add_subdirectory(bmp390_test)
add_subdirectory(imu_test)
add_subdirectory(w25q_test)
add_subdirectory(usart_app)
Comment thread
pasinponsww marked this conversation as resolved.
add_subdirectory(pwm_test)
add_subdirectory(crc_test)
add_subdirectory(sysclk_test)
add_subdirectory(usart_app)
add_subdirectory(usart_pipe_test)
5 changes: 2 additions & 3 deletions app/bmp390_test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <span>
#include "bmp390.h"
#include "board.h"
#include "delay.h"

using namespace LBR;

Expand All @@ -19,9 +20,7 @@ int main(int argc, char* argv[])

printf("Pressure: %f\nTemperature: %f\n", press, temp);

for (volatile size_t i = 0; i < 100000; i++)
{
}
Utils::DelayMs(800);
}

return 0;
Expand Down
20 changes: 10 additions & 10 deletions app/crc_test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ int main(int argc, char* argv[])

hw.crc.compare(std::span(data8_1), kActualCrc_1);
hw.usart.send(data8_1);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

hw.crc.compare(std::span(data8_2), kActualCrc_2);
hw.usart.send(data8_2);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

/* uint16_t test */

hw.crc.compare(std::span(data16_1), kActualCrc_1);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

hw.crc.compare(std::span(data16_2), kActualCrc_2);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

/* uint32_t test */

hw.crc.compare(std::span(data32_1), kActualCrc_1);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

hw.crc.compare(std::span(data32_2), kActualCrc_2);
for (volatile uint32_t i = 0; i < 100000; i++);
LBR::Utils::DelayMs(100);

while (1)
{
Expand All @@ -76,13 +76,13 @@ int main(int argc, char* argv[])
hw.usart.send(string);

// Busy wait
for (volatile uint32_t i = 0; i < 1000000; i++);
Utils::DelayMs(100);

std::array<uint8_t, 20> resultb{"\r\nCrc result: "};
hw.usart.send(resultb);

// Busy wait
for (volatile uint32_t i = 0; i < 1000000; i++);
Utils::DelayMs(100);

std::array<uint8_t, 1> crcb{hw.crc.compare(string, crc_result) ? 'o'
: 'x'
Expand All @@ -91,13 +91,13 @@ int main(int argc, char* argv[])
hw.usart.send(crcb);

// Busy wait
for (volatile uint32_t i = 0; i < 1000000; i++);
Utils::DelayMs(100);

std::array<uint8_t, 4> endb{"\r\n"};
hw.usart.send(endb);

// Busy wait
for (volatile uint32_t i = 0; i < 1000000; i++);
Utils::DelayMs(100);
}
}

Expand Down
6 changes: 2 additions & 4 deletions app/i2c_test/main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <cstdlib>
#include <span>
#include "board.h"
#include "delay.h"
#include "i2c.h"

using namespace LBR;
Expand All @@ -20,10 +21,7 @@ int main(int argc, char* argv[])
while (1)
{
hw.i2c.mem_read(chip_id, reg_addr, dev_addr);

for (volatile size_t i = 0; i < 100000; i++)
{
}
Utils::DelayMs(1000);
}

return 0;
Expand Down
1 change: 1 addition & 0 deletions app/pwm_test/main.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <cstdlib>
#include "board.h"
#include "delay.h"
#include "pwm.h"

using namespace LBR;
Expand Down
1 change: 0 additions & 1 deletion app/sysclk_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(PREPROCESS_DEFS
-DDEF_FLASH_SIZE=1024K
)

add_subdirectory_for(STM32L476 bsp_l476)
add_subdirectory_for(STM32H723 bsp_h723)

if (TARGET sysclk_bsp)
Expand Down
1 change: 1 addition & 0 deletions app/usart_app/BSP_L476/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ target_link_libraries(usart_app_bsp
PUBLIC
driver
)

3 changes: 2 additions & 1 deletion app/usart_app/BSP_L476/usart_app_bsp.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <cstdint>
#include "board.h"
#include "st_gpio.h"
#include "st_sys_clock.h"
Expand Down Expand Up @@ -65,4 +66,4 @@ extern "C" void USART2_IRQHandler(void)
}
}
}
} // namespace LBR
} // namespace LBR
1 change: 0 additions & 1 deletion app/usart_app/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace LBR
struct Board
{
Usart& usart;

Gpio& rx;
Gpio& tx;
};
Expand Down
14 changes: 14 additions & 0 deletions app/usart_pipe_test/BSP_H723/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_library(usart_pipe_test_bsp STATIC
h723_board.cc
)

target_include_directories(usart_pipe_test_bsp PUBLIC
.
../
)

target_link_libraries(usart_pipe_test_bsp
PUBLIC
driver
pipeline
)
95 changes: 95 additions & 0 deletions app/usart_pipe_test/BSP_H723/h723_board.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include "board.h"
#include "st_crc.h"
#include "st_gpio.h"
#include "st_usart.h"

using namespace LBR::Stmh7;

namespace LBR
{

// CRC-32/BZIP2
static constexpr uint32_t kPoly{0x4C11DB7};
static constexpr uint32_t kInit{CRC_INIT_INIT};
static constexpr uint32_t kXorOut{0xFFFFFFFF};

StCrcSettings crc_settings{CrcRevOut::NO_REV, CrcRevIn::NO_REV,
CrcPolySize::BIT_SIZE_32};
StCrcParams crc_params{crc_settings, CRC, kInit, kPoly, kXorOut};
HwCrc crc{crc_params};

StGpioSettings tx_config = {GpioMode::ALT_FUNC, GpioOtype::PUSH_PULL,
GpioOspeed::LOW, GpioPupd::NO_PULL, 0x7};
StGpioSettings rx_config = {GpioMode::ALT_FUNC, GpioOtype::PUSH_PULL,
GpioOspeed::LOW, GpioPupd::NO_PULL, 0x7};

StGpioParams tx_params = {tx_config, (uint8_t)8, GPIOD};
StGpioParams rx_params = {rx_config, (uint8_t)9, GPIOD};

HwGpio tx_gpio{tx_params};
HwGpio rx_gpio{rx_params};

StUsartParams usart_params = {USART3, 64000000, 115200};
StUsart usart{usart_params};

Pipeline pipeline{crc};

uint8_t rxb;

Board board{.usart = usart,
.rx = rx_gpio,
.tx = tx_gpio,
.crc = crc,
.pipeline = pipeline};

bool bsp_init()
{
bool ret = true;

RCC->AHB4ENR |= RCC_AHB4ENR_CRCEN | RCC_AHB4ENR_GPIODEN;
RCC->APB1LENR |= RCC_APB1LENR_USART3EN;

/* Timestamp in microsecond specific configs */

// Enable DWT cycle counter for hardware microsecond timestamps
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;

// Configure SysTick for 1 ms timebase so Utils::DelayMs() works
SysTick_Config(SystemCoreClock / 1000);

/* Will strip away when testing is good */

ret &= crc.init();
ret &= tx_gpio.init();
ret &= rx_gpio.init();
ret &= usart.init();

// No NVIC for USART3 — pipeline.receive() polls the USART directly.
// Enabling the ISR here would consume RX bytes before poll_usart() can see them.

return ret;
}

/* I will make a helper and throw this in utils (delay.h) */
/* The current function get timestamp in microseconds */
uint32_t get_us()
{
// DWT->CYCCNT wraps at ~67s @ 64 MHz — fine for loopback timing
return DWT->CYCCNT / (SystemCoreClock / 1000000UL);
}

Board& get_board()
{
return board;
}

extern "C" void IncDelayTicks(void);

extern "C" void SysTick_Handler(void)
{
IncDelayTicks();
}

} // namespace LBR
33 changes: 33 additions & 0 deletions app/usart_pipe_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
set(EXECUTABLE usart_pipe_test)
set(LDF ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}.ld)

set(PREPROCESS_DEFS
-DDEF_FLASH_START_ADDR=0x8000000
-DDEF_FLASH_SIZE=1024K
)

add_subdirectory_for(STM32H723 BSP_H723)

if (TARGET usart_pipe_test_bsp)

add_executable_for(${TARGET_DEVICE} ${EXECUTABLE} ${LDF}
main.cc
${STARTUP_FILE}
)

target_include_directories_for(STM32H723 ${EXECUTABLE}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/BSP_H723
)

target_link_libraries_for(${TARGET_DEVICE} ${EXECUTABLE} PRIVATE
usart_pipe_test_bsp
core
network
protobuff
pb_cmd
)

target_preprocess_for(${TARGET_DEVICE} ${EXECUTABLE} ${LINKER_SCRIPT} ${LDF} ${PREPROCESS_DEFS})

endif()
Loading
Loading