Page 1 of 1

How to use timer?

Posted: Fri Nov 06, 2020 8:23 am
by saeed144
Hi every one.
How to use stm32f103 timers with Arduino IDE?
How to set prescaler and period?

Re: How to use timer?

Posted: Fri Nov 06, 2020 8:54 am
by fpiSTM
Which core?

Re: How to use timer?

Posted: Sat Nov 07, 2020 8:38 am
by saeed144
Official, Stm32Duino

Re: How to use timer?

Posted: Sat Nov 07, 2020 9:06 am
by fpiSTM

Re: How to use timer?

Posted: Sun Nov 08, 2020 10:17 am
by saeed144
Thank you so much.

One more question:
If we have access to all stm features in Arduino IDE with this huge libraries, why we use other compilers like keil at all?

Re: How to use timer?

Posted: Sun Nov 08, 2020 12:59 pm
by GonzoG
Arduino is not a "proper" programming IDE.
It's for ppl who don't want to go into all the details with MCU/board setup. It's much easier to start programming MCUs in Arduino IDE than in Attolic, Keil, etc, but you also don't get any additional tools (eg. debugger) and don't have all the options for compiler.
And I do not mention all the IDE features that "proper" IDEs have...

Re: How to use timer?

Posted: Mon Nov 09, 2020 6:36 am
by saeed144
Can you explain this: "all the details with MCU/board setup." ?
For example which details in stm32 we can't configure in Arduino IDE?

Re: How to use timer?

Posted: Mon Nov 09, 2020 8:13 am
by mlundin
All registers in STM32 processors are available using Arduino IDE and the STM32 Core, so with careful reading of the processor manuals and lots of testing and googling for information there is not much you cannot do. Of course you must also not to get into conflict with the exiting code from the STM32 Core so you must study the HAL configuration usage and most probably get to know the Core code intimately. There are lots of hardware related, code HAL code, ready to be used from inside Arduino IDE but finding out what and how to use it is some work.

If Arduino is a 'proper' IDE or not has been endlessly discussed, but it is surely a most basic one and it does lack support for hardware debugging. Now even with a hardware debugger, finding problems can in many cases require you to learn all the internals of processor registers and HAL code layers as described above.

Re: How to use timer?

Posted: Mon Nov 09, 2020 10:21 am
by GonzoG
saeed144 wrote: Mon Nov 09, 2020 6:36 am Can you explain this: "all the details with MCU/board setup." ?
For example which details in stm32 we can't configure in Arduino IDE?
I didn't say you cannot. I said if you don't won't to go into all those settings.
In Arduino IDE you don't have to do anything as it has all default settings predefined.
With other IDEs you need to set everything by yourself and it's even hundreds of lines of code.

Re: How to use timer?

Posted: Tue Nov 10, 2020 4:07 pm
by mrburnette
saeed144 wrote: Sun Nov 08, 2020 10:17 am ...
One more question:
If we have access to all stm features in Arduino IDE with this huge libraries, why we use other compilers like keil at all?
From another of my forum answers:
Arduino-centric thinking and the ArduinoIDE are really only an environment. All pertinent board/uC files are scripts. Arduino is just a framework of JAVA code that manages the output from the ArduinoIDE editor (or other chosen editor.) There is no native compiler or native linker in Arduino-land. The link below explains what happens, pay special attention to automatic creation of prototypes as many users do not understand this process.
https://arduino.github.io/arduino-cli/s ... d-process/s/
GCC is open-source and "free": https://gcc.gnu.org/

Keil verses GCC: https://community.arm.com/developer/ip- ... c-does-not

Note: 12 years into retirement, I have lost contact with old acquaintances in commercial programming, but at one time, Open-Source (free) was an unacceptable option for corporate programming use. It literally came down to not being able to hold another company liable for "issues" (technical, legal, support) when in-house programmers screwed-up. Linux introduction into the corporate data centers was delayed for many years as the lawyers fought IT.
Eventually, a company rose to provide the indemnity corporate lawyers demanded: https://www.redhat.com/en/our-code-is-open


Ray