Monday, February 8, 2016

USB to SPI for .NET

Overview

I started investigating the hardware architecture for Nusbio 2. With the new device I would like to achieve a transfer of at least 100 K byte /s and target 1 M byte/s.
(Update: 2017.04.02 with the FTDI FT4222 I achieved 100 Kbyte/S in I2C using a 32k byte EEPROM and 2.4 MebaByte/S using a NOR FLASH at 100Mhz)

I most likely will use a USB 2.0 to SPI chip and add a micro-controller like the ATiny84 to provide
  • More GPIOs
  • PWM
  • ADC
  • EEPROM storage
I may select a Full speed or High speed. High speed is faster, but more expensive and most likely does not exist in package SSOP-20, but rather LQFP-48 or QFN-48.

In this post, I will summarize my findings regarding the chips I tested. Obviously my end goal is to create a .NET compatible device.

USB to SPI performance

See blog: USB to SPI for .NET (performance)


Test Scenarios

  1. Test1 - Transfert 32 K byte of data from EEPROM 25AA256 (support SPI 10MHz) to computer in C#.
  2. Test2 - Transfert 128 K byte of data from EEPROM 25AA1024 (support SPI 10MHz) to computer in C#.


USB to SPI Chip

  • MicroChip - MCP2210 Datasheet
    • Evaluation board ADM00419 $15
    • USB 2.0 Full speed
    • SPI Bitrate 3 Mbps
    • 128 byte buffer
    • GPIO for select: 8
    • Packages: 20-lead QFN, 20-lead SOIC, 20-lead SSOP
    • Price: $1.98 for one
    • .NET samples: Yes
    • SPI Low Level Optimization: Most likely No
  • Cypress - CY7C65211 Datasheet
    • Evaluation board  CY8CKIT-049-42XX $4
    • USB 2.0 Full speed
    • Bitrate 3 Mhz
    • 256 byte buffer
    • GPIO for select: 5 
    • Packages: 24-lead QFN
    • Price: $2.61 for one
    • .NET samples: No. C code.
    • SPI Low Level Optimization: Most likely No
    • Remark: Can be configured as UART, SPI or I2C
  • FTDI - FT232H Datasheet
    • Evaluation board  UM232H $20
    • USB 2.0 High speed
    • Bitrate 30 Mhz for SPI
    • 64k byte buffer
    • GPIO for select: 5
    • Packages: 48-lead QFN
    • Price: $4.25 for one
    • .NET samples: Partially, Require C DLL.
    • SPI Low Level Optimization: Yes
    • Remark: Can be configured as UART, SPI, I2C, JTAG, FIFO, Bit banging.

  • SILICON LABS - CP2130 Datasheet
    • Evaluation board  CP2130EK $20
    • USB 2.0 High speed
    • 6.6 Mb/s for SPI (844Kbyte/S, Video)
    • xx byte buffer
    • GPIO for select: 11
    • Packages: 24-lead QFN
    • Price: $2.16 for one
    • .NET samples:?
    • SPI Low Level Optimization:?

Test Result

  • MicroChip - MCP2210
    • At the SPI Bitrate 3 Mhz (which cannot be increased)
    • Downloading the 32k of  data in chunk of 32 pages of 64 bytes (2k)
    • 4.559s 7.02 K byte/S
    • Conclusion: Really bad performance.
  • Cypress - CY7C65211 
    • At the SPI Bitrate 3 Mhz  
    • Downloading the 32k of  data in chunk of 16 pages of 64 bytes (1k)
    • 12 K byte/S
    • I asked on the Cypress forum for help - Page. So far no real help from the Indian support.
  • FTDI - FT232H 
    • At the SPI Bitrate 10 Mhz (Max supported by the EEPROM)
    • Downloading the 32k of  data in chunk of 256 pages of 64 bytes (16k)
    •  0.03s  1066.67 K byte/S
    • Conclusion: Really very nice performance. and the FT232H can goes up to 30 Mhz.
  • SILICON LABS - CP2130

More About The MCP2210

  •  Kerry Wong, blogged a lot about the MCP2210 at http://www.kerrywong.com.
  • In his post "Finicky MCP2210 Oscillator", John Davis added the following comment, which explain a lot.

    WARNING: According to our trouble ticket interactions with Microchip technical support, the MCP2210 is “throttled” internally with a mininum SPI inter-byte spacing of about 45uS REGARDLESS of SPI clock frequency (we got 12 MHz working on our board.) That limits the byte data rate to about 23KBytes/second max. However, the performance is still limited further by the fact that it is an HID device with a HID-limit 64KByte/second interface. Two USB 128 byte transactions of 3mS each with a wait in between are required for a transfer, so the effective data rate using full 60 byte packets works out to slightly less than 8KBytes/second (Verified with ‘scope.) THIS IS NOT A HIGH THROUGHPUT PART!



3 comments:

  1. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
    USB名入れ

    ReplyDelete
  2. thanks for sharing this type of good information here

    Mcx Tips With 100% Accuracy

    ReplyDelete