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 partsCAN 2: PDOs and SYNC, the path every cycle takes
CAN, part two: in CSP (episode 26) the master sends a new target every millisecond. Here 25a's two-turn move comes in over CANopen as 1 ms points, and the episode follows one target, the 129,760 in the RPDO at 219.2 ms, from the wire into the motor. It opens with the whole episode on one framework page: a PDO is a frame with no reply, its bytes agreed in advance by SDO, and it writes 0x607A at once; the SYNC only raises a flag, and the next position tick pushes whatever 0x607A holds into CSP's four-slot buffer. The page: the mappings set by SDO before the cycle on the left, one millisecond's RPDO and SYNC paths in the middle, the next tick's CspModeRun, the four slots and a table of real runs on the right. The bench, sil-mac/ep30 (CANopen build, with a csp_planning probe recording the four slots; no servohub line changed). Seven stops: the agreement (0x1600:1 = 0x607A0020: index, subindex, 32 bits; RPDO1 = 0x200 + node = 0x215, TPDO1 carries 0x6064 on 0x195, 0x1800:2 = 1 sends it on every SYNC; mode 8, enable; the first SYNC's TPDO1 reads −1, the master's start); the RPDO arrives (0x215 E0 FA 01 00 = 129,760; canDispatch: 0x215 >> 7 = 4 = PDO1rx → proceedPDO finds RPDO1 by its COB-ID, reads the mapping, copies 32 bits, setODentry(0x607A, 0)); 30a's hallway (_setODentry's hook → master_cia402_write_callback → … → set_app_Target_position; no reply, and a refusal is only an error message); SYNC (0x080, zero bytes: canDispatch → proceedSYNC → _sendPDOevent → buildPDO reads 0x6064 → TPDO1 01 EB 01 00 = 125,697; the first SYNC also sends three empty TPDOs, TPDO2 to 4, once); the flag (fdcan_canopen_hendle line 230: 0x080 and Operational, which the board sets itself at boot, then set_app_Target_update_state(true)); the buffer (the next 0.1 ms tick, CspModeRun clears the flag and takes 0x607A = 129,760, as is at 1:1 with no load encoder; the four slots become 125,828, 127,139, 128,450, 129,760; an RPDO after its SYNC waits for the next one, and sending it before the SYNC gets every point in 1 ms earlier, the command ending at 373 ms instead of 374); the motor (at 223 ms the command passes 129,760, the motor is at 129,763; 3.8 ms from the wire to the command; 471 SYNCs, 953 frames, 262,143 at 417 ms, never more than 52 counts behind). Then: RPDOs with no SYNC take 0x607A to 262,143 and the motor never moves; plain CAN has no SYNC at all, so CSP never moves there either (only drv_can_app.c:232 and board.c:216 raise the flag). The master goes quiet after 219.2 ms: 129,760 never enters the buffer, the command jumps to 128,450 at 221.1 ms (26b's rule), the motor brakes from 600 rpm by 224 ms, sags to 127,992 and is back within three counts by 335 ms; statusword 0x1237, error 0, heartbeat still 05: it tells no one. The heartbeat watchdog fails at three layers: 0x1016 is 0 by default; written at run time it arms nothing (its timer starts only in heartbeatInit); armed after a reset-communication, the master's heartbeat 0x701 is dropped by the filter, so the master is marked lost while still talking, and the loss calls an empty heartbeatError. The fix branch fix/canopen-heartbeat-filter adds a third filter, 0x701 to 0x77F: the heartbeat gets in, the master is marked lost only after it goes quiet, the motor does exactly the same; quick stop or fault on a lost master is the author's design choice. Not covered: the CiA402 state machine → episode 23; emergency frames, node management, segmented SDOs are not in this course; EtherCAT → episode 31. Your turn: 0x1800:2 = 10 gives 48 TPDO1 frames over 471 SYNCs (one at the write, then 47).