iGH EtherCAT初始化流程分析(三)

接上篇。
在执行完成从站设备SDO及PDO信息upload后,回到fsm_master状态机的scan_slave过程中,执行ec_master_calc_dc()
输出调试信息:

[102716.214019] EtherCAT 0: Bus scanning completed in 1412 ms.
[102716.214024] EtherCAT 0: Using slave 0 as DC reference clock.

执行ec_slave_calc_transmission_delays_rec()后输出调试信息:

[102716.214033] EtherCAT DEBUG 0-0: ec_slave_calc_transmission_delays_rec(delay = 0 ns)
[102716.214038] EtherCAT DEBUG 0-1: ec_slave_calc_transmission_delays_rec(delay = 680 ns)
[102716.214043] EtherCAT DEBUG 0-2: ec_slave_calc_transmission_delays_rec(delay = 1400 ns)
[102716.214047] EtherCAT DEBUG 0-3: ec_slave_calc_transmission_delays_rec(delay = 2100 ns)
[102716.214051] EtherCAT DEBUG 0-4: ec_slave_calc_transmission_delays_rec(delay = 2800 ns)
[102716.214056] EtherCAT DEBUG 0-5: ec_slave_calc_transmission_delays_rec(delay = 3540 ns)

执行完成write_system_times后,由于Master未激活,fsm_master状态机重启,重新进入start->broadcast状态。
此次会进入read_al_status状态 ,本次循环将会引导启动fsm_slave_config状态机(第一次循环是进入fsm_slave_scan),其输出的调试信息如下:

[102716.222122] EtherCAT DEBUG 0-0: Configuring...
[102716.222344] EtherCAT DEBUG 0-0: Now in INIT.
[102716.222350] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[102716.222398] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[102716.222448] EtherCAT DEBUG 0-0: Clearing DC assignment...
[102716.222497] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[102716.222506] EtherCAT DEBUG 0-0: SM0: Addr 0x1000, Size 128, Ctrl 0x26, En 1
[102716.222511] EtherCAT DEBUG 0-0: SM1: Addr 0x1400, Size 128, Ctrl 0x22, En 1
[102716.223330] EtherCAT DEBUG 0-0: Now in PREOP.
[102716.223335] EtherCAT DEBUG 0-0: Finished configuration.

在执行完成slave_config后,fsm_master进入action_idle状态,调用ec_fsm_slave_set_ready()将从站设备设置为ready状态,同时执行读取CoE字典,启动fsm_coe状态机。
输出调试信息如下:

[102716.250841] EtherCAT DEBUG 0-0: Ready for requests.
[102719.233417] EtherCAT DEBUG 0-0: Fetching SDO dictionary.
[102719.235472] EtherCAT DEBUG 0-0: SDO list fragments left: 4
[102719.237107] EtherCAT DEBUG 0-0: SDO list fragments left: 3
[102719.238380] EtherCAT DEBUG 0-0: SDO list fragments left: 2
[102719.239864] EtherCAT DEBUG 0-0: SDO list fragments left: 1
[102720.427796] EtherCAT DEBUG 0-0: Fetched 259 SDOs and 441 entries.

至此,初始化过程完成。
下一步的工作为用户程序请求Master设备,进入 OPERATION状态。

你可能感兴趣的:(EtherCAT)