discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] The effect of FUSB_BLOCK_SIZE and FUSB_NBLOCKS


From: Stefan Bruens
Subject: Re: [Discuss-gnuradio] The effect of FUSB_BLOCK_SIZE and FUSB_NBLOCKS
Date: Wed, 04 Mar 2009 12:26:09 +0100
User-agent: KMail/1.11.0 (Linux/2.6.27.7-9-mtrr_san; KDE/4.2.0; x86_64; ; )

On Wednesday 04 March 2009 05:40:36 Yong J. Chang wrote:
> Hi all,
>
> Now I'm working on measuring Round Trip Time (
> FPGA(RXFIFO)->USB->PC->USB->FPGA(TXFIFO) ).
> Since I'm using 128kbps bitrate and 10 samples per symbol, sample rate is
> 1.28Msps.
> And I do not give any options about FUSB_BLOCK_SIZE and FUSB_NBLOCKS. So
> they might be 0.
> In this case, the result is following:

0 means default. Excerpt from fusb_linux.cc:
---
static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size();
static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE;
static const int DEFAULT_BUFFER_SIZE = 4 * (1L << 20);
if (d_block_size == 0)
  d_block_size = DEFAULT_BLOCK_SIZE;
if (d_nblocks == 0)
  d_nblocks = std::max (1, DEFAULT_BUFFER_SIZE / d_block_size);
---
max_block_size() is 16kB

> Minimum RTT : 1.96ms
> Maximum RTT : 5.12ms
>
> As Thomas Schmid's paper, this result is so reasonable. However, if I use
> FUSB_BLOCK_SIZE=2048 and FUSB_NBLOCKS=8 such like paper mentioned, it
> starts to be messed up.
>
> RTT becomes larger and variation is also broaden. Also it gives me lots of
> overrun message.

I have no problem running with a block size of 512, but it is important to run 
with SCHED_FIFO (you have to be root or need appropriate settings in 
/etc/security/limits.conf, this has been discussed a few days ago on this ML).

> What is the effect of these two parameters? As I know, in USB bulk transfer
> mode the USB packet size is fixed as 512 bytes. So these two parameters
> will determine the packet size transfered between Linux kernel and user
> space. It does not affect physical USB transaction. Am I correct? If yes,
> why does it make overrun error?

As you can see above, with default values the in-kernel buffer is much larger 
(from my experiments it is mostly irrelevant how large the URBs -- USB request 
block, the size you set with FUSB_BLOCK_SIZE -- are, the total buffer size is 
much more critical). The size of the URB determines how often you get notified 
from the kernel. Another factor is the number of interrupts generated by the 
USB host controller, this is limited to one interrupt per microframe (125us).

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
phone: +49 241 53809034     mobile: +49 151 50412019




reply via email to

[Prev in Thread] Current Thread [Next in Thread]