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

Handling of Wake up from Stop 3 interrupt #11

Open
stef333 opened this issue Sep 11, 2024 · 1 comment
Open

Handling of Wake up from Stop 3 interrupt #11

stef333 opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system. pwr PWR-related issue or pull-request.

Comments

@stef333
Copy link

stef333 commented Sep 11, 2024

In the void HAL_PWREx_S3WU_IRQHandler(uint32_t WakeUpPin) callback is called with the WakeUpPin parameter, which does not indicate that specific interrupt occurred. Instead, it only forwards the WakeUpPin variable which contains information about which pins should trigger the handler. Also since wake up flag is cleared in the HAL_PWREx_S3WU_IRQHandler we can't check it later.

Proposed Change

Invoke the callback with the pin that triggered the interrupt:

...

  if ((WakeUpPin & PWR_WAKEUP_PIN1) != 0U)
  {
    if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1) != 0U)
    {
      /* Clear PWR wake up flag line 1 */
      SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1);

      /* PWR S3WU interrupt user callback */
      HAL_PWREx_S3WUCallback(PWR_WAKEUP_PIN1); // instead of   HAL_PWREx_S3WUCallback(WakeUpPin);
    }
  }

...

or call callback for all interrupts at once:

...

  uint32_t local_wkp = 0;

  if ((WakeUpPin & PWR_WAKEUP_PIN1) != 0U)
  {
    if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF1) != 0U)
    {
      /* Clear PWR wake up flag line 1 */
      SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF1);

      /* PWR S3WU interrupt user callback */
       local_wkp |= PWR_WAKEUP_PIN1;
    }
  }

  if ((WakeUpPin & PWR_WAKEUP_PIN2) != 0U)
  {
    if (READ_BIT(PWR->WUSR, PWR_WUSR_WUF2) != 0U)
    {
      /* Clear PWR wake up flag line 2 */
      SET_BIT(PWR->WUSCR, PWR_WUSCR_CWUF2);

      /* PWR S3WU interrupt user callback */
      local_wkp |= PWR_WAKEUP_PIN2;
    }
  }

    HAL_PWREx_S3WUCallback(local_wkp); 

}
@ALABSTM ALABSTM added enhancement New feature or request hal HAL-LL driver-related issue or pull-request. pwr PWR-related issue or pull-request. labels Sep 13, 2024
@TOUNSTM
Copy link
Contributor

TOUNSTM commented Sep 27, 2024

ST Internal Reference: 192355

@TOUNSTM TOUNSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system. label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system. pwr PWR-related issue or pull-request.
Projects
Status: In progress
Development

No branches or pull requests

3 participants