Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tha

Pages: [1] 2 3 ... 620
1
ARM Processors / Re: STM32 Timers #9. One Pulse Mode
« on: March 04, 2023, 02:35:49 pm »
                                                                                Additional Setting

Generating Multiple pulses

การกำหนดค่าข้างต้นจะสร้าง a single pulse ของการหน่วงเวลาและ pulse width ที่กำหนดไว้ล่วงหน้า. หากคุณต้องการสร้าง a pulse train บน a single trigger signal, คุณต้องเขียนค่าใน the Repetition counter. นี้ถูกแสดงไว้ด้านล่าง.



การกำหนดค่าส่วนที่เหลือยังคงเหมือนเดิม ฉันได้แก้ไข the Repetition counter value เป็น 5 (6-1) เท่านั้น การจัดเตรียมนี้จะสร้าง the 6 pulses ที่มีความกว้างเท่ากันเมื่อได้รับ a trigger signal บน the channel 2.

2
ARM Processors / Re: STM32 Timers #9. One Pulse Mode
« on: March 04, 2023, 11:28:17 am »
Timer configuration

ฉันจะใช้ timer 1 สำหรับ application นี้. The setup ถูกแสดงข้างล่าง.



1.  The timer ต้องถูกกำหนดค่าใน the slave mode ด้วย trigger mode.
     •  ฉันได้เลือก the trigger source เป็น TI2FP2, คือ the channel 2 of the timer. ที่นี่เราจะเชื่อมต่อ the signal pin.
     •  The channel 1 จะถูกใช้สำหรับ the output compare. ที่นี่เราจะได้รับ the output จาก the timer.
2.  ตรวจสอบให้แน่ใจว่าได้เลือก the one pulse mode.
3.  The prescalar ที่ 90 จะทำให้ the clock ลดลงเป็น 1MHz. นี่คืออัตราที่ the counter นับและแต่ละนับจะใช้เวลา 1us.
     •  ฉันได้เซ็ต the ARR เป็น 50000, ดังนั้น the maximum width ของ the pulse จะเป็น 50ms.
     •  โปรดทราบว่า the Repetition counter ถูกเซ็ตเป็น 0, ซึ่งหมายความว่าเราต้องการเพียง a single pulse. หากคุณตั้งค่านี้เป็น 10
         (11-1), จะมี 11 pulses สำหรับแต่ละ trigger.
4.  The Mode ใน output compare จะถูกเปลี่ยนแปลงในภายหลังใน the code.
     •  The pulse value (the CCR1 value) ถูกเซ็ตเป็น 10000. นี่หมายความว่า the pulse จะถูกหน่วงเวลา 10000 counts, คือ
         10ms หลังจาก the trigger.

การกำหนดค่าข้างต้นจะสร้าง a pulse of 40ms (ARR – CCR) ในแต่ละ trigger บน channel 2 ของ the timer 1.

เราใช้ 2 channels สำหรับ the timer 1, ข้างล่างคือ the pinout สำหรับสิ่งเดียวกัน.



ที่นี่ the pin PA9 (TIM1_CH2) จะถูกใช้เป็น the input pin, ที่ที่เราจะส่ง the external signal. และ the pin PA8 (TIM1_CH1) จะถูกใช้เป็น the output pin, ที่ที่ the one pulse จะถูกสร้าง. เราจะมอนิเตอร์สิ่งนี้บน the oscilloscope.

3
ARM Processors / Re: STM32 Timers #9. One Pulse Mode
« on: March 04, 2023, 10:50:05 am »
                                                                                  CubeMX Setup

Clock configuration



ฉันได้กำหนดค่า the 8 MHz external crystal เพื่อจัดให้มี the clock. The system จะรันที่ 90MHz และโปรดทราบว่าทั้งสอง the APB timer clocks จะรันที่ 90MHz เช่นกัน. สิ่งนี้จะทำให้เรากำหนดค่า the timer ได้ง่ายขึ้น เนื่องจากเราไม่ต้องกังวลว่า timer ใดจะถูกต่อกับ APB bus ใด.

