element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
STMicroelectronics
  • Products
  • Manufacturers
  • STMicroelectronics
  • More
  • Cancel
STMicroelectronics
Forum HAL Libraries - Importing and Using
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join STMicroelectronics to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 15 replies
  • Subscribers 14 subscribers
  • Views 11432 views
  • Users 0 members are here
  • st products
  • truestudio
  • attolic
  • stm32l476jg
Related

HAL Libraries - Importing and Using

14rhb
14rhb over 6 years ago

I'm after some advice on how to do the following, the discussion will likely be useful to others, so I have broken out to this 'fresh area'. Happy to move if there is a more suitable place.

 

I'm participating in Sixth Sense Design Challenge and anyone following that will likely see a few posts from me stating that I'm struggling to understand the STM32 development cycle more than the actual range of IDEs. My initial discussion is https://www.element14.com/community/community/design-challenges/sixth-sense-design-challenge/blog/2019/02/25/r2b4-6-sens…

 

I'm currently using True Studio and STM32L476 although the question could easily relate to the other IDE  and/or other devices and boards. I can, with some effort and luck, manage to install and download the examples that are provided in the relevant STM32xx_Cube downloads, I can use STM32xxCubeMX to make a skeleton framework but I seem lost when it comes to adding into an existing project.

 

For example, I am currently trying to activate the UART5 for that challenge. I have managed to track down the HAL_drivers for the UART in the initial download and add those into my existing project. Partly comparing a simple UART example I made to see what is required. All the HAL_UART functions are greyed out because HAL_UART_MODULE_ENABLED is not defined. When I look at the simple example I see these are defined in STM32xx_HAL_conf.h but in my example from the STM32xxCube package there doesn't appear to be such a file.

 

If I manage to find a solution I will post it here - current thinking is to (1) simply define the above and see what happens (2) copy the whole header file from another project and adjust for my current one

 

Any simple tips, explanation of the basics or links to concise articles would be really appreciated. I really want to crack my understanding of these ARM based boards - I have several now and really want to make something useful with them.

 

Rod

  • Sign in to reply
  • Cancel

Top Replies

  • avnrdf
    avnrdf over 6 years ago +4
    Rod, I've been using CubeMX + Atollic Studio to program a STM32F103. I'm using the STM32 HAL, and it seems to be working fine for me. First setup CubeMX by downloading the MCU Package: Create a new CubeMX…
  • avnrdf
    avnrdf over 6 years ago in reply to 14rhb +3
    This is what my project looks like: CubeMX generated the hal_conf.h file, and automatically defined the macros. Since you're working with an example project, you could try importing the drivers manually…
  • 14rhb
    14rhb over 6 years ago in reply to kulky64 +3
    I've got 100% UART data now on CN9-pin1, thank you so much kulky64 for all your time taking me through this. Point-by-point: I was looking at CN9-pin2 for the very reason you mention, that is was detailed…
Parents
  • koudelad
    koudelad over 6 years ago

    Hello Rod,

     

    I don't program STM32s profesionally, but here are a few hints I got at some of ST's seminars:

    1) If you have no existing code and want to use CubeMX to generate your code, do it at the beginning and save the CubeMX project file. CubeMX generates a code that contains a lot of blocks of comments that suggest where to put your own code and what not to touch. If you follow their rules, you can even open the project in CubeMX later and add/remove features later, generate the project again, and your own code stays where it was.

    2) If ST provided some example you wish to modify, I would look for the CubeMX project file, which leads to the previous step.

     

    David

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • koudelad
    koudelad over 6 years ago

    Hello Rod,

     

    I don't program STM32s profesionally, but here are a few hints I got at some of ST's seminars:

    1) If you have no existing code and want to use CubeMX to generate your code, do it at the beginning and save the CubeMX project file. CubeMX generates a code that contains a lot of blocks of comments that suggest where to put your own code and what not to touch. If you follow their rules, you can even open the project in CubeMX later and add/remove features later, generate the project again, and your own code stays where it was.

    2) If ST provided some example you wish to modify, I would look for the CubeMX project file, which leads to the previous step.

     

    David

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
  • 14rhb
    14rhb over 6 years ago in reply to koudelad

    Hi David,

     

    Thank you for your valuable replies:

    If you follow their rules, you can even open the project in CubeMX later and add/remove features later, generate the project again, and your own code stays where it was.

    That sounds useful when I am more proficient and then need to expand on my existing projects or change something. Sounds logical as well, like the Microchip Code Configurator (MCC) in PIC program IDE.

    I would look for the CubeMX project file

    I never thought of doing that - if I can find that file to open directly in CubeMX it would be so much 'easier' ....I'll do some searching around.

     

    Rod

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube