@@ -926,24 +926,37 @@ struct Iso7816::Impl : IsoTech
926
926
case IsoRequestFrame:
927
927
{
928
928
frameStatus.frameType = IsoResponseFrame;
929
- frameStatus.guardTime = protocolStatus.characterGuardTime - GT_THRESHOLD * protocolStatus.elementaryTime ;
930
- frameStatus.waitingTime = protocolStatus.blockWaitingTime + WT_THRESHOLD * protocolStatus.elementaryTime ;
931
929
break ;
932
930
}
933
931
case IsoResponseFrame:
934
932
{
935
933
frameStatus.frameType = IsoRequestFrame;
936
- frameStatus.guardTime = protocolStatus.characterGuardTime - GT_THRESHOLD * protocolStatus.elementaryTime ;
937
- frameStatus.waitingTime = protocolStatus.blockWaitingTime + WT_THRESHOLD * protocolStatus.elementaryTime ;
938
934
break ;
939
935
}
940
- default :
936
+ }
937
+
938
+ // N=255 has a protocol-dependent meaning:
939
+ // - GT=12 ETU under protocol T=0 nad during PPS (Protocol and Parameters Selection)
940
+ // - GT=11 ETU under protocol T=1 (corresponding to 1 start bit, 8 data bits, 1 parity bit, and 1 stop bit; with no error indication)
941
+ if (protocolStatus.extraGuardTimeUnits == 255 )
942
+ {
943
+ if (protocolStatus.protocolType == PROTO_T0)
941
944
{
942
- frameStatus.guardTime = protocolStatus.characterGuardTime - GT_THRESHOLD * protocolStatus.elementaryTime ;
943
- frameStatus.waitingTime = protocolStatus.characterWaitingTime + WT_THRESHOLD * protocolStatus.elementaryTime ;
945
+ frameStatus.guardTime = (12 - GT_THRESHOLD) * protocolStatus.elementaryTime ;
944
946
}
947
+ else
948
+ {
949
+ frameStatus.guardTime = (11 - GT_THRESHOLD) * protocolStatus.elementaryTime ;
950
+ }
951
+ }
952
+ else
953
+ {
954
+ frameStatus.guardTime = protocolStatus.characterGuardTime - GT_THRESHOLD * protocolStatus.elementaryTime ;
945
955
}
946
956
957
+ // waiting time is set by default to 960 ETUs for T=0 and 9600 ETUs for T=1
958
+ frameStatus.waitingTime = protocolStatus.characterWaitingTime + WT_THRESHOLD * protocolStatus.elementaryTime ;
959
+
947
960
// clear search to detect first start bit of next frame
948
961
modulationStatus.searchStartTime = 0 ;
949
962
modulationStatus.searchEndTime = 0 ;
0 commit comments