Jump to content
Sign in to follow this  
jazz

MSP430 USB Benchmark

Recommended Posts

I'm finishing the latest version of my USB CDC subsystem. It is written in C and now compiles quite small: about 1.4KB -- I have made hundreds of architectural improvements and optimizations over the basic TI USB library, mostly for the purpose of reducing code size. I will benchmark it on 256 byte transfer size soon. My system is not intended for streaming transfers, so in normal usage there is protocol parsing latency. I will write a special benchmark app, though, which does no protocol parsing and uses none of the task-based controls. I am pretty busy with some other things, so I'll probably get to it in about 2 weeks.

 

I'm expecting from your benchmark, confirmation of my results, because officially TI max transfer rate (presented for CDC) 512 KB/s is far from the values that can be reached (using bigger transfer at once, for example 2 MB). It will be OK if you prepare test for transfer of more than 1 MB data (at once) between uC/PC.

 

I done genric bulk benchmark for dummy transfer (1 MB/s), normal data transfer without double buffering (close to 900 KB/s) and with double buffering (over 1000 KB/s). I will post benchmark software here so anybody will be able to do it.

Share this post


Link to post
Share on other sites

My target was to find out maximum possible transfer rate with MSP430 under WinXP. Test is based on one transfer from MSP430 to PC, and another from PC to MSP430, with variable total transfer size and PC buffer size. It is able to test generic bulk (winusb.sys) and CDC (usbser.sys) transfer. Test is done for transfer at once, not for data exchange, where uC sends few packets to PC, than PC sends few packets to uC, and so on.

 

For testing normal non-dummy data transfer, uC/PC generate array with order numbers for data fields

[00, 00, 01, 00, 02, 00... FE, FF, FF, FF, 00, 00, 01, 00...]

and on other side is checking for data validity. On MSP430 side, double buffering is used, so total buffer size is 128 bytes.

 

For testing dummy transfer (-d), there is no any data generation or checking on uC/PC side. On MSP430 side, double buffering is not used, so total buffer size is 64 bytes.

 

Final results are showing that maximum possible transfer rate for normal non-dummy transfer is over 1000 KB/s with generic bulk transfer (winusb.sys). CDC (usbser.sys) show better results for smaller buffer (and total transfer) size, especially for IN endpoint transfer (MSP430 -> PC) that is basically not changing. It is able to boost IN endpoint transfer performance for generic bulk transfer (winusb.sys) with assigning RAW_IO pipe policy to IN pipe and put more than two OVERLAPPED WinUsb_ReadPipe in advance, but this was not implemented.

 

D:\msp430\usbbm>usbbm -gb -tm 2 -bm 2

MSP430F550x USB Benchmark v0.50 jh_diy@yahoo.com

Generic Bulk Transfer
Size: 2 MB
PC: 1 * 2 MB
uC: 16384 * 128 B

Dir: MSP430 -> PC
Time: 2062 ms
Rate: 1017 KB/s

Dir: MSP430 <- PC
Time: 2078 ms
Rate: 1009 KB/s

D:\msp430\usbbm>usbbm -gb -tm 2 -bb 128

MSP430F550x USB Benchmark v0.50 jh_diy@yahoo.com

Generic Bulk Transfer
Size: 2 MB
PC: 16384 * 128 B
uC: 16384 * 128 B

Dir: MSP430 -> PC
Time: 33313 ms
Rate: 63 KB/s

Dir: MSP430 <- PC
Time: 33312 ms
Rate: 63 KB/s

D:\msp430\usbbm>usbbm -cdc -tm 2 -bm 2

MSP430F550x USB Benchmark v0.50 jh_diy@yahoo.com

CDC Transfer
Size: 2 MB
PC: 1 * 2 MB
uC: 16384 * 128 B

Dir: MSP430 -> PC
Time: 2578 ms
Rate: 813 KB/s

Dir: MSP430 <- PC
Time: 2359 ms
Rate: 889 KB/s

D:\msp430\usbbm>usbbm -cdc -tm 2 -bb 128

MSP430F550x USB Benchmark v0.50 jh_diy@yahoo.com

CDC Transfer
Size: 2 MB
PC: 16384 * 128 B
uC: 16384 * 128 B

Dir: MSP430 -> PC
Time: 2562 ms
Rate: 819 KB/s

Dir: MSP430 <- PC
Time: 16735 ms
Rate: 125 KB/s

Share this post


Link to post
Share on other sites

For CDC installation (original, not changed) "1CDC_descTool.inf" file from MSP430_USB_API_Stacks C1_Example is used. It can be found here:

MSP430USBDevleopersPackage_3_20_00\MSP430_USB_API_Stacks\examples\cdcExamples\IAR\C1_Example\USB_config\1CDC_descTool.inf

It is also attached here:

1CDC_descTool.rar

 

There is no TI support for MSP430 with generic bulk transfer, so solution from Stellaris family is used. Drivers pack (not only for generic bulk) can be found here:

http://www.ti.com/to...-usb-windrivers

 

When flashed uC is connected to PC, after enumeration WinXP will ask for driver.

 

bm1.gif

 

Just point it to right location for driver, and driver will be installed.

 

bm3.gif

 

bm4.gif

Share this post


Link to post
Share on other sites

For benchmark, on PC side, there is application running on cmd prompt. It's working OK on my WinXP SP2. If winusb not exist (and it is not present on WinXP SP2) it will be installed by Stellaris drivers pack. PC application is attached here:

usbbm.rar

 

bm5.gif

 

There are some default values (non-dummy generic bulk transfer with 1MB transfer and PC buffer size with 10 sec timeout).

 

Making typical non-dummy generic bulk benchmark with 2MB transfer and PC buffer size:

