Programming of Embedded Systems
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Home > Computing and Information Technology > Computer science > Programming of Embedded Systems
Programming of Embedded Systems

Programming of Embedded Systems


     0     
5
4
3
2
1



International Edition


X
About the Book

Many everyday objects have become embedded, connected and even autonomous. The engineers and technicians who develop them must have skills in both computer science and electronics.

Drawing on some 20 years of experience in the field of hardware and embedded computing, Programming of Embedded Systems analyzes how physical objects can interact with microcontrollers. It presents the fundamental principles of programming and code structuring. Although based on a specific family (STM32) of microcontrollers, the various chapters outline general concepts applicable to any microcontroller. They analyze the mechanisms that govern exchanges between a computer program and a hardware component of the embedded object.

Each chapter details the programming of peripheral units and ends with an example using a common application for managing the heating of a home equipped with a photovoltaic installation to illustrate implementation in the programming language C.



Table of Contents:

Preface xi

Chapter 1 Aims, Context and a Guiding Thread Example 1

1.1. Aims of this book 1

1.2 What this book contains and what it does not 2

1.3. About the code examples 3

1.4. Choosing your μcontroller: the STM32 family 3

1.4.1. Criteria when choosing a μcontroller 4

1.4.2. STM32 family 5

1.4.3. STM32F10x line 6

1.5. Guiding thread example 8

1.5.1. Context: photovoltaic self-consumption installation 8

1.5.2. System: optimization of electric heating in a photovoltaic self-consumption household 10

1.5.3. Summary of the peripherals seen in the guiding thread example 13

Chapter 2 General Programming Principles 15

2.1. Pointers and registers 15

2.1.1. “Simple” variables 15

2.1.2. Pointer to a variable 16

2.1.3. Using pointers to pass arguments to functions 18

2.1.4. When to use a pointer? 20

2.1.5. Function pointers 21

2.2. C language structure and usage in the STM 32 22

2.2.1. Structured type organization 22

2.2.2. Accessing registers via a structure 24

2.3. Case of nested structures 25

2.4. Masks usage 27

2.4.1. General considerations 28

2.4.2. Masks for setting bits to 1 29

2.4.3. Masks for setting bits to 0 30

2.4.4. Bit inversion 31

2.4.5. Extension and generalization to bit field assignment 31

2.5. Code structuring and the concept of drivers 33

2.6. Interrupt routines 36

2.6.1. Handler routines concepts 36

2.6.2. Interrupt routine implementation 37

2.6.3. Redirection via dynamic programming 39

Chapter 3 General STM32F10x Hardware Considerations 43

3.1. Global STM32 architecture 43

3.2. Cortex-M3 components 44

3.3. Clock trees and RCC units 47

3.3.1. Generation of primary clocks 47

3.3.2. Generation of secondary clocks 49

3.3.3. RCC unit programming 51

3.3.4. RCC unit configuration coding example 55

3.4 Watchdogs 57

3.4.1 Independent watchdogs 58

3.4.2 Windowed watchdogs 59

Chapter 4 Binary Inputs/Outputs (I/O): Parallel Ports 61

4.1. Concept of I/O ports 61

4.2. Electronic aspect 62

4.2.1. Global architecture 63

4.2.2. Input configuration 65

4.2.3. Output configuration 66

4.3. STM32 GPIOs 67

4.3.1. Configuration registers 69

4.3.2. Access registers 70

4.4. Example 73

4.4.1. Proposed solution 75

4.4.2. Comments 80

4.5. Unaddressed points regarding GPIOs 81

Chapter 5 Interrupt and DMA Management 83

5.1. General exceptions and particular interrupts 83

5.2. Resets and interrupt vector tables 84

5.2.1. Stack pointers and program counters 84

5.2.2. IVT contents 85

5.3. Principle of redirection and the role of the NVIC 88

5.3.1. Nvic 88

5.3.2. Conditions for an interrupt to be accepted 90

5.3.3. Priority management 92

5.3.4. Redirection process steps 96

5.4. Case of external interrupt inputs 96

5.4.1. AFIO and EXTI peripherals 97

5.4.2. NVIC level 98

5.4.3. GPIO and AFIO levels 99

5.4.4. EXTI level 102

5.5. Guiding thread example: treating an EXTI exception 103

5.5.1. Problem to solve 103

5.5.2. Proposed solution 103

5.6. Direct memory access 105

5.6.1. Generalities 105

5.6.2. DMA on the STM32F10x 106

5.7. Guiding thread example: case of DMA programming 111

5.7.1. UART configuration 112

5.7.2. DMA configuration 112

5.7.3. Program structure 112

Chapter 6 Timers 115

6.1. General information on counters or Timers 115

6.1.1. Basic principle 116

6.1.2. Timer units in the STM32F10x 116

6.1.3. Different types of Timers 117

6.2. Operating modes 118

