Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ void RtcManager ::configure(const struct device* dev) {
// ----------------------------------------------------------------------

void RtcManager ::timeGetPort_handler(FwIndexType portNum, Fw::Time& time) {
// Get system uptime
int64_t t = k_uptime_get();
U32 seconds_since_boot = static_cast<U32>(t / 1000);
U32 useconds_since_boot = static_cast<U32>((t % 1000) * 1000);
// Get system uptime in useconds
int64_t t = k_uptime_ticks();
U32 seconds_since_boot = static_cast<U32>(t / 1000000);
U32 useconds_since_boot = static_cast<U32>(t % 1000000);

// Check device readiness
if (!device_is_ready(this->m_dev)) {
Expand Down
4 changes: 4 additions & 0 deletions prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ CONFIG_MAIN_STACK_SIZE=8192
CONFIG_POSIX_API=y
CONFIG_REBOOT=y

#### System Clock Configuration ####
# Run system clock at 1 MHz for microsecond precision timing
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will have a massive effect on the system. It will change interrupt timings, thread switching timings, and any other timings defined by the system. It will also increase overhead of kernel operations (context switching, etc) because these will happen more often.

Ticks represent the minimum time quantum that the kernel can detect and act on. We currently use 10000. This increases that value by 100x.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you for this clarification. I thought the objection was around changing the Zephyr call from k_uptime_get() to k_uptime_ticks(). Agreed this is worth looking into.


#### Native USB ####
#CONFIG_USB_DEVICE_STACK=y
#CONFIG_USB_CDC_ACM=y
Expand Down
Loading