Skip to contentSkip to conversation

How to mesure current SPI transfer speed

DISCUSSION Kevyn-Alexandre Paré 2 participants 4 messages Jan 7, 2011 – Jan 12, 2011 1 message not in the archive SPI

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 9 lines · Kevyn-Alexandre Paré

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?

Quoted 7 lines

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

A message that is not in the archive (sent off-list or not yet received): AANLkTimexzqAafU7dWj8QY1Oaac5wUoEj=pp6gqkcuqE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#3 lore raw
Quoted 14 lines · Jassi Brar
Quoted 12 lines · Kevyn-Alexandre Paré

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;

Quoted 8 lines
Quoted 4 lines
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

#4 lore raw
Quoted 19 lines · Kevyn-Alexandre Paré
Quoted 10 lines
Quoted 10 lines

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;

Quoted 8 lines
Quoted 4 lines

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.

Quoted 7 lines

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general