Understanding Coding and Libraries in STM32CubeIDE

Hey guys i recently completed mastering arduino , esp32 and all different types of atmega328 boards . Even completed learning embedded C and its application on atmega32 . I want to get started in STM32 . I have spend few weeks learning about its ide but the coding part is too much confusing , till now i am able to just use HAL Library and writing a embedded c code (target type - empty ) for it from scratch . But I am looking forward on understanding the coding part of the STM32 cube ide like how to add different libraries and how to use different types of stm32 chips and use there special feature for example few STM32 w Chips have lora inbuild . Can anyone help me with getting started .
Solution:
it's definitely possible yes
Jump to solution
24 Replies
ZacckOsiemo
ZacckOsiemo•6mo ago
blink on stm32 with just registers is particulary easy since you have a startup that gives you a very nice start environment. Let's go step by step what is the first issue you are facing.
accur4te
accur4te•6mo ago
The first problem is understanding the code generated using ioc , like ik how to set pins and generate a code , i have even used a Hal lib on it to blink Led but I am unable to hook a random sensor and get value from it ( I am unable to write code for that ) .
ZacckOsiemo
ZacckOsiemo•6mo ago
what sensor are you trying to hook up
accur4te
accur4te•6mo ago
IR infrared module
ZacckOsiemo
ZacckOsiemo•6mo ago
awesome, good start so what does the data sheet say how do you talk to this sensor?
accur4te
accur4te•6mo ago
it has three pins - gnd , vcc , data out ( active high)
accur4te
accur4te•6mo ago
so you need to use data out pin ofc , but no additional info is present on the internet
ZacckOsiemo
ZacckOsiemo•6mo ago
So it's analog out?
accur4te
accur4te•6mo ago
yes
ZacckOsiemo
ZacckOsiemo•6mo ago
What sensor is it?
ZacckOsiemo
ZacckOsiemo•6mo ago
Presumably then you need analog in?
accur4te
accur4te•6mo ago
HW-201
accur4te
accur4te•6mo ago
yes need a analog pin to read it (adc)
ZacckOsiemo
ZacckOsiemo•6mo ago
perfect if you can use IOC and set up GPIO you can do the same for ADC yes?
accur4te
accur4te•6mo ago
yeah , but don't you need a specific library like we do in arduino ?
accur4te
accur4te•6mo ago
or normal HAL lib command will work ?
ZacckOsiemo
ZacckOsiemo•6mo ago
Ok so with this information what have you tried?
accur4te
accur4te•6mo ago
i am trying to find a library for that particular sensor similar to what arduino ide has .
ZacckOsiemo
ZacckOsiemo•6mo ago
ah there might be one, but what do you need the library to do for you?
accur4te
accur4te•6mo ago
get the reading and display in on a console .
accur4te
accur4te•6mo ago
i am just asking , is it possible to extract the value by simiply connecting the output pin of the sensor to the ADC pin on stm32 and write a simple code to read the value , or else i will be needing a specific lib for that specific sensor to get the readings ( which is usually the case in arduino ide ).
Solution
ZacckOsiemo
ZacckOsiemo•6mo ago
it's definitely possible yes
accur4te
accur4te•6mo ago
ohk thanks got it , i will give it a try .
Mr_UJ 🔋
Mr_UJ 🔋•6mo ago
you can do it easily wihout library
Want results from more Discord servers?
Add your server