linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to mesure current SPI transfer speed
@ 2011-01-07 18:51 Kevyn-Alexandre Paré
  2011-01-08  2:16 ` Jassi Brar
  0 siblings, 1 reply; 4+ messages in thread
From: Kevyn-Alexandre Paré @ 2011-01-07 18:51 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gumstix-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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);


Thx

--
Kevyn-Alexandre Pare


------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to mesure current SPI transfer speed
  2011-01-07 18:51 How to mesure current SPI transfer speed Kevyn-Alexandre Paré
@ 2011-01-08  2:16 ` Jassi Brar
       [not found]   ` <AANLkTimexzqAafU7dWj8QY1Oaac5wUoEj=pp6gqkcuqE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jassi Brar @ 2011-01-08  2:16 UTC (permalink / raw)
  To: Kevyn-Alexandre Paré
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gumstix-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Sat, Jan 8, 2011 at 3:51 AM, Kevyn-Alexandre Paré
<kapare@rogue-research.com> 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.

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to mesure current SPI transfer speed
       [not found]   ` <AANLkTimexzqAafU7dWj8QY1Oaac5wUoEj=pp6gqkcuqE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-01-10 20:25     ` Kevyn-Alexandre Paré
  2011-01-12  2:29       ` Jassi Brar
  0 siblings, 1 reply; 4+ messages in thread
From: Kevyn-Alexandre Paré @ 2011-01-10 20:25 UTC (permalink / raw)
  To: Jassi Brar
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gumstix-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f



On Sat, 2011-01-08 at 11:16 +0900, Jassi Brar wrote:
> On Sat, Jan 8, 2011 at 3:51 AM, Kevyn-Alexandre Paré
> <kapare@rogue-research.com> 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





------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to mesure current SPI transfer speed
  2011-01-10 20:25     ` Kevyn-Alexandre Paré
@ 2011-01-12  2:29       ` Jassi Brar
  0 siblings, 0 replies; 4+ messages in thread
From: Jassi Brar @ 2011-01-12  2:29 UTC (permalink / raw)
  To: Kevyn-Alexandre Paré
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gumstix-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, Jan 11, 2011 at 5:25 AM, Kevyn-Alexandre Paré
<kapare@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-12  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-07 18:51 How to mesure current SPI transfer speed Kevyn-Alexandre Paré
2011-01-08  2:16 ` Jassi Brar
     [not found]   ` <AANLkTimexzqAafU7dWj8QY1Oaac5wUoEj=pp6gqkcuqE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-10 20:25     ` Kevyn-Alexandre Paré
2011-01-12  2:29       ` Jassi Brar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).