Forum: Mikrocontroller und Digitale Elektronik Wie kann ich den Befehl (Iso 15693) "Get multiple block protection status für em4233 slic verwenden?


von Ram R. (ramles)


Lesenswert?

Ich beschäftige mich seit Wochen mit dem Thema RFID und Berührungslose 
Identifizierung und Übetragung von Daten mit der Nahfeldkommunikation.
Hierbei habe ich mich anhand dieses vohandenen Code,welcher auch für den 
TI Mikrocontroller MSP430 gedacht ist.
Bisher habe ich meinen eigenen Code erstellt bzw. auch mit der Basis 
dieses schon vorhandenen Codes: 
https://github.com/ddkity/NFC-for-TI-Proj/find/master

Allerdings konnte ich bisher nicht entschlüsseln, warum der Befehl " Get 
multiple block protection status" bei mir nicht einwandfrei funktioniert 
hat.
Die Infos zum Befehl gibt es auf der Seite Nr. 16 in diesem PDF:
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwieifSJx6jxAhXxhv0HHVnuDKgQFnoECAYQAA&url=https%3A%2F%2Fwww.advanide.de%2Fwp-content%2Fuploads%2Fproducts%2Frfid%2Fem4233slic_ds.pdf&usg=AOvVaw3zMj_1f52lIl8Gk_vkEMg1

Mein Aktueller Code Schaut so aus:
1
void GLASSTAG_MSP_GET_PAGE (uint8_t ui8ReqFlag, uint8_t ui8FirstBlock, uint8_t ui8NumberOfBlocks)
2
{
3
    uint8_t ui8Offset = 0;
4
    uint8_t ui8LoopCount1               = 0;
5
    uint8_t ui8LoopCount2               = 0;
6
    uint8_t ui8BlockSize                = 0;
7
    uint8_t ui8LoopCount = 1;
8
    uint8_t ui8RxLength = 0;
9
    g_pui8TrfBuffer[ui8Offset++] = 0x8F;                        // Reset FIFO
10
    g_pui8TrfBuffer[ui8Offset++] = 0x91;                        // Send with CRC
11
    g_pui8TrfBuffer[ui8Offset++] = 0x3D;                        // Write Continuous
12
    g_pui8TrfBuffer[ui8Offset++] = 0x00;                        s// length
13
    g_pui8TrfBuffer[ui8Offset++] = 0xF0;                        // length
14
    g_pui8TrfBuffer[ui8Offset++] = 0x00;                        // Length of packet in bytes - upper and middle nibbles of transmit byte lengt
15
    g_pui8TrfBuffer[ui8Offset++] = 0xD0;                        // Length of packet in bytes - lower and broken nibbles of transmit byte length
16
    g_pui8TrfBuffer[ui8Offset++] = ui8ReqFlag;                  // ISO15693 flags
17
    g_pui8TrfBuffer[ui8Offset++] = 0x2C;                        // GET COMMAND CODE
18
    g_pui8TrfBuffer[ui8Offset++] = 0x16;                        //IC Mfg Code
19
20
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[0];    // Tag UID
21
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[1];    // Tag UID
22
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[2];    // Tag UID
23
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[3];    // Tag UID
24
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[4];    // Tag UID
25
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[5];    // Tag UID
26
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[6];    // Tag UID
27
        g_pui8TrfBuffer[ui8Offset++] = g_pui8Iso15693UId[7];    // Tag UID
28
29
        g_pui8TrfBuffer[ui8Offset++] = ui8FirstBlock;                       // Number of the first block to read from
30
        if (ui8NumberOfBlocks > 0)
31
        {
32
            g_pui8TrfBuffer[ui8Offset++] = ui8NumberOfBlocks-1;             // Index for number of blocks to be read - this value is one less than
33
        }
34
        else
35
        {
36
            UART_sendCString("START:AW_GET_PRO_PAGE_0:ENDE\n");
37
        }
38
39
    TRF79xxA_writeRaw(&g_pui8TrfBuffer[0], ui8Offset);                  // Issue the Get System Information command
40
    g_sTrfStatus = TRF79xxA_waitRxData(10,30+ui8NumberOfBlocks);        // 10 millisecond TX timeout, 30 millisecond RX timeout - adding number of blocks to extend timeout for larger read requests
41
    if (g_sTrfStatus == RX_COMPLETE)                            // If data has been received
42
    {
43
        if (g_pui8TrfBuffer[0] == 0x00)                                 // Confirm "no error" in response flags byte
44
        {
45
            #ifdef ENABLE_HOST
46
            ui8RxLength = TRF79xxA_getRxBytesReceived();
47
48
            if (ui8ReqFlag & BIT6)                                      // Handle case for Option Flag causing one extra byte to be transmitted.
49
            {
50
                ui8Offset = 2;
51
            }
52
            else
53
            {
54
                ui8Offset = 1;
55
            }
56
            ui8LoopCount1 = ui8RxLength-ui8Offset;
57
            while (ui8LoopCount1 > 0)
58
            {
59
                if (ui8LoopCount1 > ui8NumberOfBlocks)
60
                {
61
                    ui8LoopCount1 = ui8LoopCount1 - ui8NumberOfBlocks;
62
                }
63
                else
64
                {
65
                    ui8LoopCount1 = 0;
66
                }
67
                ui8BlockSize++;
68
            }
69
            for (ui8LoopCount2 = 0; ui8LoopCount2 < ui8NumberOfBlocks; ui8LoopCount2++)
70
            {
71
                UART_sendCString("START:AW_");
72
                UART_sendCString("BLOCK_");
73
                UART_putByte(ui8FirstBlock+ui8LoopCount2);      // Output block number
74
                UART_putChar('_');
75
                UART_sendCString(ui8_Protection_Status);
76
                for (ui8LoopCount1 = 0; ui8LoopCount1 < ui8BlockSize; ui8LoopCount1++)
77
                {
78
                    UART_putByte(g_pui8TrfBuffer[ui8Offset++]);     // Send out data read from tag to host
79
                }
80
                UART_sendCString("_1:ENDE");
81
            }
82
            #endif
83
        }
84
        else
85
        {
86
            UART_sendCString("START:AW_GET_PRO_PAGE_0:ENDE\n");
87
88
        }
89
    }
90
91
    else
92
    {
93
        UART_sendCString("START:AW_GET_PRO_PAGE_0:ENDE\n");
94
    }
95
96
}


Das Problem gerade, die Bedingung (    if (g_sTrfStatus == RX_COMPLETE) 
// If data has been received) ist immer falsch und der Mikrocontroller 
bekommt keine Daten wenn ich den String verschicke damit ich sehen ob 
die Blöcke geschützt sind.
Ich freue mich auf jeden Vorschlag oder Tipp.
im Voraus Vielen Dank für die Hilfe !

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.