This part is for members
Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.
Keep watching the free partsEtherCAT 1: one frame, one SYNC0
EtherCAT, part one: 25a's two-turn move comes in over EtherCAT as 1 ms points, and the episode follows one target, the 129,761 in the frame at 478.75 ms (30b's point of the move; this drive starts at 0), from the wire into the motor. It opens with the whole episode on one framework page: the frame writes 0x607A the moment it lands, as 30b's PDO did; SYNC0 doesn't raise the flag, it restarts the position loop so its ten ticks line up with the bus cycle, and one fixed tick, here tick 7, raises CSP's flag. The page: what the ESI file fixes before the cycle on the left, one millisecond's frame, SYNC0 and ten position ticks in the middle, tick 7's CspModeRun, the four slots, the motor and a table of real runs on the right. The bench, sil-mac/ep31: the Keil target YH_ETHERCAT's files compiled unchanged (the Beckhoff SSC stack, ecat_app.c, the LAN9252 driver ecat_app_hw.c and ecat_drv_sqi.c, ecat_callback.c), board.c's interrupt handlers cut by line number, the LAN9252 and the master the bench's (the ESI's EEPROM data loaded into the chip's registers), interrupts run in the board's NVIC order in zero time; no servohub line changed. Seven stops: the ESI file (SM2 at 0x1100, 26 bytes, four mandatory RxPDOs, 0x1601 starting with 0x607A in bytes 4–7; DC 0x300: SYNC0 once per bus cycle; the EEPROM sets 0x151 to 0xCC: SYNC0 drives a pin and also sets a bit in the AL event register; SAFEOP at 15 ms, the first SYNC0 at 30 ms, OP at 229 ms); the frame passes through the chip (478.75 ms, 0.25 ms before SYNC0; E1 FA 01 00 = 129,761; the same frame carries back the position at the SYNC0 before, 123,603; writing SM2's last byte sets event 0x0400 and pulls the IRQ pin low); into 0x607A at once (ECAT_EXTI_IRQ_TASK notes the tick the frame landed in and triggers the software interrupt EXTI1, because the pin's interrupt shares priority 2 with the current loop and the stack's slow work belongs at 5; PDI_Isr → PDO_OutputMapping reads the 26 bytes over QSPI → APPL_OutputMapping walks the list APPL_GenerateMapping built at SAFEOP and calls 0x607A's write callback, then keeps a copy in u32_buff; the line above, skip this while DC runs, is commented out); 30a's hallway (EtherCAT_Write_0x607A_Callback returns 0 and silently drops the value if the host holds control authority; otherwise the OD callback → set_Target_position → set_app_Target_position, joining one step past master_cia402_write_callback); SYNC0 (479.000 ms, its pin at priority 1; bsp_adaptive_pl_period_config counts 10 ticks → 31b; four lines restart TIM5 and the update event fires a tick at once, so tick 0 is SYNC0 itself; EXTI0 → Sync0_Isr → APPL_Application writes u32_buff again; 0xCC makes the IRQ pin fire too, and PDI_Isr sees the SYNC0 bit and calls Sync0_Isr a second time: three writes a cycle, the same value, none raises the flag); tick 7 (every 0.1 ms the position loop counts its tick, and at the latch index, 7, calls set_app_Target_update_state(true), board.c:216, the only such line in the EtherCAT build; at 479.7 ms the target enters the last slot: 125,829, 127,140, 128,451, 129,761; 0.7 ms after SYNC0, 0.95 ms after the frame; frames land just after tick 7, so the drive picked it → 31b); the motor (at 482.7 ms it is the oldest slot, the command exactly 129,761, the motor at 129,759; 3.95 ms from the wire to the command, 30b took 3.8; the command reaches 262,144 at 633.7 ms, the motor at 675.4 ms, never more than 49 counts behind). Two ways to say now: CANopen's SYNC raises the flag and whichever tick comes next takes the target, on the drive's own clock; EtherCAT's SYNC0 moves the ticks themselves, so the target goes in on the same tick every cycle. Not covered: how the drive counts 10 ticks, picks 7, and why OP comes at 229 ms → 31b; a drive clock that runs fast against SYNC0, and a master that goes quiet → 31c; the stack's insides are not in this course. Your turn: hand control authority to the host at 300 ms: the motor stays within 3 counts of 0, yet every frame's working counter is still 1, the state OP and the statusword 0x1237; the only clue is the position coming back.