Delay function

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Delay function

      Does the Embedded Studio IDE provide some form of Delay function like HAL_Delay() or LLm_Delay as provided with STM32CubeMX/IDE? After adding suitable packages for the MCU I still can't find how to do this. I just want to blink an LED to get started with Embedded Studio.
      Thanks for any suggestions.
    • Hello,

      Thank you for your inquiry.
      There is no generic way to implement a time based delay function for embedded targets.
      It is always target and architecture specific. So providing a "generic" function is not possible as we are supporting all Arm targets and not only ST.
      The CPU support packages provided with Embedded Studio give access to the Arm CMSIS layer for that particular device which gives you all you need to get started with your chip bare metal and have the whole chip described via register macros so you can quickly access peripheral registers in your code.

      But it is not a HAL. A HAL is always device family (some times even board) specific. But provides all kinds of libraries and wrappers for functionalities for the chip. This is of course nice and can reduce setup times of projects drastically, but the cost is security and performance as you are loading multiple kilobytes of additional code with your application where you do not know exactly what it does under the hood and if it is even reasonable to use the peripheral like that.
      However HALs are usually maintained and supported by an enormous team at the silicon vendors themselves and not really something we can provide for the more than 10000 different Arm target devices that you can use with Embedded Studio. So our suggestion is to do implementations bare metal as most initialization are very short and the ST documentation is usually quite accurate.

      But you can of course add the ST HAL files to your Embedded Studio project and use the HAL_Delay() as well just like with any other third party software or libraries.

      Best regards,
      Nino
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Thanks for the explanation Nino, I understand the downsides of a HAL but as a software novice they help me get a project started. I know that Delay() should ideally not be used as they freeze project execution, but these pre-defined functions can be useful for testing et cetera. I started with Arduino IDE which does support Delay() but has no debugger, so next tried VSS/PlatformIO which has everything I need but was always breaking post updates, then STMCubeMX/IDE which so far has done everything I want flawlessly, I was just trying Embedded Studio as I bought a J-Link to try - but at least this will work with STMCubeIDE I believe, so I think I'll stick with this IDE.
    • Hello,

      Yes Delay functions can be helpful. But as said the implementation is target specific.
      With Arduino you have thousands of files in Arduino software taking care of this under the hood.
      Same goes for the ST HAL in CubeMX.
      Someone has to implement the function.

      We do not do this as it does not make sense to us to create yet another HAL and try to compete with ST.
      But you can of course also use the ST HAL in an Embedded Studio project and then you can also use the same delay function.

      You can either add the HAL manually to your project or use the project importer.
      If you are using the project importer we recommend to use a CubeIDE project as basis.

      Best regards,
      Nino
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • If I import a CubeIDE project into Embedded Studio (Windows only apparently) and I make a configuration change in CubeMX could I just re-import the project, or would that overwrite any user code I might have added, which does not happen with CubeIDE as the CubeMX code is just merged with the CubeIDE code?
      Thank you
      Steve
    • Hi Steve,

      The importer will simply import whatever the CudeIDE project is at that point.
      A reimport is not available.

      Best regards,
      Nino
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.