I am familiar with 8051 C programming .Now I want to learn ARM cortex M3 programming . I have STM32F103C8T6 development board with ARM Cortex M3 Processor, it's programmer and Keil compiler.I want to do small projects with it for example blinking LEDs ,SPI and I2C programming etc. I am having little knowledge about arm architecture . Many people on blogs say directly start programming instead of reading architecture or reading hundred pages ARM datasheet. I don't understand how is it possible.
So what should be my first step?
Should I read datasheet of STM32F103C8T6 or ARM Cortex M3 user manual?
8051 and ARM programming has much difference. In 8051 ,we don't need to add library/header files. In ARM we need to add many library/header files. Suppose I want to do blinky program or learn SPI/I2C communication. In KEIL Compiler or STM CubeMX, these header files are already there .But if I wish do it everything (writing header file codes for peripheral,i/o ports, SPI/I2C protocol codes) from scratch by myself,is it really possible ? If yes, what should I do for it?
I am very much confused and frustrated as I have not find proper person yet to guide me regarding it
For ARM Cortex-M and STM32 specifically those might include (at various levels of abstraction and scope): STM32Cube. Often also commercial tool vendors (such as Keil, IAR, Rowley, Green Hills) provide example projects and driver libraries and middleware to get you started - often for specific development boards.
If you want an easier in to Cortex-M than the ARM reference material, then Joseph Yiu's The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors is a good source, but unless you are writing low-level RTOS or bare-metal start-up code or other system level code, you may not need that much material.
The course is intended for beginners and is structured as a series of short, focused, hands-on lessons that teach you how to program ARM Cortex-M microcontrollers in C. I’ve designed this course not just to be watched, but to follow it along on your own computer.
This HTML document is clearly not comprehensive rather it serves as a short refresher for those C programmers whose skills are a little rusty. This document also assists the experienced programmer trained in another language like Pascal or C++, that now wishes to program in C for an embedded Cortex M system.
It is possible (i.e. to start without detailed knowledge of datasheets and reference manuals) if you utilise existing library code to deal with architectural, start-up and peripheral driver issues. For ARM Cortex-M and STM32 specifically those might include (at various levels of abstraction and scope):
Often also commercial tool vendors (such as Keil, IAR, Rowley, Green Hills) provide example projects and driver libraries and middleware to get you started - often for specific development boards.
That is perhaps where your perception that for ARM programming you
"need to add many library/header files."
You don't need to at all - but they are more complex parts than 8051 with extensive and complex peripheral sets that differ between parts and vendors, and you can save a great deal of time and effort by utilising such libraries.
Note that the ARM Cortex-M core itself does not include the microcontroller peripherals and outside of the CPU and the NVIC interrupt controller, and on some higher-end parts the FPU, everything is vendor specific and differs widely between vendors - that is why you need to either understand the vendor documentation, or leverage chip or tool vendor or community provided libraries.
If you want to fully understand the Cortex-M or the STM32 and get the most out of them, then there is no substitute for reading the reference material, but it is by no means necessary just to get started.
If you want an easier in to Cortex-M than the ARM reference material, then Joseph Yiu's The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors is a good source, but unless you are writing low-level RTOS or bare-metal start-up code or other system level code, you may not need that much material. The earlier M3 only edition of this book is available as a PDF in some places.
The chip vendor's reference manual, which will describe the vendor specific features such as memory interfaces, memory map, power-management features, flash memory programming, interrupt mapping, and hardware peripherals will be the more useful material perhaps.
For the STM32 specifically there is a somewhat broad guide by Trevor Martin of Hitex: The Insider's Guide To The STM32 ARM Based Microcontroller, just one of several publications by Trevor that may be useful.
I have been there, After some time I realised that it's always better to start with the data sheet even if it's your first board.
Data sheet provides a comprehensive working of the board, pins and basic communication. It could be tedious but it's worth and you will realise when you start programming.
After that you could directly jump to header files, and see implementation of basic functionalities, this will give lot of insights about optimisation technique, the style of programming and best practices.
If possible find some more code written for that board (I always fail here, It's hard if your board is rare).
With this you should be ready to write almost any code. Start with the blinky (the hello world for boards)
Also with my experience, I want to tell you that, it's okay if it takes time. Have patience and persistence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With