On Tue, Jan 11, 2011 at 5:25 AM, Kevyn-Alexandre Paré
<kap...@rogue-research.com> wrote:
>> > 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?

Not always.
Your protocol driver can theoretically set any rate from
[0, SPI_BUS_SPEED]. And bits would be shifted in/out
at that rate whenever the protocol driver has some data to recv/send.
Usually, streaming devices(like DMB) will have more or less the same
throughput equal to the clock rate, but bulk devices (like MMC) may not.

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to