RFID-RC522 example. The platform board changes into Using WIZwiki-W7500.
Fork of RFID-RC522 by
Revision 3:78eca7f5176a, committed 2017-07-21
- Comitter:
- bangbh
- Date:
- Fri Jul 21 08:48:57 2017 +0000
- Parent:
- 2:a0c7513fb634
- Commit message:
- Using WIZwiki-W7500 board
Changed in this revision
diff -r a0c7513fb634 -r 78eca7f5176a MFRC522.cpp --- a/MFRC522.cpp Fri Jun 06 03:04:48 2014 +0000 +++ b/MFRC522.cpp Fri Jul 21 08:48:57 2017 +0000 @@ -55,7 +55,7 @@ { /* Configure SPI bus */ m_SPI.format(8, 0); - m_SPI.frequency(8000000); + m_SPI.frequency(1000000); /* Release SPI-CS pin */ m_CS = 1;
diff -r a0c7513fb634 -r 78eca7f5176a RFID-RC522.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RFID-RC522.lib Fri Jul 21 08:48:57 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kirchnet/code/RFID-RC522/#a0c7513fb634
diff -r a0c7513fb634 -r 78eca7f5176a main.cpp --- a/main.cpp Fri Jun 06 03:04:48 2014 +0000 +++ b/main.cpp Fri Jul 21 08:48:57 2017 +0000 @@ -1,37 +1,27 @@ -//Test of cheap 13.56 Mhz RFID-RC522 module from eBay -//This code is based on Martin Olejar's MFRC522 library. Minimal changes -//Adapted for Nucleo STM32 F401RE. Should work on other Nucleos too - -//Connect as follows: -//RFID pins -> Nucleo header CN5 (Arduino-compatible header) -//---------------------------------------- -//RFID IRQ=pin5 -> Not used. Leave open -//RFID MISO=pin4 -> Nucleo SPI_MISO=PA_6=D12 -//RFID MOSI=pin3 -> Nucleo SPI_MOSI=PA_7=D11 -//RFID SCK=pin2 -> Nucleo SPI_SCK =PA_5=D13 -//RFID SDA=pin1 -> Nucleo SPI_CS =PB_6=D10 -//RFID RST=pin7 -> Nucleo =PA_9=D8 -//3.3V and Gnd to the respective pins +/************************************************/ +/*IRQ=pin5 -> Not used. Leave open */ +/*MISO=pin4 -> WIZwiki-W7500 SPI_MISO=D12 */ +/*MOSI=pin3 -> WIZwiki-W7500 SPI_MOSI=D11 */ +/*SCK=pin2 -> WIZwiki-W7500 SPI_SCK =D13 */ +/*SDA=pin1 -> WIZwiki-W7500 SPI_CS =D10 */ +/*RST=pin7 -> WIZwiki-W7500 =D8 */ +/************************************************/ #include "mbed.h" #include "MFRC522.h" -// Nucleo Pin for MFRC522 reset (pick another D pin if you need D8) -#define MF_RESET D8 - DigitalOut LedGreen(LED1); -//Serial connection to PC for output -Serial pc(SERIAL_TX, SERIAL_RX); - -MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET); +MFRC522 RfChip (D11, D12, D13, D10, D8); int main(void) { - pc.printf("starting...\n"); + printf("starting...\n"); // Init. RC522 Chip RfChip.PCD_Init(); + printf("initailzed\n"); + while (true) { LedGreen = 1; @@ -41,27 +31,26 @@ wait_ms(500); continue; } - // Select one of the cards if ( ! RfChip.PICC_ReadCardSerial()) { wait_ms(500); continue; } - + LedGreen = 0; // Print Card UID - pc.printf("Card UID: "); + printf("Card UID: "); for (uint8_t i = 0; i < RfChip.uid.size; i++) { - pc.printf(" %X02", RfChip.uid.uidByte[i]); + printf(" %X02", RfChip.uid.uidByte[i]); } - pc.printf("\n\r"); + printf("\n\r"); // Print Card type uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak); - pc.printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); + printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); wait_ms(1000); } } \ No newline at end of file
diff -r a0c7513fb634 -r 78eca7f5176a mbed.bld --- a/mbed.bld Fri Jun 06 03:04:48 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file