Skip to content
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

nrf5x: Request HFXO via OS #1274

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

kasjer
Copy link
Collaborator

@kasjer kasjer commented Jan 11, 2022

Describe the PR
Mynewt (similar to Soft Device) has its own reference counting for
HFXO oscillator.
So far TinyUSB requested HFXO when VBUS was detected and stopped when
VBUS was removed.
But with Mynewt running HFXO can be stopped when other interested parties
don't require HFXO anymore. This results in very difficult to track
USB transmission errors when internal RC is used for USB clock source.

This change enables Mynewt specific HFXO management in Soft Device fashion.

Additional context
This PR should be merged AFTER matching mynewt PR is merged
apache/mynewt-core#2748

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

look great, though I think we should wrap it all to prevent gcc warnings (if any).

Comment on lines 898 to 901
#if CFG_TUSB_OS == OPT_OS_MYNEWT
usb_clock_request();
return;
#endif
Copy link
Owner

Choose a reason for hiding this comment

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

we should do #ifelse for the whole hfclk_enable() / hfclk_disable() to prevent gcc to emit unreachable statement warning

Mynewt (similar to Soft Device) has its own reference counting for
HFXO oscillator.
So far TinyUSB requested HFXO when VBUS was detected and stopped when
VBUS was removed.
But with Mynewt running HFXO can be stopped when other interested parties
don't require HFXO anymore. This results in very difficult to track
USB transmission errors.

This change enables Mynewt specific HFXO management in Soft Device fashion.
@kasjer kasjer force-pushed the kasjer/nrf5x-request-clock-in-mynewt branch from 7ef67a1 to f472512 Compare January 18, 2022 07:14
@kasjer kasjer marked this pull request as ready for review January 18, 2022 07:14
@kasjer kasjer requested a review from hathach January 18, 2022 07:15
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

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

perfect, thank you for your PR

@hathach hathach merged commit 92c36f1 into hathach:master Jan 18, 2022
@kasjer kasjer deleted the kasjer/nrf5x-request-clock-in-mynewt branch January 19, 2022 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants