card_emu: Avoid PTS related race-condition
We should not set the new Fi/Di values before we actually transmitted
the PTSS PCK at the old baud rate first.
diff --git a/firmware/src_simtrace/card_emu.c b/firmware/src_simtrace/card_emu.c
index 5f0ee7c..6593daa 100644
--- a/firmware/src_simtrace/card_emu.c
+++ b/firmware/src_simtrace/card_emu.c
@@ -440,8 +440,6 @@
break;
case PTS_S_WAIT_RESP_PCK:
byte = ch->pts.resp[_PCK];
- /* update baud rate generator with Fi/Di */
- emu_update_fidi(ch);
break;
default:
TRACE_ERROR("get_byte_pts() in invalid state %u\r\n",
@@ -456,6 +454,8 @@
switch (ch->pts.state) {
case PTS_S_WAIT_RESP_PCK:
+ /* update baud rate generator with Fi/Di */
+ emu_update_fidi(ch);
/* Wait for the next TPDU */
card_set_state(ch, ISO_S_WAIT_TPDU);
set_pts_state(ch, PTS_S_WAIT_REQ_PTSS);