STM32F1 EXTI

Started by tha, September 21, 2020, 09:04:51 AM

Previous topic - Next topic

tha

10.2.5 External interrupt/event line mapping
The 112 GPIOs ถูกต่อถึง the 16 external interrupt/event lines ในลักษณะดังต่อไปนี้ :


1. เพื่อกำหนดค่า the AFIO_EXTICRx สำหรับการ mapping ของ external interrupt/event lines ไปยัง GPIOs, the AFIO
clock ต้องถูกเปิดใช้งานก่อน. ดูที่ Section 7.3.7: APB2 peripheral clock enable register (RCC_APB2ENR) for low-, medium-, high- and XL-density devices and, to Section 8.3.7: APB2 peripheral clock enable register (RCC_APB2ENR) for connectivity line devices.

EXTI lines อื่นอีก 4 สายถูกเชื่อมต่อดังนี้ :
   • EXTI line 16 ถูกต่อถึง the PVD output
   • EXTI line 17 ถูกต่อถึง the RTC Alarm event
   • EXTI line 18 ถูกต่อถึง the USB Wakeup event
   • EXTI line 19 ถูกต่อถึง the Ethernet Wakeup event (มีให้ใช้งานใน connectivity line devices เท่านั้น)

tha

10.3 EXTI registers
ดูที่ Section 2.2 ที่หน้า 45 สำหรับรายการตัวย่อที่ใช้ใน register descriptions.
The peripheral registers ต้องถูกเข้าถึงโดย words (32-bit).



Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
Bits 19:0 MRx: Interrupt Mask on line x (0 ถึง 19)
   0: Interrupt request จาก Line x ถูก masked       (ไม่ยอมให้เกิดอินเตอรัพท์)
   1: Interrupt request จาก Line x ไม่ถูก masked    (ยอมให้เกิดอินเตอรัพท์)
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น.

ปล. บอกไปผิดเรื่อง mask คือ ถ้า mask เป็น '0' จะไม่ยอมให้เกิดการอินเตอรัพท์ ถ้าไม่ mask จะเป็น '1' ยอมให้เกิดการอินเตอรัพท์ได้ โทษทีบอกผิดไป ต้องขอกลับไปแก้กันสักหน่อย สับสนๆ

tha



Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
Bits 19:0 MRx: Event mask on line x (0 ถึง 19)
   0: Event request(การร้องขอ Event) จาก Line x ถูก masked  (ไม่ยอมให้เกิด Event)
   1: Event request (การร้องขอ Event) จาก Line x ไม่ถูก masked  (ยอมให้เกิด Event)
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น.


tha



     Bits 31:20 Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
     Bits 19:0 TRx: Rising trigger event configuration bit ของ line x
     0: ปิดการใช้งาน Rising trigger (สำหรับ Event และ Interrupt) สำหรับ input line
     1: เปิดการใช้งาน Rising trigger (สำหรับ Event และ Interrupt) สำหรับ input line
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น

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

         Rising และ Falling edge triggers สามารถถูกตั้งสำหรับ the same(เดียวกัน) interrupt line. ในการกำหนดอย่างนี้, ทั้งขอบขา
         ขึ้นและลงจะสร้าง trigger ทั้งคู่

tha



     Bits 31:20 Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
     Bits 19:0 TRx: Falling trigger event configuration bit ของ line x
     0: ปิดการใช้งาน Falling trigger (สำหรับ Event และ Interrupt) สำหรับ input line
     1: เปิดการใช้งาน Falling trigger (สำหรับ Event และ Interrupt) สำหรับ input line
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น

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

         Rising และ Falling edge triggers สามารถถูกตั้งสำหรับ the same(เดียวกัน) interrupt line. ในการกำหนดอย่างนี้, ทั้งขอบขา
         ขึ้นและลงจะสร้าง trigger ทั้งคู่

tha



     Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
     Bits 19:0 SWIERx: Software interrupt on line x
        ถ้า the interrupt ถูกเปิดการใช้งานบน line ใน the EXTI_IMR, การเขียน '1' ไปยังบิตนี้ขณะที่มันถูกเซ็ตเป็น '0' อยู่ จะเซ็ต
        corresponding(ที่ตรงกัน) pending bit ใน EXTI_PR ผลคือมีการร้องขออินเตอรัพท์ (interrupt request) เกิดขึ้น.
        บิตนี้ถูกเคลียร์โดยการเคลียร์บิตที่ตรงกันของ EXTI_PR (โดยการเขียน 1 ไปยังบิตนี้).
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น

tha



     Bits 31:20 สงวนไว้, ต้องเก็บเอาไว้ที่ reset value (0).
     Bits 19:0 PRx: Pending bit
     0: No trigger request occurred   (ไม่มี trigger request(ขอบขาขึ้นหรือขาลง) เกิดขึ้น)
     1: selected trigger request occurred   (มี trigger request(ขอบขาขึ้นหรือขาลง)ที่เลือกเกิดขึ้น)
     บิตนี้ถูกเซ็ตเมื่อ the selected edge event(ขอบขาที่เลือก) มาถึงบน the external interrupt line. บิตนี้เคลียร์โดยการเขียน '1'
     ไปยังบิตนี้
Note: Bit 19 ถูกใช้ใน connectivity line devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น

ปล. อย่างงนะ pending bit ถูกเคลียร์โดยการเขียน '1' ไปยังบิตนี้ (ขณะที่บิตนี้เป็น '1' อยู่นะครับ)

tha

10.3.7 EXTI register map
          ตารางดังต่อไปนี้แสดง the EXTI register map และ the reset values. Bit 19 ถูกใช้ใน connectivity line
          devices(STM32F105xx และ STM32F107xx) เท่านั้น และถูกสงวนไว้ถ้าเป็นเบอร์อื่น



         ดูที่ตารางที่ 3 บนหน้า 50 สำหรับ the register boundary addresses.