-
Notifications
You must be signed in to change notification settings - Fork 1
bs-usartpipe #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pasinponsww
wants to merge
27
commits into
main
Choose a base branch
from
bs-usartpipe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
bs-usartpipe #129
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 e953300
rebase orgin/main
pasinponsww e853537
Fixing nano pb encode + decode package
pasinponsww af2951a
2/3 protobuff build + usart 2/3 implementation still need to fix
pasinponsww ea8fd61
build protobuff pass + usart support (need testing)
pasinponsww bbd4830
rebase to origin/main + protbuff restructure + test
pasinponsww 75b297b
protobuffer generated now I need to automated the network
pasinponsww f4cdabd
i/cd fix
pasinponsww 7111a12
ci don't work
pasinponsww e8d5d55
Fix structure; need to fix build error
pasinponsww 4751e0c
good structure
pasinponsww 113ac8d
helper folder for telemetry packaging + rewrite the pipeline to add m…
pasinponsww 36f46fe
adding draft priv functions + logic in send/recieve pipeline
pasinponsww 6087827
normalized cmake
pasinponsww 5ed2999
add todo-list
pasinponsww 514f655
new changes: msg struct refactor, reconstruct the telemetry pipe
pasinponsww c42eea5
ci/cd fix + format_check ignore pb.c/pb.h
pasinponsww b2bc575
clangd fix:
pasinponsww c216bbb
fix dependencies
pasinponsww ad415ed
rebase; remove telem hot-fix
pasinponsww 7fd7171
remove telemetry in cmake
pasinponsww bb9749e
refactor usart-pipe; main.cc new test; crc frame
pasinponsww e52fe36
rm todo.md
pasinponsww 72c1c9c
refactor pipe-logic + re-frame
pasinponsww accaf12
refactor 2.0
pasinponsww 43676a8
hot-fix-review & delayMs replacement
pasinponsww 8b6c424
fix include cstdint
pasinponsww File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ target_link_libraries(usart_app_bsp | |
| PUBLIC | ||
| driver | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ namespace LBR | |
| struct Board | ||
| { | ||
| Usart& usart; | ||
|
|
||
| Gpio& rx; | ||
| Gpio& tx; | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.