Menu

How did the _initial_etu calcuated for 2DOT5Mhz?

Bruce Lee
2014-08-29
2016-07-27
  • Bruce Lee

    Bruce Lee - 2014-08-29

    Dear Friends,
    How did the _initial_etu calcuated for 2DOT5Mhz?
    in SCLib.cpp file. line 105.

    case CLK_2MHZ:
      _initial_etu  = 186;   <<<< this one.
      _guardTime    = 2 * _initial_etu;
      _ocra1        = 3;
      break;
    case CLK_2DOT5MHZ:
      _initial_etu  = 148;  <<<< this one.
      _guardTime    = 2 * _initial_etu;
      _ocra1        = 2;
      break;
    case CLK_4MHZ:
      _initial_etu  = 93;
      _guardTime    = 2 * _initial_etu;
      _ocra1        = 1;
      break;
    

    the default ETU for ISO7816-3 is 372 and the clock is 3.59Mhz
    so in your code why clock runs at 2Mhz the ETU is 186. (372/2 = 186).

    hope you can help me to calcuate the clock runs at 3.2534 Mhz and what the ETU should be .

    Bruce lee

     
    • angus71

      angus71 - 2014-09-08

      Hi Bruce,

      As I understood the ISO7816-3 the "372" value is not a time, but a divider (D) of the used frequency.

      So if you use for example a 1MHz clock you get the following values

      fc / D = 1MHz / 372 = ~2688 bit/s, which leads to a time per bit of 372us

      So for your example it should be

      3.59Mhz / 372 = ~9650 bit/s -> etu = 103us

      With the given frencecy of 3.59MHz one bit should take around 103us (micro seconds).

      If you have any questions just let me know.

      With kind regards

      Angus

       
      • caocongcong

        caocongcong - 2016-07-27

        Dear friend,
        I am a student from china. The default ETU for ISO7816-3 is 372 and the clock is 3.59Mhz, so I just want to communication in 3.59MHz/372 = 9600 bit/s, my smartcard has its own clock, which is 3.59MHz.
        After reading your code, I can hardly find a way to initial the function with you code.
        hope you can help me.
        cao congcong

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.