Hi @Tiago_Almeida!
If I understand correctly, you are trying to use your ILI9341 and MAX31856 on the same SPI bus.
I noticed that you let micropython SPI driver initialize the bus first, and then use the initialized bus with ILI9341. Actually I never tried this because my SPI devices work with ESP-IDF SPI API directly and not with Micropython’s SPI driver.
One simple solution could be to put them each on its own SPI bus.
If you need to use them on the same SPI bus, it may still be possible if both devices behave correctly and if the drivers support this.
I’m using ILI9341 and XPT2046 on the same SPI bus with LVGL and it works fine.
You can try tweaking some parameters, for example use ILI9341 in full-duplex mode instead of half duplex etc.
You can examine ILI9341 driver and Micropython SPI driver, specifically the SPI initialization code, and see if they configure SPI differently.
The error you are getting (txdata transfer > host maximum
) hints that the SPI bus initialized by Micropython for MAX31856 does not set max_transfer_sz
high enough.
Looking at Micropython SPI driver code, it does not set max_transfer_sz
at all, so it gets the default value of 4094 which might not be high enough. You can try setting max_transfer_sz
in machine_hw_spi.c
to a high enough value.
From the other side, you can also try to set the factor
argument of ILI9341 to higher values (64 for example) so that ILI9341 driver would allocate a smaller TX buffer, however this could affect the display performance.
If the problem is not the initialization but the actual SPI communication, you can try to use a scope or some logic analyzer equipment to see what’s happening on the SPI lines.