6.2.1. General structure of a Timer 119

6.2.2. Core block: overflow, events and frequency 120

6.2.3. Capture/Compare block 125

6.2.4. Trigger controller block and encoder interface 129

6.2.5. Master mode 139

6.3. An additional Timer: the SysTick 141

6.4. Guiding thread example 143

6.4.1. Case study: a control knob 143

6.4.2. Code extract 143

Chapter 7 Pulse-Width Modulation (PWM) 145

7.1. Generalities on PWM-type signals 145

7.1.1. Definition 145

7.1.2. Use in information transmission 147

7.1.3. Use in digital-to-analog conversion 148

7.2. Implementation of PWM in an STM32F10x µcontroller 154

7.2.1. Basic operation 154

7.2.2. Configuration and options 156

7.3. Guiding thread example 160

7.3.1. First possible solution 160

7.3.2. Second adopted solution 160

7.3.3. Interrupt configuration 160

7.3.4. The PWM configuration itself 161

7.3.5. The GPIO configuration 161

7.3.6. Code excerpt 161

Chapter 8. Analog to Digital Converter 165

8.1. Generalities and operating principles 165

8.1.1. Role and definitions 165

8.1.2. Successive-approximation ADC 168

8.1.3. Variable voltage measurement 169

8.1.4. Multi-channel ADC 172

8.1.5 Overview of the ADC timings 173

8.2. ADC in the STM32F10x 174

8.2.1 Simplified architecture of the ADC 174

8.2.2. ADC functional modes 181

8.2.3. DMA with ADC 185

8.3. Application: the power analyzer 186

8.3.1 Determining the sampling duration T s 186

8.3.2. Code excerpt for configuration 187

Chapter 9. Some Communication Buses 191

9.1. Introduction 191

9.2. UART units 193

9.2.1. Generalities 193

9.2.2. Reading/writing techniques 195

9.2.3. UART configuration on the STM32F10x 197

9.3. SPI units 203

9.3.1. Generalities 203

9.3.2. Shift register-based read/write techniques 205

9.3.3. SPI configuration on the STM32F10x 209

9.4. I 2 C bus 213

9.4.1. Generalities 213

9.4.2. Electrical topology of the I 2 C bus 215

9.4.3. Principle and protocol 216

9.4.4. Reading/writing techniques 220

9.4.5. I 2 C configuration on the STM32F10x 224

9.5. Guiding thread example 233

9.5.1. UART reception in interrupt mode 233

9.5.2. Temperature measurement via the I 2 C bus and DMA 234

Chapter 10. STM32 Power Management 241

10.1. Introduction 241

10.2. Domains of the µcontroller 242

10.2.1 1.8V Domain 242

10.2.2 V DD Domain 244

10.2.3 Backup Domain 244

10.2.4 V DDA Domain 245

10.3. Reset on STM 32 245

10.3.1 System Reset 245

10.3.2 Power Reset 247

10.3.3 Backup Domain Reset 247

10.3.4. Reset flags (RCC_CSR) management 247

10.3.5. STM32F10x reset summary 248

10.4. RTC registers 249

10.4.1 Secure access to the Backup Domain 250

10.4.2. RCC_BDCR registers 250

10.4.3. RTC register structure 251

10.4.4. Reading/writing RTC registers 252

10.5. Low Power modes 254

10.5.1. Event and interrupt 254

10.5.2. Key bits for Low Power modes 255

10.5.3. Sleep mode 258

10.5.4. Stop mode 259

10.5.5. Standby mode 260

10.6. Software architecture and using Low Power modes 261

10.6.1. Classical software architecture 261

10.6.2. Sleeping in main(), WFI instruction 262

10.6.3. Automatic sleep upon interrupt exit 262

10.6.4. Sleeping in main(), WFE instruction 264

10.6.5. Standby mode on RTC alarm 264

10.7. Guiding thread example for Low Power mode 264

10.7.1. Problem to solve 264

10.7.2. Proposed solution 265

Appendix 271

References 283

Index 285

 



About the Author :

Vincent Mahout is Lecturer at INSA Toulouse, France, where he teaches automation and hardware and embedded computing.

Thierry Rocacher is Associate Professor of Electrical Engineering at INSA Toulouse, France, where he teaches electronics and embedded computing.

Guillaume Auriol is Associate Professor of Electrical Engineering at INSA Toulouse, France, where he teaches electronics and embedded computing.


Best Sellers


Product Details
  • ISBN-13: 9781786309518
  • Publisher: ISTE Ltd and John Wiley & Sons Inc
  • Publisher Imprint: ISTE Ltd and John Wiley & Sons Inc
  • ISBN-10: 1786309513
  • Publisher Date: 19 Dec 2025


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Programming of Embedded Systems
ISTE Ltd and John Wiley & Sons Inc -
Programming of Embedded Systems
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Programming of Embedded Systems

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!