Skip to content

Commit

Permalink
Merge pull request #10 from AllenNeuralDynamics/dev/updated_harp_time
Browse files Browse the repository at this point in the history
Non-deterministic AUX UART fix
  • Loading branch information
Poofjunior authored Sep 18, 2024
2 parents 45eacfc + d7f34bb commit 2954fdc
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 96 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "firmware/lib/harp.core.rp2040"]
path = firmware/lib/harp.core.rp2040
url = [email protected]:AllenNeuralDynamics/harp.core.rp2040.git
[submodule "firmware/lib/pico.async-uart"]
path = firmware/lib/pico.async-uart
url = [email protected]:AllenNeuralDynamics/pico.async-uart.git
16 changes: 9 additions & 7 deletions firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ add_definitions(-DGIT_HASH="${COMMIT_ID}") # Usable in source code.
#add_definitions(-DDEBUG) # Uncomment for debugging


#set(PICO_PLATFORM rp2040) # rp2040 is the default.

# PICO_SDK_PATH must be defined.
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)

Expand All @@ -16,14 +18,14 @@ set(CMAKE_CXX_STANDARD 17)
# Enable try/catch exception interface.
#set(PICO_CXX_ENABLE_EXCEPTIONS 1)

#set(PICO_COPY_TO_RAM 1)

project(white_rabbit)

pico_sdk_init()
add_subdirectory(lib/harp.core.rp2040/firmware) # Path to harp.core.rp2040.

add_library(uart_nonblocking
src/uart_nonblocking.cpp
)
add_subdirectory(lib/harp.core.rp2040/firmware) # Path to harp.core.rp2040.
add_subdirectory(lib/pico.async-uart) # Path to uart_nonblocking and soft_uart

add_library(white_rabbit_app
src/white_rabbit_app.cpp
Expand All @@ -35,12 +37,12 @@ add_executable(${PROJECT_NAME}

include_directories(inc)

target_link_libraries(uart_nonblocking hardware_dma hardware_timer pico_stdlib)
target_link_libraries(white_rabbit_app harp_core harp_c_app harp_sync
hardware_divider pico_stdlib uart_nonblocking hardware_dma)
hardware_divider pico_stdlib uart_nonblocking pio_uart
hardware_pio hardware_dma soft_uart)

target_link_libraries(${PROJECT_NAME} harp_core harp_c_app harp_sync pico_stdlib
hardware_dma hardware_timer uart_nonblocking
hardware_dma hardware_timer uart_nonblocking pio_uart
white_rabbit_app)

pico_add_extra_outputs(${PROJECT_NAME})
Expand Down
2 changes: 1 addition & 1 deletion firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/ma
The SDK needs to be downloaded and installed to a known folder on your PC.
Note that the PICO SDK also contains submodules (including TinyUSB), so you must ensure that they are also fetched with:
````
git clone git clone git@github.com:raspberrypi/pico-sdk.git
git clone [email protected]:raspberrypi/pico-sdk.git
git submodule update --init --recursive
````

Expand Down
5 changes: 2 additions & 3 deletions firmware/inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define FW_VERSION_MAJOR (0)
#define FW_VERSION_MINOR (1)
#define FW_VERSION_PATCH (1)
#define FW_VERSION_PATCH (2)


#define HARP_CORE_LED_PIN (25)
Expand Down Expand Up @@ -40,8 +40,7 @@
#define MAX_AUX_SYNC_BAUDRATE (1'000'000UL) // Aux Baud rate should be slower
// than this value.
#define AUX_PIN (0)
#define AUX_SYNC_START_OFFSET_US (0) // Offset from spec to account for
// transmission time.
#define AUX_SYNC_START_OFFSET_US (0)

#define LED0_PIN (24)
#define LED1_PIN (25)
Expand Down
13 changes: 0 additions & 13 deletions firmware/inc/uart_nonblocking.h

This file was deleted.

3 changes: 2 additions & 1 deletion firmware/inc/white_rabbit_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <harp_c_app.h>
#include <harp_synchronizer.h>
#include <uart_nonblocking.h>
#include <soft_uart.h>
#include <core_registers.h>
#include <pico/divider.h> // for fast hardware division.
#ifdef DEBUG
Expand All @@ -34,7 +35,7 @@ const size_t REG_COUNT{5};

// pre-computed value for when to emit periodic counter msgs.
extern uint32_t counter_interval_us;
extern uint32_t last_msg_emit_time_us;
extern uint64_t last_msg_emit_time_us;
extern bool was_synced;

#pragma pack(push, 1)
Expand Down
2 changes: 1 addition & 1 deletion firmware/lib/harp.core.rp2040
1 change: 1 addition & 0 deletions firmware/lib/pico.async-uart
Submodule pico.async-uart added at d66fa5
28 changes: 0 additions & 28 deletions firmware/src/uart_nonblocking.cpp

This file was deleted.

Loading

0 comments on commit 2954fdc

Please sign in to comment.