본문 바로가기
EmbeddedSystem

ESP32 DEV - MFRC522

by TSpoons 2024. 7. 24.

https://docs.arduino.cc/software/ide-v2/tutorials/getting-started/ide-v2-downloading-and-installing

 

https://docs.arduino.cc/software/ide-v2/tutorials/getting-started/ide-v2-downloading-and-installing

 

docs.arduino.cc

 

error: ordered comparison of pointer with integer zero ('byte' {aka 'unsigned char'} and 'int')

 

```cpp
/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp: In member function 'MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)':
/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp:824:34: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
  824 |         if (backData && (backLen > 0)) {
      |                          ~~~~~~~~^~~
/home/tspoon/workspace/libraries/MFRC522/src/MFRC522Extended.cpp:847:42: error: ordered comparison of pointer with integer zero ('byte*' {aka 'unsigned char*'} and 'int')
  847 |                 if (backData && (backLen > 0)) {
      |                                  ~~~~~~~~^~~

exit status 1

Compilation error: exit status 1
```

 

 

// 수정된 부분:
if (backData != nullptr && *backLen > 0) {
    if (*backLen < in.inf.size)
        return STATUS_NO_ROOM;

    *backLen = in.inf.size;
    memcpy(backData, in.inf.data, in.inf.size);
}

// ... (중간 코드 생략) ...

// 수정된 부분:
if (backData != nullptr && *backLen > 0) {
    if ((*backLen + ackDataSize) > totalBackLen)
        return STATUS_NO_ROOM;

    memcpy(&(backData[*backLen]), ackData, ackDataSize);
    *backLen += ackDataSize;
}

 

 

 


 

 

 

sudo chmod a+rw /dev/ttyACM0

 

 

 

 


Sketch uses 292921 bytes (22%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20312 bytes (6%) of dynamic memory, leaving 307368 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.6
Serial port /dev/ttyACM0
Connecting.....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: d8:bc:38:f9:61:18
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00057fff...
Compressed 19744 bytes to 13604...
Writing at 0x00001000... (100 %)
Wrote 19744 bytes (13604 compressed) at 0x00001000 in 0.3 seconds (effective 510.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 985.2 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 1130.6 kbit/s)...
Hash of data verified.
Compressed 293280 bytes to 164827...
Writing at 0x00010000... (9 %)
Writing at 0x0001bac6... (18 %)
Writing at 0x00023fa8... (27 %)
Writing at 0x00029627... (36 %)
Writing at 0x0002e96d... (45 %)
Writing at 0x00033c78... (54 %)
Writing at 0x00039626... (63 %)
Writing at 0x000431d6... (72 %)
Writing at 0x0004c5c8... (81 %)
Writing at 0x00051b39... (90 %)
Writing at 0x0005737b... (100 %)
Wrote 293280 bytes (164827 compressed) at 0x00010000 in 3.0 seconds (effective 783.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

 

 

 


https://github.com/OSSLibraries/Arduino_MFRC522v2?tab=readme-ov-file

 

 


 

 

ESP32 Module 바꿨는데 갑자기 port 번호가 바뀌더니 

갑자기 된다..!

 

 

결론 :

 

1. 포트 연결 상태와 권한 부여!

2. Finmap을 잘 확인하여 하드웨어 연결 확인하자!