M5Stack library and MCP2515



  • Hello everyone,
    I have an ESP32 WROOM 32 with a TFT ILI9341 SPI and a CAN MCP2515 SPI, but I can't operate the CAN if the command m5.begin (); is active in the code, if it is //m5.begin (); The CAN works.
    My question is how to make the TFT Ili9341 spi with the CAN MCP2515 cohabit?

    Ili9341:
    Miso (not connected) otherwise GPIO19
    Mosi ===> GPIO23
    CS =====> GPIO15
    DC =====> GPIO2
    Reset ===> GPIO4
    SCLK ===> GPIO18

    MCP2515:
    Miso ===> GPIO19
    Mosi ===> GPIO23
    CS =====> GPIO5
    SCLK ===> GPIO18

    I tried everything but without success it looks like the M5Stack library is incompatible and blocks the CAN.
    Can you help me ?

    Regards,
    Alfred from France, sorry for my english....



  • Hello @Bbjodel

    in order for two SPI slaves to work their CS needs to be connected to different GPIOs. See here.

    Thanks
    Felix



  • Hello Felix Thank you for advancing, yes I know I was wrong by writing the effective position9341 CS = 15 and MCP2515 CS = 5.
    For the CS of the MCP2515 I tried from others GPIO E it returned to conflict with the M5Stack library ...



  • Hello @Bbjodel

    ok, I see. Have you looked at the debut output? Are there any errors?

    Thanks
    Felix



  • I have this:
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1044
    load:0x40078000,len:10124
    load:0x40080400,len:5856
    entry 0x400806a8
    Entering Configuration Mode Successful!
    Setting Baudrate Successful!
    M5Stack initializing...OK
    0,0,0.00,0,0
    0,0,0.00,0,0
    0,0,0.00,0,0
    0,0,0.00,0,0
    0,0,0.00,0,0
    0,0,0.00,0,0

    Felix can you see my code ?

    If I deactive
    //M5.begin();
    //M5.Lcd.setTextColor(WHITE);
    it works, strange.

    385,1,38.50,81,170
    385,1,38.50,81,170
    385,1,38.50,81,170
    385,1,38.50,81,170
    385,1,38.50,81,170
    385,1,38.50,81,170



  • Hello @Bbjodel

    nothing stands out in the debug output unfortunately.

    Have you tried to use two separate SPI busses? Maybe the two libraries (TFT and CAN) cannot work together?

    Thanks
    Felix



  • I don't know like Debog ESP32 + MCP2515 with Arduino.
    On the other hand, is there any other pines for SPI ?



  • I don't understand anymore, now it works but I changed the Libraie the same but obviously more complete.
    I hope it will work in time ...
    Thank you Felix