D:\msp430\usbbm>usbbm -gb -tm 2 -bb 2

 

Making typical non-dummy CDC benchmark for 2MB transfer and PC buffer size:

D:\msp430\usbbm>usbbm -cdc -com 8 -tm 2 -bb 2

Share this post


Link to post
Share on other sites

Firmware size is under 1.5 KB (from $E000) and it is tested with MSP430F5508. I guess it will work with any MSP430F550x family member. Firmware is in TI txt format, and It can be flashed by USB BSL. "MSP430_USB_Firmware_Upgrade_Example-1.2.1-Setup.exe" can be download from here:

http://software-dl.t.../index_FDS.html

 

uC is powered by USB, and it is running by internal DCO at 25MHz.When is connected to PC, it will be enumeration process. When device is enumerated P1.0 LED will turn on, and uC is ready for benchmark. Any error during benchmark on uC side will be marked with turning P1.0 led OFF. In this case uC needs to be reseted.

 

Here is attached firmware for XT2 at 12MHz and 24MHz. "usbbmgb*.txt " is firmware for generic bulk, and "usbbmcdc*.txt" is firmware for CDC. "*d.txt" is firmware for dummy transfer.

 

usbbm12MHz.rar

usbbm24MHz.rar

 

All my benchmark results are posted in this topic. Now, you have everything if you want to do it by yourself. You are doing it on your own risk, and don't complain here if you as benchmark results have destroyed MSP430 board or dead cat. It's not my problem.

Share this post


Link to post
Share on other sites

I tried interrupt driven benchmark without a busywait loops, with and without double buffering, and have the same results as posted on topic before (benchmark with busywait loops).

Share this post


Link to post
Share on other sites

At the end, I found solution for my PCBCNC interface. All job will be done on PC side. uC will only do motor stepping depending on timers. PC will send 1 KB data blocks to uC, and will receive 1 KB data block as answer. PC will send one byte to uC for each motor X/Y/Z step, and uC will send back one byte for limiter information (min/max reached). PC will send to uC also some other configuration commands (longer than 1 byte) regarding timers setup and some other things. Transfer rate will be 500 KB/s (for 1 KB buffer), and it will be able to do 500 * 1024 steps / sec. I can live with that, no problem.

Share this post


Link to post
Share on other sites

Just to correct last post, because didn't take uC respond in transfer calculation. CNC have 4 axis, 8 kind of steps in total, so 2 steps will be packed in 1 byte. Sending 1 KB buffer form PC to uC and receiving 1 KB answer (limiters for min/max) from uC, 1024 steps at 500 KB/s rate, will give total average result close to 500 * 1024 steps / sec.

Share this post


Link to post
Share on other sites

Hi Jazz, how do I flash the firm ware (.txt file in your usbbm??MHz.rar) to the MSP430F5510?

Thanks

-Thanh

 

It was already explained on topic:

 

Firmware is in TI txt format, and It can be flashed by USB BSL. "MSP430_USB_Firmware_Upgrade_Example-1.2.1-Setup.exe" can be download from here:

http://software-dl.t.../index_FDS.html

Share this post


Link to post
Share on other sites

Jazz,

 

Would you happen to be able to post the source for the benchmarking scripts? Also are you using Win32 API's at all? I am looking to do something similar but would most likely modify the source a bit to fit my own test cases.

 

 

Share this post


Link to post
Share on other sites

If you want to made CDC benchmark, than PC side is simple. Made byte array with variable length, fill it up with test data and send it (complete array at once) over CDC to other side. If needed, on other side can be done checking for received data.

function CDCRead(FDevHnd: THandle; FPBuf: Pointer; FSize: Cardinal): Integer;
var FSizeRes: Cardinal;
begin
  Result := 0;
  if not ReadFile(FDevHnd, FPBuf^, FSize, FSizeRes, nil) then Result := Err(62, 'CDCRead', 'Timeout reached.', 'ReadFile');
  if (Result = 0) and (FSize <> FSizeRes) then Result := Err(63, 'CDCRead', 'Full size not reached.', 'ReadFile');
end;

function CDCWrite(FDevHnd: THandle; FPBuf: Pointer; FSize: Cardinal): Integer;
var FSizeRes: Cardinal;
begin
  Result := 0;
  if not WriteFile(FDevHnd, FPBuf^, FSize, FSizeRes, nil) then Result := Err(72, 'CDCWrite', 'Timeout reached.', 'WriteFile');
  if (Result = 0) and (FSize <> FSizeRes) then Result := Err(73, 'CDCWrite', 'Full size not reached.', 'WriteFile');
end;
    GlbTime1 := GetTickCount;
    if (GlbErr = 0) then GlbErr := CDCWrite(GlbDevHnd, Pointer(GlbBMBufOut), GlbPCBuff);
    GlbTime2 := GetTickCount;

    if GlbErr = 0 then
    begin
      WriteLn('Time: ' + IntToStr(GlbTime2 - GlbTime1) + ' ms');
      if GlbTime2 > GlbTime1 then WriteLn('Rate: ' + IntToStr(Round(GlbSize / (GlbTime2 - GlbTime1))) + ' KB/s');
    end;

    GlbTime1 := GetTickCount;
    if (GlbErr = 0) then GlbErr := CDCRead(GlbDevHnd, Pointer(GlbBMBufIn), GlbPCBuff);
    GlbTime2 := GetTickCount;

    if (GlbErr = 0) then
    begin
      WriteLn('Time: ' + IntToStr(GlbTime2 - GlbTime1) + ' ms');
      if GlbTime2 > GlbTime1 then WriteLn('Rate: ' + IntToStr(Round(GlbSize / (GlbTime2 - GlbTime1))) + ' KB/s');
    end;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×