abobija/esp-idf-rc522

After run, it have crash

Leadrive opened this issue · 2 comments

error

This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision 0, 2MB external flash
Minimum free heap size: 376784 bytes
E (341) rc522: Read/write test failed
I (341) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
E (441) rc522: write: Unknown transport
E (441) rc522: Failed to write data (err: ESP_ERR_INVALID_STATE)
E (441) rc522: write: Unknown transport
E (441) rc522: Failed to write data (err: ESP_ERR_INVALID_STATE)
E (451) rc522: read: Unknown transport
E (451) rc522: Failed to read data (err: ESP_ERR_INVALID_STATE)
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x42006147  PS      : 0x00060530  A0      : 0x820062e4  A1      : 0x3fcead70  
0x42006147: rc522_read at /home/develop/temp/test_nfc/main/rc522.c:87
 (inlined by) rc522_clear_bitmask at /home/develop/temp/test_nfc/main/rc522.c:100                                                                                                                                                  
 (inlined by) rc522_card_write at /home/develop/temp/test_nfc/main/rc522.c:312                                                                                                                                                     
                                                                                                                                                                                                                                   
A2      : 0x3fce9af8  A3      : 0x0000000c  A4      : 0x00000030  A5      : 0xfffffff7  
A6      : 0x3fceade0  A7      : 0xffffff80  A8      : 0x82006147  A9      : 0x3fcead50  
A10     : 0x00000000  A11     : 0x000001c3  A12     : 0x00000001  A13     : 0x00000000  
A14     : 0x3fce9af8  A15     : 0x00000002  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffa  


Backtrace: 0x42006144:0x3fcead70 0x420062e1:0x3fceadb0 0x42006341:0x3fceade0 0x420063db:0x3fceae10 0x4037de69:0x3fceae40
0x42006144: rc522_read at /home/develop/temp/test_nfc/main/rc522.c:86
 (inlined by) rc522_clear_bitmask at /home/develop/temp/test_nfc/main/rc522.c:100                                                                                                                                                  
 (inlined by) rc522_card_write at /home/develop/temp/test_nfc/main/rc522.c:312                                                                                                                                                     
                                                                                                                                                                                                                                   
0x420062e1: rc522_request at /home/develop/temp/test_nfc/main/rc522.c:365
                                                                                                                                                                                                                                   
0x42006341: rc522_get_tag at /home/develop/temp/test_nfc/main/rc522.c:396
                                                                                                                                                                                                                                   
0x420063db: rc522_task at /home/develop/temp/test_nfc/main/rc522.c:602
                                                                                                                                                                                                                                   
0x4037de69: vPortTaskWrapper at /home/develop/esp/esp-idf/components/freertos/port/xtensa/port.c:142
    rc522_config_t config = {
            .spi.host = SPI2_HOST,
            .spi.miso_gpio = 9,
            .spi.mosi_gpio = 10,
            .spi.sck_gpio = 11,
            .spi.sda_gpio = 16,
    };

//    rc522_config_t config = {
//            .transport = RC522_TRANSPORT_I2C,
//            .i2c.sda_gpio = 16,
//            .i2c.scl_gpio = 9,
//    };
    rc522_create(&config, &scanner);
    rc522_register_events(scanner, RC522_EVENT_ANY, rc522_handler, NULL);
    rc522_start(scanner);

If the gpio set incorrect, can not read any data, buffer is null, will cause crash.
this is maybe a bug.