Skip to content

Revert "STM32L4: fix trng clock setting" #9029

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

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions targets/TARGET_STM/trng_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ void trng_init(trng_t *obj)
error("Only 1 RNG instance supported\r\n");
}

#if defined(TARGET_STM32L4)
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;

/*Select PLLQ output as RNG clock source */
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RNG;
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_PLL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_MSI;

Will resolve the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jeromecoutant I tried this, but it will produce the same error as if the original fix.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, clock configuration is different for MTB_ADV_WISE_1570 than for NUCLEO_L486RG.

Copy link
Contributor Author

@0xc0170 0xc0170 Dec 10, 2018

Choose a reason for hiding this comment

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

As previously was mentioned in original PR, should this adv wise target have own system clock config for this RNG selection?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@jeromecoutant that works for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeromecoutant new PR and we close this revert?

HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
#endif

/* RNG Peripheral clock enable */
__HAL_RCC_RNG_CLK_ENABLE();

Expand Down