]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iso14443b.c
FIX: 'data print' - now don't crash the client when demodbuffer is empty
[proxmark3-svn] / armsrc / iso14443b.c
index 00d2e7a30601c21bcf2b52d9902f79c73c7f6e96..ed035d3a5e29d780a248da43ea2ca14dbee41e69 100644 (file)
@@ -216,16 +216,19 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) {
        *  -TO VERIFY THIS BELOW-
        * The mode FPGA_MAJOR_MODE_HF_SIMULATOR | FPGA_HF_SIMULATOR_MODULATE_BPSK which we use to simulate tag
        * works like this:  
-       * - A 1-bit input to the FPGA becomes 8 pulses at 847.5kHz (9.44µS)
-       * - A 0-bit input to the FPGA becomes an unmodulated time of 9.44µS
-       *
+       * - A 1-bit input to the FPGA becomes 8 pulses at 847.5kHz (1.18µS / pulse) == 9.44us
+       * - A 0-bit input to the FPGA becomes an unmodulated time of 1.18µS  or does it become 8 nonpulses for 9.44us
        *
+       * FPGA doesn't seem to work with ETU.  It seems to work with pulse / duration instead.
        * 
        * Card sends data ub 847.e kHz subcarrier
-       * 848k = 9.44µS  = 128 fc
-       * 424k = 18.88µS = 256 fc
-       * 212k = 37.76µS = 512 fc
-       * 106k = 75.52µS = 1024 fc
+       * subcar |duration| FC division
+       * -------+--------+------------
+       * 106kHz | 9.44µS | FC/128
+       * 212kHz | 4.72µS | FC/64
+       * 424kHz | 2.36µS | FC/32
+       * 848kHz | 1.18µS | FC/16
+       * -------+--------+------------
        *
        *  Reader data transmission:
        *   - no modulation ONES
@@ -453,7 +456,7 @@ static int GetIso14443bCommandFromReader(uint8_t *received, uint16_t *len) {
                
        StartCountSspClk();
        
-       volatile uint8_t b;
+       volatile uint8_t b = 0;
 
        // clear receiving shift register and holding register
        // What does this loop do? Is it TR1?
@@ -467,7 +470,6 @@ static int GetIso14443bCommandFromReader(uint8_t *received, uint16_t *len) {
        // Now run a `software UART' on the stream of incoming samples.
        UartInit(received);
 
-       b = 0;
        uint8_t mask;
        while( !BUTTON_PRESS() ) {
                WDT_HIT();
@@ -490,15 +492,14 @@ void ClearFpgaShiftingRegisters(void){
        volatile uint8_t b;
 
        // clear receiving shift register and holding register
-       while(!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY));
+       while(!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY)) {};
 
        b = AT91C_BASE_SSC->SSC_RHR; (void) b;
 
-       while(!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY));
+       while(!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY)) {};
 
        b = AT91C_BASE_SSC->SSC_RHR; (void) b;
-       
-               
+                       
        // wait for the FPGA to signal fdt_indicator == 1 (the FPGA is ready to queue new data in its delay line)
        for (uint8_t j = 0; j < 5; j++) {       // allow timeout - better late than never
                while(!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY));
@@ -1639,11 +1640,11 @@ void RAMFUNC SnoopIso14443b(void) {
                                if (triggered)
                                        LogTrace(Uart.output, Uart.byteCnt, time_start, time_stop, NULL, TRUE);
 
-                /* And ready to receive another command. */
-                UartReset();
-                /* And also reset the demod code, which might have been */
-                /* false-triggered by the commands from the reader. */
-                DemodReset();
+                               /* And ready to receive another command. */
+                               UartReset();
+                               /* And also reset the demod code, which might have been */
+                               /* false-triggered by the commands from the reader. */
+                               DemodReset();
                        } else {
                                time_start = GetCountSspClk() - time_0;
                        }
@@ -1771,4 +1772,4 @@ void SendRawCommand14443B_Ex(UsbCommand *c)
                //FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX | FPGA_HF_READER_TX_SHALLOW_MOD);              
        }
        
-}
+}
\ No newline at end of file
Impressum, Datenschutz