4
ARM Processors / STM32 Timers #9. One Pulse Mode
« on: March 04, 2023, 09:26:52 am »
https://controllerstech.com/stm32-timers-9-one-pulse-mode/

ขอแปลหน่อยนะครับ ขอขอบคุณเขามา ณ ที่นี้ด้วย ท่านใดพอจะมีทรัพย์ก็ Donate เขาด้วยนะ ฟังภาษาอังกฤษเขาในยูทูบก็ฟังง่ายดี(เปิดคำบรรยายด้วย)ครับ

                                                        STM32 Timers #9. One Pulse Mode

นี้เป็น the 9th tutorial ใน the STM32 Timer series และวันนี้เราจะเห็น timer feature อื่น, ตัวอย่างเช่น the one pulse mode.

One-pulse mode ถูกใช้เพื่อสร้าง a pulse ของ a programmable length เพื่อตอบสนองต่อ an external event. The pulse สามารถสตาร์ททันทีที่ the input trigger มาถึงหรือหลังจาก a programmable delay. เราสามารถควบคุมการสตาร์ทของ the pulse ได้เช่นเดียวกับ the pulse width.

The waveform สามารถถูกโปรแกรมเพื่อให้มี a single pulse ที่สร้างโดย the trigger, หรือเพื่อให้มี a continuous pulse train ที่สตาร์ทโดย  a single trigger.

One-pulse mode ยังเสนอตัวเลือกที่สามารถทริกซ้ำได้ ในกรณีนี้ ทริกใหม่ที่มาถึงก่อนจุดสิ้นสุดของ the pulse จะทำให้ the counter ถูกรีเซ็ตและความกว้างของพัลส์จะถูกขยายตามไปด้วย.


5
ARM Processors / Re: STM32 Ethernet #8 UDP Client using LWIP NETCONN (RTOS)
« on: February 27, 2023, 10:55:41 am »
<a href="https://www.youtube.com/v/63MH_MzMem0" target="_blank" class="new_win">https://www.youtube.com/v/63MH_MzMem0</a>

6
ARM Processors / Re: STM32 Ethernet #8 UDP Client using LWIP NETCONN (RTOS)
« on: February 27, 2023, 10:53:15 am »
                                                                              Result

ข้างล่างคือ the screenshot ของ the data ที่ส่งโดย the client และ the response ที่ส่งโดย the server.



•   ดังที่แสดงไว้ด้านบน, the client จะคงการส่งค่าของ the index variable ทุกๆ 500ms.
•   เมื่อใดก็ตามที่ the server ส่ง some data ไปยง client, มันจะแก้ไข the data และส่งมันกลับไปยัง the client.
•   และอีกครั้งมันสตาร์ทการส่งค่าที่อัฟเดตของ the index variable.

7
ARM Processors / Re: STM32 Ethernet #8 UDP Client using LWIP NETCONN (RTOS)
« on: February 27, 2023, 10:31:52 am »
The udpsend function:



The udpsend function จะส่ง the data ไปยัง the server.
•   ที่นี่ก่อนอื่นเราจะจัดสรร a netbuf structure, ซึ่ง pointer จะถูกเก็บไว้ใน buf.
•   เพื่อก๊อปปี้ the data ลงใน the pbuf of the netbuf, เราใช้ the nebuf_ref เพื่อเชื่อมโยง the data pointer กับ a netbuf.
•   netcon_send จะส่ง the buf ปยัง the connected destination (server ในกรณีนี้)
•   สุดท้ายยกเลิกการจัดสรร the netbuf structure.

8
ARM Processors / Re: STM32 Ethernet #8 UDP Client using LWIP NETCONN (RTOS)
« on: February 27, 2023, 10:18:18 am »
The udpsend_thread:



The udpsend_thread จะส่ง the data ทุกๆ 500ms, โดยไม่คำนึงว่า the server จะส่งการตอบกลับใดๆ หรือไม่.
•   ที่นี่ฉันเก็บค่าของ the index variable ใน smsg array.
•   จากนั้นส่ง data ไยัง the server โดยใช้ the function udpsend.
•   ขบวนการนี้ทำซ้ำทุกๆ 500ms.

Pages: [1] 2 3 ... 620