How to use MFRC522 on BW16?

Hi,
i can’t find the example for MFRC522 on BW16.
there is only the example on RTL8195.(RFID – Using RFID RC522 module as RFID Reader – Realtek IoT/Wi-Fi MCU Solutions)

so I uploaded the example, and the serial monitor shows “error invalid pin”.
how should I modify the above library to use on BW16?

thanks.

Welcome to the forum James!

Assuming you installed the latest .zip file from Ameba1’s github repo:

All you need to do is change the definitions of RESET and SS pins in your .ino example file. For BW16, RST_PIN = 7 and SS_PIN = 9.

If you need assistance with connecting your RFID reader to your BW16 board, refer to the following:

MFRC522 pins => BW16 pins
SDA => PA15/Pin 9
SCK => PA14/Pin 10
MOSI => PA12/Pin 12
MISO => PA13/Pin 11
IRQ => PA26/Pin 8
GND => GND pin
RST => PA25/Pin 7
VCC => 3.3V pin

Do let us know if you need further assistance!

BW16 board drivers = 3.1.7
download AmebaMFRC522 library

DumpInfo.ino compilation errors:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp: In member function ‘void MFRC522::PCD_WriteRegister(byte, byte)’:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp:42:61: error: ‘SPI_MODE0’ was not declared in this scope
SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0)); // Set the settings to work with SPI bus
^~~~~~~~~
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp: In member function ‘void MFRC522::PCD_WriteRegister(byte, byte, byte*)’:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp:58:61: error: ‘SPI_MODE0’ was not declared in this scope
SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0)); // Set the settings to work with SPI bus
^~~~~~~~~
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp: In member function ‘byte MFRC522::PCD_ReadRegister(byte)’:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp:75:61: error: ‘SPI_MODE0’ was not declared in this scope
SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0)); // Set the settings to work with SPI bus
^~~~~~~~~
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp: In member function ‘void MFRC522::PCD_ReadRegister(byte, byte, byte*, byte)’:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp:99:61: error: ‘SPI_MODE0’ was not declared in this scope
SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE0)); // Set the settings to work with SPI bus
^~~~~~~~~
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp: In member function ‘MFRC522::StatusCode MFRC522::PCD_NTAG216_AUTH(byte*, byte*)’:
/home/rkuo/Arduino/libraries/RFID-RC522/MFRC522.cpp:1137:7: warning: unused variable ‘cmdBufferSize’ [-Wunused-variable]
byte cmdBufferSize = sizeof(cmdBuffer);
^~~~~~~~~~~~~

exit status 1

Hi @rkuo2000 ,

Previously, we updated SPI.h and mapped SPI_MODE0 to the name often used for third party libraries. May I know which version of SDK you are currently using?

3.1.7 AMB26 (RTL8720DF)

Can you try on the early release version, 3.1.8-build20250321? It should solve the error: ‘SPI_MODE0’ was not declared in this scope. You may need to modify the API in MFRC522.cpp as the pin variable name used might be different from our SDK.