STM32F1 HAL

Started by tha, June 14, 2022, 09:22:55 AM

Previous topic - Next topic

tha

https://www.st.com/resource/en/user_manual/dm00154093-description-of-stm32f1-hal-and-lowlayer-drivers-stmicroelectronics.pdf
ต้องขอขอบคุณทางทีมงานที่ทำเอกสารนี้ ที่ให้ความรู้เรามาไว้ ณ ที่นี้ด้วยครับ

UM1850
User manual
Description of STM32F1 HAL and low-layer drivers

Introduction(บทนำ)

STM32Cube เป็นความคิดริเริ่มดั้งเดิมของ STMicroelectronics เพื่อปรับปรุงประสิทธิภาพการทำงานของนักพัฒนาอย่างมีนัยยะโดยการลด development effort, เวลา และต้นทุน STM32Cube ครอบคลุมกลุ่มผลิตภัณฑ์ STM32

STM32Cube ประกบด้วย:
•   STM32CubeMX, a graphical software configuration tool ที่ยอมให้สร้าง C initialization code โดย
     ใช้ graphical wizards.
•   A comprehensive embedded software platform, จัดส่งตาม Series (อย่างเช่น STM32CubeF1 สำหรับ STM32F1)
    –   The STM32Cube HAL, STM32 abstraction layer embedded software ช่วยให้พกพาได้อย่างเต็มที่ทั่วกลุ่มผลิตภัณฑ์
         STM32. HAL API มีให้ใช้งานสำหรับ peripherals ทั้งหมด.
    –   Low-layer APIs (LL) นำเสนอ a fast light-weight expert-oriented layer ซึ่งใกล้ชิดกับ the hardware มากกว่า the
         HAL. LL APIs มีให้ใช้งานเฉพาะสำหรับชุดหนึ่งของ peripherals.
    –   ชุดที่ตรงกันของ middleware components อย่างเช่น RTOS, USB, TCP/IP and Graphics.
    –   All embedded software utilities, จัดส่งพร้อมตัวอย่างครบชุด.

tha

The HAL driver layer จัดให้มี a simple, generic multi-instance set of APIs (application programming interfaces) เพื่อตอบโต้กันกับ the upper layer (application, libraries and stacks).

The HAL driver APIs ถูกแบ่งออกเป็นสองประเภท: generic APIs, ซึ่งจัดให้มี common and generic functions สำหรับทุก the STM32 series และ extension APIs, ซึ่งรวม specific and customized functions สำรับ a given line หรือ part number. The HAL drivers รวม a complete set of ready-to-use APIs ที่ง่ายต่อ the user application implementation. ตัวอย่างเช่น, the communication peripherals บรรจุ APIs เพื่อเริ่มต้นและกำหนดค่า the peripheral, จัดการ data transfers ใน polling mode, รับมือ interrupts หรือ DMA, และจัดการ communication errors.

tha

The HAL drivers เป็น feature-oriented แทน IP-oriented. ตัวอย่างเช่น, the timer APIs ถูกแบ่งออกเป็นหลายประเภทตาม the IP functions, อย่างเช่น basic timer, capture and pulse width modulation (PWM). The HAL driver layer จัดให้มีใช้งาน run-time failure detection โดยการเช็ค the input values of all functions. เช่น dynamic checking ช่วยปรับปรุง the firmware robustness. Run-time detection เหมาะสำหรับ user application development and debugging ด้วย.

The LL drivers เสนอ hardware services ตามคุณสมบัติที่มีให้ของ the STM32 peripherals. บริการเหล่านี้สะท้อนให้เห็นอย่างชัดเจนความสามารถของฮาร์ดแวร์ และจัดให้มี atomic operations ที่ต้องถูกเรียกใช้โดยทำตาม the programming model ที่อธิบายใน the product line reference manual. เป็นผลให้, the LL services ไม่ได้ขึ้นอยู่กับ standalone processes และไม่ต้องการ any additional memory resources เพื่อบันทึก states, counter หรือ data pointers ของพวกมัน. All operations ถูกกระทำโดยการเปลี่ยนสิ่งที่บรรจุอยู่ภายในของ the associated peripheral registers. ไม่เหมือน the HAL, LL APIs ไม่ถูกจัดให้มีสำหรับ peripherals ที่การปรับการเข้าถึงให้เหมาะสมไม่ใช่คุณสมบัติหลัก, หรือสำหรับเหล่านั้นที่ต้องการ heavy software configuration และ/หรือ a complex upper-level stack (อย่างเช่น USB).


tha

The HAL and LL เป็นส่วนเสริมและครอบคลุมย่านที่กว้างขวางของ application requirements:
•   The HAL เสนอ high-level and feature-oriented APIs ที่มี a high-portability level. เหล่านี้จะซ่อน the MCU and
     peripheral complexity จาก the end-user.
•   The LL เสนอ low-level APIs ที่ register level, พร้อมการปรับให้เหมาะสมที่ดีกว่า แต่พกพาสะดวกน้อยกว่า. เหล่านี้ต้องการความรู้ที่
     ลึกของ the MCU and peripheral specifications.

The HAL- and LL-driver source code ได้รับการพัฒนาใน ANSI-C ที่เข้มงวด ซึ่งทำให้มันเป็นอิสระจาก the development tools. มันถูกเช็คด้วย the CodeSonar® static analysis tool. มีเอกสารครบถ้วน.

เป็นไปตาม MISRA C®:2004 standard.

tha

คู่มือผู้ใช้นี้มีโครงสร้างดังนี้:
•   ภาพรวมของ HAL drivers
•   ภาพรวมของ low-layer drivers
•   การอยู่ร่วมกันของ HAL and LL drivers
•   คำอธิบายโดยละเอียดของแต่ละ peripheral driver: configuration structures, functions, และวิธีในการใช้ the given API เพื่อ
     สร้าง your application

tha

1 General information

The STM32CubeF1 MCU Package รันบน STM32F1 32-bit microcontrollers บนรากฐานของ the Arm® Cortex®-M processor.

หมายเหตุ: Arm เป็นเครื่องหมายการค้าจดทะเบียนของ Arm Limited (หรือบริษัทในเครือ) ในสหรัฐอเมริกาและ/หรือที่อื่นๆ

tha

2 Acronyms and definitions



tha