6 years, 9 months ago.

RFID -RC522 Is not detecting Card or chain with Wiznet-W7500

Using below code, not able to figure out the issue

  1. include "mbed.h" Ethernet #include "EthernetInterface.h" MFRC522(RFID)
  2. include "MFRC522.h"
  1. define WEB_SERVER_PORT 80

Serial pc(USBTX, USBRX);

MFRC522 reset (pick another D pin if you need D8)

  1. define MF_RESET D8 Buzzer
  2. define VOLUME 0.02
  3. define BPM 100.0 LED DigitalOut Led(LED1);

Buzzer PwmOut pwm_pin(D3);

float beat_duration; Plays a sound with the defined frequency, duration, and volume void playNote(float frequency, float duration, float volume) { pwm_pin.period(1.0/(double)frequency); pwm_pin = ((double)volume/2.0); wait(duration); pwm_pin = 0.0; }

CARD number uint8_t CARD_1 = 0x44; uint8_t CARD_2 = 0xCB; uint8_t CARD_3 = 0x2A; uint8_t CARD_4 = 0xA4;

uint8_t CARD_5 = 0xA2; uint8_t CARD_6 = 0xCE; uint8_t CARD_7 = 0xEC; uint8_t CARD_8 = 0xD5;

RC522 SPI communication MFRC522 RfChip (D11, D12, D13, D10, MF_RESET); /* MFRC522::MFRC522(PinName mosi, PinName miso, PinName sclk, PinName cs,(OR SDA) PinName reset) : m_SPI(mosi, miso, sclk), m_CS(cs), m_RESET(reset)*/

HTTP WEB SERVER char recv_buffer[1024] = {0,}; char echoHeader[1024] = {0,}; char * findrfid = 0; char change_rfid[4] = {1,2,3,4};

int main (void) { Init. RC522 Chip RfChip.PCD_Init(); pc.printf("Init end\r\n"); while (true) {

RFID Area Look for new cards if ( ! RfChip.PICC_IsNewCardPresent()) { wait_ms(500); continue; } else { pc.printf("CARD READ SUCCESS"); }

Select one of the cards if ( ! RfChip.PICC_ReadCardSerial()) { wait_ms(500); continue; } Print Card UID pc.printf("Card UID: ");

for (uint8_t i = 0; i < RfChip.uid.size; i++) { pc.printf("printing NUMBER=>\n"); pc.printf(" %X02", RfChip.uid.uidByte[i]); } pc.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)); wait_ms(1000);

Show RFID Tag if((RfChip.uid.uidByte[0] == CARD_1) && (RfChip.uid.uidByte[1] == CARD_2) && (RfChip.uid.uidByte[2] == CARD_3) && (RfChip.uid.uidByte[3] == CARD_4)) { Buzzer Sound pc.printf("TAG Read !\r\n"); beat_duration = 60.0 / BPM; playNote(999.999, (0.75 * (double)beat_duration), VOLUME); } Show RFID Card else if((RfChip.uid.uidByte[0] == CARD_5) && (RfChip.uid.uidByte[1] == CARD_6) && (RfChip.uid.uidByte[2] == CARD_7) && (RfChip.uid.uidByte[3] == CARD_8)) { pc.printf("CARD Read !\r\n"); beat_duration = 60.0 / BPM; playNote(111.111, (0.75 * (double)beat_duration), VOLUME); }

} }

Question relating to:

WIZwiki-W7500 is a SoC platform board based on the W7500 chip = ARM Cortex-M0 that integrates 128KB Flash and hardwired TCP/IP core. If you use WIZwiki-W7500 board, you can easily …
Be the first to answer this question.