ILI3941 and pico seems slow

I have a Raspberry Pi pico talking to an ILI3941 320x240 display using SPI. I'm using TFT_eSPI, and to pushImage() a 307x240 image from the pico's flash takes about 55 milliseconds.

It's using TFT_eSPI's User_Setups/Setup60_RP2040_ILI9341.h , which specifies 70 MHz for SPI_FREQUENCY. Is that supposed to correspond to the bit rate? 30724016 @ 70 MHz should take about 16.8 milliseconds, so it's taking 3.28 times as long as it should.

Edit: Confirmed that it waits 3 times on average calling spi_is_writable(). Doubling the SPI_FREQUENCY to 140MHz doesn't speed it up and doesn't corrupt the images. What could cause it to wait like that?

Edit: spi_get_baudrate(spi0) returns 24 MHz. At that speed, my image would take 49 msec, not far off the 55 msec I see in practice. Why is the baud rate so much less than SPI_FREQUENCY?

Edit: clock_get_hz(clk_peri) returns 48 MHz, even at the start of setup(), and spi_set_baudrate() uses a minimum prescale of 2, so the max frequency is apparently 24 MHz.

Edit: Adding the following at the start of setup() fixes it, leading to a baudrate of 62.5 MHz and no waiting in the loop:

clock_configure(
            clk_peri,
            0,                                                // No glitchless mux
            CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, // System PLL on AUX mux
            125'000'000,                               // Input frequency
            125'000'000                                // Output (must be same as no divider)
        );

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.