hallo, hat jemand hier im forum schon mal mit dem mfrc523 von nxp gearbeitet? ich möchte gern die id eines mifare-transponders auslesen, eigentlich eine ganz simple sache...dachte ich zumindest ;-) die kommunikation steht,ich kann also auf alle register zugreifen und diese auch beschreiben, die nötigen einstellungen zum aktivieren der treiber für die trägerfrequenz und kommandos zum lesen habe ich in allen varianten durchgespielt, es wird leider nix in den internen puffer eingelesen. an der stromaufnahme kann man gut erkennen,das die treiber arbeiten und auch der transponder energie aufnimmt,leider kann ich mangels oszi nicht überprüfen, ob eine übertragung stattfindet. ...vielleicht hat ja schon mal jemand mit diesem teil gearbeitet und kann mir ein paar tipps für gängige registereinstellungen im mfrc523 geben? danke im voraus :)
.....interessanter kleiner Käfer,wollte eh einen Einstieg in RFID angehen, werde ihn bestellen und ein paar Tests machen, melde mich dann hier,wenn es Fortschritte gibt ....
Ich benutze ebenfalls diesen Chip und habe einige Probleme damit. Hat mittlerweile schon jemand von euch Erfahrung damit. Bei mir ist der Chip an der SPI angeklemmt und mein erstes Problem ist, dass ich nicht weis, welche SPI Einstellungen zur Kommunikation notwendig sind (also CLKPOL, CLKPH & SPICLK). Dies Infos sind aus dem Datenblatt nicht ersichtlich. MfG, Daniel
Daniel schrieb: > dass ich nicht weis, welche SPI Einstellungen zur Kommunikation > notwendig sind (also CLKPOL, CLKPH & SPICLK). http://www.nxp.com/documents/data_sheet/MFRC523.pdf Seite 78, Fig. 25
Vielen Dank, jetzt kann ich wenigstens die Versionsnummer auslesen. Bei mir kommt da ein 0xB2 zurück. Das scheint ja erstmal in Ordnung zu sein. Aber nun habe ich versucht den Selbsttest zu starten, leider steht im FIFO zum Schluss an jeder Stelle eine 0x00 und nicht die erwarteten Inhalte. Hie mal mein code, vielleicht mach ich an irgendeiner Stelle ja noch was falsch dabei:
1 | /* |
2 | Selftest |
3 | The MFRC523 has the capability to perform a digital self-test. The self-test is started by |
4 | using the following procedure: |
5 | 1. Perform a soft reset. |
6 | 2. Clear the internal buffer by writing 25 bytes of 00h and implement the Config command. |
7 | 3. Enable the self-test by writing 09h to the AutoTestReg register. |
8 | 4. Write 00h to the FIFO buffer. |
9 | 5. Start the self-test with the CalcCRC command. |
10 | 6. The self-test is initiated. |
11 | 7. When the self-test has completed, the FIFO buffer contains the following 64 bytes: |
12 | |
13 | FIFO buffer byte values for version B2h: |
14 | 0x00, 0xEB, 0x66, 0xBA, 0x57, 0xBF, 0x23, 0x95, 0xD0, 0xE3, 0x0D, 0x3D, 0x27, 0x89, |
15 | 0x5C, 0xDE, 0x9D, 0x3B, 0xA7, 0x00, 0x21, 0x5B, 0x89, 0x82, 0x51, 0x3A, 0xEB, |
16 | 0x02, 0x0C, 0xA5, 0x00, 0x49, 0x7C, 0x84, 0x4D, 0xB3, 0xCC, 0xD2, 0x1B, 0x81, |
17 | 0x5D, 0x48, 0x76, 0xD5, 0x71, 0x61, 0x21, 0xA9, 0x86, 0x96, 0x83, 0x38, 0xCF, |
18 | 0x9D, 0x5B, 0x6D, 0xDC, 0x15, 0xBA, 0x3E, 0x7D, 0x95, 0x3B, 0x2F |
19 | */ |
20 | |
21 | SET_SFRPAGE (CONFIG_PAGE); |
22 | CS_RST_RFID = 1; |
23 | |
24 | for(i=0; i<64; i++) |
25 | { |
26 | buf[5+i] = 0x00; |
27 | } |
28 | |
29 | SET_SFRPAGE (SPI0_PAGE); |
30 | SPICFG (0, 0); // CLKPOL=0, CLKPHA=0 |
31 | |
32 | // 1. Perform a soft reset |
33 | // ----------------------- |
34 | SET_SFRPAGE (CONFIG_PAGE); |
35 | CS_RFID = 0; |
36 | SET_SFRPAGE (SPI0_PAGE); |
37 | SPIF = 0; |
38 | SPI0DAT = (0x01<<1); // write CommandReg register. |
39 | while (!SPIF); // wait until transmission complete |
40 | SPIF = 0; |
41 | SPI0DAT = 0x0F; // SoftReset |
42 | while (!SPIF); // wait until transmission complete |
43 | |
44 | SET_SFRPAGE (CONFIG_PAGE); |
45 | CS_RFID = 1; |
46 | |
47 | // 2. Clear the internal buffer by writing 25 bytes of 00h and implement the Config command |
48 | // ---------------------------------------------------------------------------------------- |
49 | CS_RFID = 0; |
50 | SET_SFRPAGE (SPI0_PAGE); |
51 | SPIF = 0; |
52 | SPI0DAT = (0x09<<1); // write FIFODataReg register. |
53 | while (!SPIF); // wait until transmission complete |
54 | |
55 | for(i=0; i<25; i++) |
56 | { |
57 | SPIF = 0; |
58 | SPI0DAT = 0x00; // 00h |
59 | while (!SPIF); // wait until transmission complete |
60 | } |
61 | |
62 | SET_SFRPAGE (CONFIG_PAGE); |
63 | CS_RFID = 1; |
64 | CS_RFID = 0; |
65 | SET_SFRPAGE (SPI0_PAGE); |
66 | SPIF = 0; |
67 | SPI0DAT = (0x01<<1); // write CommandReg register. |
68 | while (!SPIF); // wait until transmission complete |
69 | |
70 | SPIF = 0; |
71 | SPI0DAT = 0x01; // MEM command. Stores 25 bytes from FIFO buffer in the internal buffer. |
72 | while (!SPIF); // wait until transmission complete |
73 | |
74 | SET_SFRPAGE (CONFIG_PAGE); |
75 | CS_RFID = 1; |
76 | |
77 | // 3. Enable the self-test by writing 09h to the AutoTestReg register |
78 | // ------------------------------------------------------------------ |
79 | CS_RFID = 0; |
80 | SET_SFRPAGE (SPI0_PAGE); |
81 | SPIF = 0; |
82 | SPI0DAT = (0x36<<1); // write AutoTestReg register. |
83 | while (!SPIF); // wait until transmission complete |
84 | |
85 | SPIF = 0; |
86 | SPI0DAT = 0x09; // |
87 | while (!SPIF); // wait until transmission complete |
88 | |
89 | SET_SFRPAGE (CONFIG_PAGE); |
90 | CS_RFID = 1; |
91 | |
92 | // 4. Write 00h to the FIFO buffer |
93 | // ------------------------------- |
94 | CS_RFID = 0; |
95 | SET_SFRPAGE (SPI0_PAGE); |
96 | SPIF = 0; |
97 | SPI0DAT = (0x09<<1); // write FIFODataReg register. |
98 | while (!SPIF); // wait until transmission complete |
99 | |
100 | for(i=0; i<64; i++) |
101 | { |
102 | SPIF = 0; |
103 | SPI0DAT = 0x00; // 00h |
104 | while (!SPIF); // wait until transmission complete |
105 | } |
106 | |
107 | SET_SFRPAGE (CONFIG_PAGE); |
108 | CS_RFID = 1; |
109 | |
110 | // 5. Start the self-test with the CalcCRC command |
111 | // ----------------------------------------------- |
112 | CS_RFID = 0; |
113 | SET_SFRPAGE (SPI0_PAGE); |
114 | SPIF = 0; |
115 | SPI0DAT = (0x01<<1); // write CommandReg register. |
116 | while (!SPIF); // wait until transmission complete |
117 | |
118 | SPIF = 0; |
119 | SPI0DAT = 0x03; // CalcCRC command, activates the CRC coprocessor or performs a self-test |
120 | while (!SPIF); // wait until transmission complete |
121 | |
122 | SET_SFRPAGE (CONFIG_PAGE); |
123 | CS_RFID = 1; |
124 | // 6. The self-test is initiated. |
125 | for(w_i=0;w_i<60000;w_i++); |
126 | |
127 | // 7. When the self-test has completed, the FIFO buffer contains the following 64 bytes: |
128 | |
129 | CS_RFID = 0; |
130 | SET_SFRPAGE (SPI0_PAGE); |
131 | SPIF = 0; |
132 | SPI0DAT = (0x80|(0x09<<1)); // read FIFODataReg register |
133 | while (!SPIF); // wait until transmission complete |
134 | |
135 | for(i=0; i<64; i++) |
136 | { |
137 | SPIF = 0; |
138 | SPI0DAT = 0x00; // Read FIFO Data |
139 | while (!SPIF); // wait until transmission complete |
140 | buf[5+i] = SPI0DAT; |
141 | } |
142 | |
143 | SET_SFRPAGE (CONFIG_PAGE); |
144 | CS_RFID = 1; |
Grüße, Daniel
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
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.