AnsweredAssumed Answered

K64 SmartCard Interface: The error when handling 1 byte response(Procedure Byte)

Question asked by YK Lee on Oct 24, 2016
Latest reply on Nov 11, 2016 by Iva Susnova

Dear Team,


One of my customer is developing some product with K64 and SmartCard interface.

But he found some error when handling 1 byte response(Procedure byte) like below.



static smartcard_core_error_t ttl_send_cmd_t0(smartcard_core_params_t *coreParams,

                                              smartcard_ttl_cmd_t *ttlCmd,

                                              smartcard_ttl_resp_t *ttlRespPtr)



else if (coreParams->Case == kSCCommandCase3)  -> Even case 1 and 2 have a same problem.


        /* send command header */

        send_data(coreParams, header, 5u);

        tc = 0u;



            /* Get procedure/status byte(s) */

            receive_data(coreParams, ttlRespPtr->resp, 2u, &rcvLength); 

            while ((rcvLength == 2u) && (ttlRespPtr->resp[0u] == 0x60u))  -> Actually one PB byte can be received.(please refer to below )

    But at this code if 2 bytes are not received, 1 byte PB is not   proceeded.  So finally system waits until time out.


                ttlRespPtr->resp[0u] = ttlRespPtr->resp[1u];


                if ((ttlRespPtr->resp[0u] == header[1u]) || ((ttlRespPtr->resp[0u] ^ (header[1u])) == 0xFFu))




                temp32 = 0u;

                receive_data(coreParams, (ttlRespPtr->resp + 1u), 1u, &temp32);

                rcvLength += temp32;



As you can see this driver cannot handle one byte response normally.

Have you ever used SmartCard driver with K64 or another Kinetis chips?

If yes, could you please share your experience?


And below is the part of ISO7816 spec.


Thanks a lot for your help in advance.


Best Regards,


YK Lee