From: Kevyn-Alexandre P. <ka...@ro...> - 2011-01-10 20:25:04
|
On Sat, 2011-01-08 at 11:16 +0900, Jassi Brar wrote: > On Sat, Jan 8, 2011 at 3:51 AM, Kevyn-Alexandre Paré > <ka...@ro...> wrote: > > Hi, > > > > What's the best way to calculate the current SPI transfer speed? > > > > Right now I use something like that and transfer one spi_message with 1 > > spi_transfer of 100000 bytes and I do the math... I know that this is > > not accurate and was wondering if anyone have a better way? > > > > > > struct timeval tv_before; > > struct timeval tv_after; > > > > do_gettimeofday(&tv_before); > > status = spi_sync(spike_dev.spi_device, &spike_ctl.msg); > > do_gettimeofday(&tv_after); > > long elapsedTime = (tv_after.tv_usec - tv_before.tv_usec); > > Transfer speed is tightly linked to MOSI/MISO bit rates. > But the overall throughput would depend on the protocol that > you run over SPI. Effectively, but how to monitor that I respect, for example, a requirement of 5Mbps with a chip... I'm already sending data at #define SPI_BUS_SPEED 5000000 spi_device->max_speed_hz = SPI_BUS_SPEED; So does this settings ensure it to always be at 5Mhz? I will try to test it by settings it to higher speed to see what happen ex: 48000000 (48Mhz) Regards, -- Kevyn-Alexandre Pare |