下面给大家介绍一下,如果用上位机(表端Host MCU)或者PC机来配置PLC表端模块,进行注册连接的过程。
当大家把Prime固件程序烧写到F28069,并上电后,从UARTA和UARTB同时都会收到下面的命令,此命令为:Read Blob request:96 00 04 00 01 00 04 00
1)当不希望此命令重复出现时,需要发送如下命令:
96 c0 08 00 01 00 04 00 00 00 00 00
此时会收到另外一条CRC32命令:96 00 04 00 00 00 04 00
2)再次发送如下命令:
96 c0 08 00 00 00 04 00 00 00 00 00
此时,Read Blob request 将不再发送。
接着大家可以通过Get System Info来获取当前烧写固件的一些信息, 具体解释如下:
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) 紧接着大家需要通过Load System Config命令进行SCI(UART)端口的配置,具体根据硬件上的设计,来配置是UARTA还是UARTB口作为和MCU Host的通信接口。 另外,最重要的是要配置EUI地址,也就是表的MAC地址,在下面这个例子中,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)当Load System Config配置完成后,需要通过Soft Reset命令来保存设置。
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) 当然,在Soft Reset之后,用户可以通过Get System Info语句来查看设置是否成功。 接下来就是设置接收和发送的一些参数,例如发送功率,调制模式,是否加上FEC和ROBO模式等等,当然本身固件上是有默认设置的,因此下面这两条命令,在没有必要的情况下,可以不做设置。 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) 再接下来就是设置Alarm,Alarm有很多种情况,主要是用来通知Host主机,现在PLC模块所处的状态,用户可以根据自己的情况来设置具体开通哪些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)接下来,也是最重要的一句语句就是进行注册,连接用的Attach语句。DSP在接到这句串口命令时,首先要进行Register的过程,然后进行Connection的过程,因此需要一定的等待时间才能收到Attach Confirm的回复。具体过程请参考下一节的Sniffer软件的使用说明。
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当注册和连接成功以后,就可以进行数据传输了。数据的传输一定是由DC端发起的。
数据传输所需要的语句为Data Transfer, 当Host 收到由DC来的命令时,回复如下:
00 80 10 00 ED F4 00 00 01 00 00 00 00 00 00 00 00 00 01 02
所发送给DC端PLC模块的数据位01 02
以上是对需要配置的串口命令的整理和所见,如果大家希望查看关于具体串口命令的具体解释,请参考附件中的文档—TI_plcSUITE_host_msg.pdf
评论
查看更多