Skip to content

STM23WL Compile Errors and proposed sleep change #1594

@spike314

Description

@spike314

I am trying to get my WIO-E5 modules (STM32WLE5JC) working with the latest MySensors development branch. I have run into 5 compile errors. These are due to different functionality between processor families and also inconsistent handling in the Arduino STM32 HAL code:

  • AES is defined in both the Arduino STM32WL codebase and in MySensors
  • error: '__HAL_RCC_PWR_CLK_ENABLE' was not declared in this scope
  • error: 'struct RTC_TypeDef' has no member named 'ISR'; did you mean 'SSR'?
  • error: 'RTC_ISR_INITS' was not declared in this scope; did you mean 'RTC_ICSR_INITS'?
  • error: too few arguments to function 'HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef*, uint32_t, uint32_t, uint32_t)'

The AES error is easily resolved using an #undef at the beginning and a new #define at the end of MyCryptoGeneric.cpp

The remaining compile errors are related to low-level sleep functions. Rather than track these down for the STM32WL processors, I propose a change to STM32 sleep handling in general. The Arduino STM32 code includes a LowPower library which provides a higher level interface to the sleep functions. Advantages to using the library functions:

  • MySensors code is greatly simplified. 5 low level functions can be removed.
  • Should minimize MySensors code changes as people try different STM32 processors in the future.
  • The LowPower library is required for installing the Arduino STM32 library, so it will always be available
  • Arduino STM32 core developers adapt to their own HAL and incorporate new STM32 processors when they are released.
    The main disadvantage I see is that MySensors code becomes dependent on an external library.

I have a working copy on my github: https://github.com/spike314/MySensors/tree/STM32CoreTest3
You can look at that branch to see the necessary changes. This is not really new code. It was from the early KooLru pull request for STM32.
I have successfully slept and woke from timer and 2 different pin interrupts on the STM32WL, STM32411CE black pill, and STM32F1 blue bill. I do not get any compile errors for the STM32U0, but I did not have a board to test the functionality. @nschurando If you could test using the code in my STM32CoreTest3 branch, it would be much appreciated.

Pls take a look. If the changes in that branch are acceptable, I could start a pull request.
I am @nagelc on the MySensors Forum if you want to start a discussion over there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions