Electoday 2025

ไมโครคอนโทรลเลอร์ => ARM Processors => Topic started by: tha on November 08, 2022, 09:58:57 AM

Title: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 09:58:57 AM
11 Extended interrupts and events controller (EXTI)

The external interrupt/event controller ประกอบด้วยมากถึง 24 edge detectors สำหรับการสร้าง event/interrupt requests. แต่ละ input line สามารถถูกกำหนดค่าเพื่อเลือก the type (interrupt or event) ได้อย่างเป็นอิสระและ the corresponding trigger event (rising or falling หรือทั้งคู่). แต่ละ line สามารถถูกบังได้อย่างอิสระอีกด้วย. A pending register จะรักษา the status line ของ the interrupt requests.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 10:09:51 AM
11.1 EXTI main features

คุณลักษณะหลักของ the EXTI controller เป็นดังต่อไปนี้:
•   การทริกและการบังอย่างเป็นอิสระบนแต่ละ interrupt/event line
•   status bit ที่อุทิศให้สำหรับแต่ละ interrupt line
•   การสร้างได้มากถึง 24 software event/interrupt requests
•   การตรวจจับ external signals ที่มี a pulse width ต่ำกว่า the APB2 clock period. ดูที่ the electrical characteristics section
     of the STM32F75xxx and STM32F74xxx datasheets สำหรับรายละเอียดเกี่ยวกับ parameter นี้.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 10:13:38 AM
11.2 EXTI block diagram

Figure 30 แสดง the block diagram.

(https://i.imgur.com/uWL2X4h.png)
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 10:51:23 AM
11.3 Wakeup event management

The STM32F75xxx and STM32F74xxx devices สามารถจัดการ external or internal events เพื่อว่าจะปลุก the core (WFE). The wakeup event สามารถถูกสร้างอย่างใดอย่างหนึ่งโดย:
•   การเปิดใช้งาน an interrupt ใน the peripheral control register แต่ไม่ใน the NVIC, และเปิดใช้งาน the SEVONPEND bit ใน
     the Cortex®-M7 System Control register. เมื่อ the MCU กลับคืนมาทำงานต่อจาก WFE, the peripheral interrupt
     pending bit และ the peripheral NVIC IRQ channel pending bit (ใน the NVIC interrupt clear pending register) ต้อง
     ถูกเคลียร์.
•   หรือกำหนดค่า an external or internal EXTI line ใน event mode. เมื่อ the CPU กลับคืนมาทำงานต่อจาก WFE, มันไม่จำเป็น
     ต้องเคลียร์ the peripheral interrupt pending bit or the NVIC IRQ channel pending bit เนื่องจาก the pending bit ที่ตรง
     กันกับ the event line ไม่ได้ถูกเซ็ต.

เพื่อใช้ an external line เป็น a wakeup event, ดูที่ Section 11.4: Functional description.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 11:03:11 AM
11.4 Functional description

เพื่อสร้าง the interrupt, the interrupt line ควรถูกกำหนดค่าและเปิดใช้งาน. นี้สามารถทำโดยการโปรแกรม the two trigger registers ด้วย the desired edge detection(ขอบขาที่ต้องการตรวจจับ) และโดยการเปิดใช้งาน the interrupt request(การร้องขออินเตอรัพท์) โดยการเขียน '1' ไปยังบิตที่ตรงกันใน the interrupt mask register. เมื่อขอบขา(ขึ้นหรือลง)ที่เลือกเกิดขึ้นบน the external interrupt line, an interrupt request จะถูกสร้าง. The pending bit ที่ตรงกับ the interrupt line จะถูกเซตด้วย. interrupt request นี้จะถูกรีเซ็ตโดยการเขียน '1' ใน the pending register (ในบิตที่ตรงกัน).

เพื่อสร้าง the event, the event line ควรถูกกำหนดค่าและเปิดใช้งาน. นี้สามารถทำโดยการโปรแกรม the two trigger registers ด้วย the desired edge detection(ขอบขาที่ต้องการตรวจจับ) และโดยการเปิดใช้งาน the event request โดยการเขียน '1' ไปยังบิตที่ตรงกันใน the event mask register.  เมื่อขอบขา(ขึ้นหรือลง)ที่เลือกเกิดขึ้นบน the event line, an event pulse(พลัสเดียว) จะถูกสร้าง. The pending bit ที่ตรงกันกับ the event line ไม่ได้ถูกเซ็ต

An interrupt/event request สามารถถูกสร้างโดย software โดยการเขียน '1' ใน the software interrupt/event register
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 11:19:32 AM
11.5 Hardware interrupt selection

เพื่อกำหนดค่า a line เป็น interrupt sources, ใช้ขบวนการต่อไปนี้:
1.   กำหนดค่า the corresponding mask bit (EXTI_IMR)
2.   กำหนดค่า the Trigger selection bits ของ the interrupt lines (EXTI_RTSR and EXTI_FTSR)
3.   กำหนดค่า the enable and mask bits ที่ควบคุม the NVIC IRQ channel ที่แม็ปถึง the external interrupt controller (EXTI)
      ดังนั้น an interrupt ที่มาจากหนึ่งของ the 24 lines สามารถถูกรับรู้ได้อย่างถูกต้อง.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 11:22:32 AM
11.6 Hardware event selection

เพื่อกำหนดค่า a line เป็น event sources, ใช้ขบวนการต่อไปนี้:
1.   กำหนดค่า the corresponding mask bit (EXTI_EMR)
2.   กำหนดค่า the Trigger selection bits of the event line (EXTI_RTSR and EXTI_FTSR)
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 01:29:42 PM
11.7 Software interrupt/event selection

The line สามารถถูกกำหนดค่าเป็น software interrupt/event line. ต่อไปนี้คือขบวนการที่จะสร้าง a software interrupt.
1.   กำหนดค่า the corresponding mask bit (EXTI_IMR, EXTI_EMR)
2.   เซ็ตบิตที่ต้องการใน the software interrupt register (EXTI_SWIER)
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 01:38:54 PM
11.8 External interrupt/event line mapping

มากถึง 168 GPIOs ถูกต่อเข้ากับ the 16 external interrupt/event lines ในวิธีต่อไปนี้:

(https://i.imgur.com/EFR2qNI.png)
(https://i.imgur.com/whrasKG.png)

แปด EXTI lines อื่นๆถูกต่อดังต่อไปนี้:
• EXTI line 16 ถูกต่อถึง the PVD output
• EXTI line 17 is connected to the RTC Alarm event
• EXTI line 18 is connected to the USB OTG FS Wakeup event
• EXTI line 19 is connected to the Ethernet Wakeup event
• EXTI line 20 is connected to the USB OTG HS (configured in FS) Wakeup event
• EXTI line 21 is connected to the RTC Tamper and TimeStamp events
• EXTI line 22 is connected to the RTC Wakeup event
• EXTI line 23 is connected to the LPTIM1 asynchronous event
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 01:45:37 PM
11.9 EXTI registers

ดูที่ Section 1.2 on page 62 สำหรับรายการตัวย่อที่ใช้ใน register descriptions.

11.9.1 Interrupt mask register (EXTI_IMR)

Address offset: 0x00
Reset value: 0x0000 0000

(https://i.imgur.com/2TVNpcY.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 IMx: Interrupt mask on line x
     0: Interrupt request จาก line x ถูกบัง
     1: Interrupt request จาก line x ไม่ถูกบัง
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 01:49:30 PM
11.9.2 Event mask register (EXTI_EMR)

Address offset: 0x04
Reset value: 0x0000 0000

(https://i.imgur.com/RmNXo45.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 EMx: Event mask on line x
     0: Event request จาก line x ถูกบัง
     1: Event request จาก line x ไม่ถูกบัง
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 02:27:21 PM
11.9.3 Rising trigger selection register (EXTI_RTSR)

Address offset: 0x08
Reset value: 0x0000 0000

(https://i.imgur.com/rzHUULr.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 TRx: Rising trigger event configuration bit of line x
     0: Rising trigger ถูกปิดใช้งาน (สำหรับ Event and Interrupt) สำหรับ input line
     1: Rising trigger ถูกเปิดใช้งาน (สำหรับ Event and Interrupt) สำหรับ input line

Note: The external wakeup lines ถูกทริกที่ขอบ, ต้องไม่มีความบกพร่องถูกสร้างบน lines เหล่านี้.  ถ้า a rising edge เกิดขึ้นบน the
          external interrupt line ในขณะที่เขียนไปยัง the EXTI_RTSR register, the pending bit จะถูกเซ็ต.

          Rising and falling edge triggers สามารถถูกเซ็ตสำหรับ the same interrupt line. ในการกำหนดค่านี้, ทั้งคู่จะสร้าง a
          trigger condition.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 02:35:34 PM
11.9.4 Falling trigger selection register (EXTI_FTSR)

Address offset: 0x0C
Reset value: 0x0000 0000

(https://i.imgur.com/KAvFxlY.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 TRx: Falling trigger event configuration bit of line x
     0: Falling trigger ถูกปิดใช้งาน (สำหรับ Event and Interrupt) สำหรับ input line
     1: Falling trigger ถูกเปิดใช้งาน (สำหรับ Event and Interrupt) สำหรับ input line

Note: The external wakeup lines ถูกทริกที่ขอบ, ต้องไม่มีความบกพร่องถูกสร้างบน lines เหล่านี้.  ถ้า a falling edge เกิดขึ้นบน
          the external interrupt line ในขณะที่เขียนไปยัง the EXTI_FTSR register, the pending bit จะไม่ถูกเซ็ต.

          Rising and falling edge triggers สามารถถูกเซ็ตสำหรับ the same interrupt line. ในการกำหนดค่านี้, ทั้งคู่จะสร้าง a
          trigger condition.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 02:50:20 PM
11.9.5 Software interrupt event register (EXTI_SWIER)

Address offset: 0x10
Reset value: 0x0000 0000

(https://i.imgur.com/uXWlHKp.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 SWIERx: Software Interrupt on line x
     ถ้า interrupt ถูกเปิดใช้งานบน line x ใน the EXTI_IMR register, การเขียน '1' ไปยัง SWIERx bit เมื่อมันถูกเซ็ตที่ '0' จะเซ็ต
     the corresponding pending bit ใน the EXTI_PR register, ดังนั้นส่งผลให้ an interrupt request generation.
     บิตนี้ถูกเคลียร์โดยการเคลียร์ the corresponding bit ใน EXTI_PR (โดยการเขียน a 1 ไปยัง the bit).
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 02:57:36 PM
11.9.6 Pending register (EXTI_PR)

Address offset: 0x14
Reset value: undefined

(https://i.imgur.com/b7wtl22.png)

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:0 PRx: Pending bit
     0: ไม่มี trigger request เกิดขึ้น
     1: trigger request ที่เลือกเกิดขึ้น
     บิตนี้ถูกเซ็ตเมื่อ the selected edge event มาถึงบน the external interrupt line.
     บิตนี้ถูกเคลียร์โดยการโปรแกรมมันเป็น '1'.
Title: Re: STM32F7 11 Extended interrupts and events controller (EXTI)
Post by: tha on November 08, 2022, 03:02:26 PM
11.9.7 EXTI register map

Table 45 ให้ the EXTI register map และ the reset values.

(https://i.imgur.com/5YT60Mp.png)

          ดูที่ Section 2.2.2 บนน้า 69 สำหรับ the register boundary addresses