wemos lolin32 oled HSPI RFID

Hello everybody,
Can someone tell me if it is possible to read an RFID RC522 with a wemos lolin32 oled board?

I think that I probably only have the hspi pins.
I use the SPI.h and the MFRC522.h libarys but can not read the tokens.

I connected as follows:
SCLK (SCK) = 14, MISO = 12, MOSI = 13, SS (SDA?) = 15, RST = 5

that is what i have so far (no idea if that’s works)

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN  5
#define SS_PIN   15
MFRC522 mfrc522(SS_PIN, RST_PIN);   


MFRC522::MIFARE_Key key;

void setup() {
  Serial.begin(9600); 
  SPI.begin();         
  mfrc522.PCD_Init(); 
}

void loop() {

  if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) {
    delay(50);
    return;
  }
  

  Serial.print(F("Card UID:"));
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  } 
  Serial.println();
  delay(1000);
}

please can someone help me
or at least say that it is not possible

Hi Mikba and welcome to the forum. You should really read this before posting a message so you understand the etiquette and how to put your code in a code tags to make it more readable.

I have not looked at your code but a quick search on the RC552 seems to indicate it’s a 3.3V board so that’s a good start.
It would help if you had posted links to the Lolin32 OLED board your using and maybe give some details on the settings your using to program it. If your using the “Wemos Lolin32” board definition (I cannot see one for the OLED board) then the SPI pins your using (SCLK (SCK) = 14, MISO = 12, MOSI = 13, SS (SDA?) = 15, RST = 5) are probably wrong.
If your board looks like the below image then I think the wiring should be…
SCK to CL
MISO to SO
MOSI to SI
SS to 5

First, thanks for the quick response
and sorry for the mistake in my fist post

yes i use exacly the board from the image
and the settings form the "Wemos Lolin32" , "Flash Frequency: 80MHz", "Upload Speed : 921600"

After I use your connections i get unfortunately the error message:

Guru Meditation Error: Core 1 panic'ed (IllegalInstruction)
, Exception was unhandled.
Core 1 register dump:
PC: 0x400d0b05 PS: 0x00060730 A0: 0x800d0c28 A1: 0x3ffca470
A2: 0x3ffc22bc A3: 0x00000054 A4: 0x00000001 A5: 0x00000000
A6: 0xffffffff A7: 0x00000004 A8: 0x00000001 A9: 0x00000054
A10: 0x00000000 A11: 0x00401001 A12: 0x3ff65000 A13: 0x00000000
A14: 0x04c4b400 A15: 0x00000020 SAR: 0x0000001b EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG: 0x400d1a50 LEND: 0x400d1ab2 LCOUNT: 0x00000000

Backtrace: 0x400d0b05: 0x3ffca470 0x400d0c25: 0x3ffca490 0x400d0e5d: 0x3ffca4c0 0x400d0936: 0x3ffca4e0 0x400e4643: 0x3ffca500
Rebooting...

[/code]

Not sure why you would be getting the crash like that but try removing the return; you have in the loop code as you don’t really have anywhere to return to.

I don’t have a RFID card and I’m at work so no access to an ESP32 to test with.
Is the RC522 library you have installed the latest version (currently 1.4.0) and do you have a pinout (see below example) of the Lolin32 OLED board your using just in case the problem is with the pin numbers.

Try the example here to see if it works.

Clipboard-1.jpg

Thanks for the answer

I solved the problem
it was actually a problem with the pins
I changed the assignment of the pins in pins_arduino.h file and it worked

Unfortunately, I have no pinout for this board so i used the ESP-IDF Programming Guide to find the right pins for SPI

The return repeats the if loop until a card is present and can be read

How do I changed te assignment of the pins in pins_arduino.h? on Mac

@Rickypaul
Changing pin assignment should be same like on WinOS.
Just search in your "arduino"-directory for pins_arduino.h. You'll find lots of files with its name. Choose that one which is in "arduino/hardware/espressif/esp32/variants/YOUR_BOARD" and edit it.

Now, SDCard works fine. thx to Mikba

Can you upload a schematic of your board?