Skip to content

Commit

Permalink
Sync local SM PDIreg with ESC PDIreg at Mbx start
Browse files Browse the repository at this point in the history
When starting mailbox service, write the value of
ECAT RepeatRequest to PDI RepeatAck. Otherwise
it is risk of a race condition when running
CTT and the repeat ack would hold the value
of previous repeat ack test.

The race condition occurs on slow targets
that doesn't handle the repeat request
fast enough. The resulting mailbox read
will come before the mailbox is emptied
on the SM changed event.

fixes
  • Loading branch information
Andreas Karlsson committed Mar 18, 2024
1 parent 05bf6c6 commit ea46b50
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions soes/esc.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ uint8_t ESC_startmbx (uint8_t state)
else
{
ESCvar.toggle = ESCvar.SM[1].ECrep; //sync repeat request toggle state
ESCvar.SM[1].PDIrep = ESCvar.toggle;
ESC_SMwritepdi (1);
ESCvar.MBXrun = 1;
}
return state;
Expand Down Expand Up @@ -367,6 +369,8 @@ uint8_t ESC_startmbxboot (uint8_t state)
else
{
ESCvar.toggle = ESCvar.SM[1].ECrep; //sync repeat request toggle state
ESCvar.SM[1].PDIrep = ESCvar.toggle;
ESC_SMwritepdi (1);
ESCvar.MBXrun = 1;
}
return state;
Expand Down

0 comments on commit ea46b50

Please sign in to comment.