7 years, 2 months ago.

SPI.transfer (Master) is slow on Nucleo L432

Hello, I try to use spi master "transfer" function. But the transfer seems limited to 3.5Mb/s, which is too slow for my application. I would need 10Mb/s. When setting higher speeds, the SPI seems to pause every 4 or 6 bytes.

Is that a bug in the "transfer" function for this board? I'm pretty sure that this board can reach 10Mb/s on SPI master with its DMA.

How can I reach 10Mb/s?

Thanks for your help.

#include "mbed.h"

SPI spi_1(PA_7, PA_6, PA_5); // mosi, miso, sclk

int main()
{
    int i = 1;
    spi_1.format(8,0);
    spi_1.frequency(10000000);
    
    unsigned char toto[160];
    unsigned char toto2[160];

    for (i=0; i<=150; i++) {
        toto[i]=i;    
    }
    while(1) {   
        spi_1.transfer(toto, 80, toto2, 80, NULL, NULL);
        wait_ms(50);
    }  
}

/media/uploads/F4HDK/spi_speed_issue2.png

Be the first to answer this question.