2026年1月7日 星期三

ESP32-CAM 實作 RTSP 多人連接

ESP32-CAM 實作 RTSP 多人連接主要受限於硬體資源(CPU 與記憶體)及軟體架構。一般預設範例僅支援單一連線,若需多人同時查看,請參考以下:
ESP32-RTSPServer:這是一個現代化的庫,支援多人同時連線(Multicast 或 Unicast),並可設定連線數上限(例如 maxRTSPClients = 5)。

在專案中的
void setup() {}中, 新增
rtspServer.maxRTSPClients = 5;
這樣就可以同時5個連線




針對固定USB裝置上帶出的Com port號碼進行清除

針對相同硬體不同SN的裝置, 在系統所帶出的COM Port號碼, 會越來越多. 
可透過pnputil.exe這個工具來進行清除.
以下是在c#的環境所編寫
// 例如"USB\VID_XXXX&PID_XXXX\XXXXXXXX"
public void RemoveDeviceByInstanceId(string instanceId)
{

//ProcessStartInfo psi = new ProcessStartInfo("pnputil.exe");

ProcessStartInfo psi = new ProcessStartInfo();

psi.FileName = @"C:\Windows\System32\pnputil.exe";

psi.Arguments = $"/remove-device /deviceid \"{instanceId}\""; 

psi.RedirectStandardOutput = true; // 重新導向標準輸出

psi.RedirectStandardError = true; // 重新導向錯誤輸出

psi.UseShellExecute = false; // 必須設為 false 才能重新導向輸出

psi.CreateNoWindow = true; // 不建立視窗

try

{

using (Process p = Process.Start(psi))

{

// 讀取輸出流

string output = p.StandardOutput.ReadToEnd();

string error = p.StandardError.ReadToEnd();

p.WaitForExit();

Console.WriteLine("PnPUtil 輸出: " + output);

ATECtl.GridData.WriteMessage(ATECtl.GridData._TPars.richtextbox, "PnPUtil 輸出:", output, Color.Blue, Color.Green);

Console.WriteLine("PnPUtil 錯誤: " + error);

ATECtl.GridData.WriteMessage(ATECtl.GridData._TPars.richtextbox, "PnPUtil 錯誤", error, Color.Blue, Color.Green);

Console.WriteLine($"結束代碼: {p.ExitCode}");

ATECtl.GridData.WriteMessage(ATECtl.GridData._TPars.richtextbox, "結束代碼", $"{p.ExitCode}", Color.Blue, Color.Green);

}

}

catch (Exception ex)

{

Console.WriteLine($"執行 Process.Start 失敗 (檔案可能不存在): {ex.Message}");

ATECtl.GridData.WriteMessage(ATECtl.GridData._TPars.richtextbox, "執行 Process.Start 失敗 (檔案可能不存在)", "", Color.Blue, Color.Green);

}

}

2025年12月18日 星期四

針對固定USB裝置上帶出的Com port位置下指令

使用了兩個同樣規格同類型之USB Serial Part裝置,在每次電腦重新啟動,可能因為啟動或讀取的順序關係,會造成與原先所使用的Com Port不同,有時電腦重新啟動即可復原,但如何使每次開機都可以固定在所設定的Com Port上呢?

可以利用

在裝置管理員上在COM Port的裝置上按滑鼠右鍵出現的內容上 位置的資料
利用這個資料只要不去換USB的PORT位置就可針對這個裝置下指令!

2025年12月17日 星期三

nRF52 PCA10040 DK 量產 nrf52840 產品

The nRF52 Development Kit (PCA10040) hardware provides support for the Nordic Semiconductor nRF52832 ARM Cortex-M4F CPU and the following devices:
ADC
CLOCK
FLASH
GPIO
I2C
MPU
NVIC
PWM
RADIO (Bluetooth Low Energy)
RTC
Segger RTT (RTT Console)
SPI
UART
WDT

利用 這個J-Link Prog Connector

PIN #
Signal Name
1    VDD
2    IMCU_TMSS
3    GND
4    IMCU_TCKS
5    V5V
6    IMCU_TDOS
7    Cut off
8    IMCU_TDIS
9    Cut off
10    IMCU_RESET

來做燒錄nrf52840 DUT的FW.
介面設計是同時燒錄四組DUT並且去偵測帶出的com port!
Demo Vedio: