下面給大家介紹一下,如果用上位機(jī)(表端Host MCU)或者PC機(jī)來(lái)配置PLC表端模塊,進(jìn)行注冊(cè)連接的過(guò)程。
當(dāng)大家把Prime固件程序燒寫(xiě)到F28069,并上電后,從UARTA和UARTB同時(shí)都會(huì)收到下面的命令,此命令為:Read Blob request:96 00 04 00 01 00 04 00
1)當(dāng)不希望此命令重復(fù)出現(xiàn)時(shí),需要發(fā)送如下命令:
96 c0 08 00 01 00 04 00 00 00 00 00
此時(shí)會(huì)收到另外一條CRC32命令:96 00 04 00 00 00 04 00
2)再次發(fā)送如下命令:
96 c0 08 00 00 00 04 00 00 00 00 00
此時(shí),Read Blob request 將不再發(fā)送。
接著大家可以通過(guò)Get System Info來(lái)獲取當(dāng)前燒寫(xiě)固件的一些信息, 具體解釋如下:
Get System Info HOST? : Get System Info Request 01 80 04 00 2A 81 00 00 ? DSP ? : Get System Info Reply 01 00 34 00 E5 BF 00 00 01 01 02 07 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03?? 44 00 00 00 00 00 12 34 01 20 00 00 00 00 00 00?? 01 00 72 4D E9 80 76 AD ·???????? Firmware version (4 bytes): 01 01 02 07 (7.2.1.1) ·???????? Device Serial number length (2 bytes): 06 00 (6 bytes) ·???????? Device Serial Number (16 bytes): o??? 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ·???????? Device Type (one byte): 01 è PRIME IEC432 ·???????? Device Mode (one byte): 03 è P2P ·???????? Hardware Revision (2 bytes): 44 00 (0x0044) ·???????? EUI/MAC Address (6 bytes): 00 00 00 00 12 34 ·???????? Port Assignment (one byte): 01 o??? Diag Port: 0 àSCI-A o??? Data Port: 1 àSCI-B ·???????? PHY Setting (one byte): 20 o??? Auto Mode ·???????? Reserved (6 bytes): 00 00 00 00 00 00 (don’t care) ·???????? ARQ and PAC Flags (one byte): 01 ·???????? Security Profile (one byte): 00 ·???????? Reserved (6 bytes): 72 4D E9 80 76 AD (Don’t care) ? 緊接著大家需要通過(guò)Load System Config命令進(jìn)行SCI(UART)端口的配置,具體根據(jù)硬件上的設(shè)計(jì),來(lái)配置是UARTA還是UARTB口作為和MCU Host的通信接口。 另外,最重要的是要配置EUI地址,也就是表的MAC地址,在下面這個(gè)例子中,EUI地址被配置成12 34. Load System Config HOST? : Load System Config Request 0C 80 27 00 19 EB 23 45 01 00 01 00 05 03 00 1A 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1234 00 00 00 ·???????? TYPE: 01 00 (Port designation) ·???????? Length: 01 00 (one byte) ·???????? Value: 05 (Diag =SCI-B, Data=SCI-B) ·???????? TYPE: 03 00 (System configuration) ·???????? Length: 1A 00 (26 bytes) ·???????? Value: 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 34 00 00 o??? Serial number Length: 06 00 o??? Serial number (16 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 o??? EUI: 00 00 00 00 12 34 o??? Device Mode: 00 (Normal mode) o??? Auto Mode: 00 (manual mode) ? DSP?? : Load System Config Reply 0C 00 06 00 94 E5 00 00 00 00 ·???????? Status: 00 00 (success) ?當(dāng)Load System Config配置完成后,需要通過(guò)Soft Reset命令來(lái)保存設(shè)置。
Soft Reset HOST? : Soft Reset Request 05 80 06 00 B9 2D 00 00 00 00 ·???????? Reset type: 00 00 ? DSP?? : Soft Reset Reply 05 00 06 00 E3 16 00 00 00 00 ·???????? Status: 00 00 (success) 當(dāng)然,在Soft Reset之后,用戶(hù)可以通過(guò)Get System Info語(yǔ)句來(lái)查看設(shè)置是否成功。 接下來(lái)就是設(shè)置接收和發(fā)送的一些參數(shù),例如發(fā)送功率,調(diào)制模式,是否加上FEC和ROBO模式等等,當(dāng)然本身固件上是有默認(rèn)設(shè)置的,因此下面這兩條命令,在沒(méi)有必要的情況下,可以不做設(shè)置。 Set Info (PHY TX parameter) ? HOST? : Set Info Request 04 80 0E 00 A4 D2 8C E6 00 00 06 00 01 00 01 00 03 00 ·???????? TYPE: 00 00 (0x0000) è PHY TX Parameter ·???????? Length: 06 00 (6 bytes) ·???????? Value: 01 00 01 00 03 00 o??? Reserved (one byte) o??? PRM-ROBO-FEC: 00 o??? Modulation: 01 00 (0x0001 = BPSK) o??? TX Level: 03 00 (0x0003) ? DSP ? : Set Info Reply 04 00 06 00 57 60 00 00 00 00 ·???????? Status : 00 00 (success) Set Info (PHY RX parameter) ? HOST? : Set Info Request 04 80 0C 00 C6 B4 C6 37 01 00 04 00 01 00 00 00 ·???????? TYPE: 01 00 (0x0001) è PHY RX Parameter ·???????? Length: 04 00 (0x0004) ·???????? Value: 01 00 00 00 o??? Robo/AGC o??? ? DSP ? : Set Info Reply 04 00 06 00 57 60 00 00 00 00 ·???????? Status : 00 00 (success) ? 再接下來(lái)就是設(shè)置Alarm,Alarm有很多種情況,主要是用來(lái)通知Host主機(jī),現(xiàn)在PLC模塊所處的狀態(tài),用戶(hù)可以根據(jù)自己的情況來(lái)設(shè)置具體開(kāi)通哪些Alarm。 Set Up Alarm HOST? : Set Alarm Request 06 80 40 00 0F 11 82 E5 01 00 01 00 00 02 00 01 00 00 03 00 01 00 00 04 00 01 00 00 05 00 01 00 00 06 00 01 00 00 40 00 01 00 00 41 00 01 00 00 80 00 01 00 00 81 00 01 00 00 C0 00 01 00 00 FF 00 01 00 00 ·???????? TYPE: 01 00 (0x0001) è Network Deregistration alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 02 00 (0x0002) è Connection Request alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 03 00 (0x0003) è Disconnection Request alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 04 00 (0x0004) è Network Registration start alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 05 00 (0x0005) è Network Registration complete alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 06 00 (0x0006) è Connection complete alarm (Obsoleted) ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 40 00 (0x0040) è PHY PPDU header CRC failalarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 41 00 (0x0041) è PHY PPDU Syntax Error alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 80 00 (0x0080) è Terminal node Promotion alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: 81 00 (0x0081) è Switch node Demotion alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: C0 00 (0x00C0) è CL alarm//connection lost ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ·???????? TYPE: FF 00 (0x0080) è General alarm ·???????? Length: 01 00 (one byte) ·???????? Value:? 00 ? DSP ? : Set Alarm Reply 06 00 06 00 3F 8D 00 00 00 00 Status : 00 00 (success)接下來(lái),也是最重要的一句語(yǔ)句就是進(jìn)行注冊(cè),連接用的Attach語(yǔ)句。DSP在接到這句串口命令時(shí),首先要進(jìn)行Register的過(guò)程,然后進(jìn)行Connection的過(guò)程,因此需要一定的等待時(shí)間才能收到Attach Confirm的回復(fù)。具體過(guò)程請(qǐng)參考下一節(jié)的Sniffer軟件的使用說(shuō)明。
Attach Request HOST? : Attach Request 10 80 0C 00 90 65 CB 80 06 00 00 00 00 00 00 00 ·???????? Device ID Length: 06 00 ( 6 bytes) ·???????? Device ID: 00 00 00 00 00 00 ? Attach Confirm DSP ? : Attach Confirm 10 00 12 00 B6 7E 00 00 00 00 06 00 00 00 00 00 00 00 84 00 00 00?? ·???????? Status: 00 00 ·???????? Length:06 00 (6 bytes) ·???????? Device ID ( 6 bytes) 00 00 00 00 00 00 ·???????? Source Address: 84 00 ·???????? Base Address: 00 00 ? ?當(dāng)注冊(cè)和連接成功以后,就可以進(jìn)行數(shù)據(jù)傳輸了。數(shù)據(jù)的傳輸一定是由DC端發(fā)起的。
數(shù)據(jù)傳輸所需要的語(yǔ)句為Data Transfer, 當(dāng)Host 收到由DC來(lái)的命令時(shí),回復(fù)如下:
00 80 10 00 ED F4 00 00 01 00 00 00 00 00 00 00 00 00 01 02
所發(fā)送給DC端PLC模塊的數(shù)據(jù)位01 02
以上是對(duì)需要配置的串口命令的整理和所見(jiàn),如果大家希望查看關(guān)于具體串口命令的具體解釋?zhuān)?qǐng)參考附件中的文檔—TI_plcSUITE_host_msg.pdf
評(píng)論
查看更多