Friday, February 12, 2016

Digital Potentiometer SPI AD5290 and Nusbio

Overview


The Digital Potentiometer AD5290 is not a regular one.
  1. It provides 2 supply modes
    1. Single supply, Positive voltage
    2. Dual supply, Positive voltage and negative voltage
      You need to provide the positive and negative voltage (pin 1 and 2)
  2. In mode 1, the current can be between 20 and 30 Volts.
    In mode 2, the current +-10 to +- 15 volts
  3. It is only available in MSOP-10
Datasheet


 

SPI


The AD5290  is an SPI chip which does not use MISO (The chip does not send information back).
Be care full, the SDO pin is used for daisy-chaining

The recommended wiring with Nusbio is a follow

GPIO 0 - CLOCK
GPIO 1 - MOSI
GPIO 2 - CS

VB.net Code

Wiring

5 Volts from the USB

In this wiring, we use the Single supply, positive 5 volts mode from Nusbio and therefore from the USB.


9 Volts from a battery

In this wiring, we use the Single supply, positive 9 volts mode from a battery.
Nusbio GPIO 0,1,2 should never be in contact with the 9 Volts from the battery.



Thursday, February 11, 2016

SPI digital potentiometer AD5290Y 10k with some vb.net code

SPI digital potentiometer AD5290Y 10k with some  code and Nusbio










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!



Tuesday, February 2, 2016

Technical Precisions About The Nusbio Device

What is Nusbio?

Nusbio is USB device that bring the following to a Windows machine and the Microsoft .NET Runtime:

Device

  • Gpios

    • 8GPIO pins
    • 3 or 5 volts 
      • Nusbio version based on the chip FT232RL can be changed between 3.3 and 5 volts (GPIO and VCC). In 2017 only the version based on the FT232RL will be sold.
      • Nusbio version based on the chip FT231X only the VCC can be changed between 3.3 and 5 volts. The GPIO are always 3.3 volts.
    • Modes: OUTPUT or INPUT PULL UP.
    • Maximum current per GPIO pin default 4 mA .
      The Console application allows to switch from 4 to 16 mA.
      In 16 mA of current mode we noticed that the I2C protocol does not work.
 Powering devices connected to Nusbio
    • The VCC output from Nusbio provides 5 or 3.3 volts and up to 500 mA of current as defined by the USB 2.0 standard.
    • The VCC output can be used to power other devices connected to Nusbio.
    • Some Nusbio version based on the FT231X have a fuse that will limit the consumption to 500 mA of current.
    • The voltage can be changed depending on the version as follow:
      • De-soldering the 5 volts connector and soldering the 3 volts connector.
      • Or switch the jumper between 5 volts and 3 volts
  • SPI Protocol

    • Mode

      • Clock MODE_CPOL0_CPHA0 supported and tested
      • The other 3 modes have been implemented but not tested.
    • Tested Devices

      • MCP3008 - 8 DAC
      • MAX7219 - 7-Segment Driver
      • 25AA256 - 32k EEPROM
      • 25AA1024 - 128k EEPROM
      • MCP23S08 - 8 Gpio Expander 
      • OLED drivers
        • SD1306
        • SH1106
      • SPI Compatible Devices
        • 74HC595 - Shift register
        • APA102 RGB LED
    • SPI Slave

      • Number of devices on an SPI bus. Since Nusbio comes with 8 gpios, we can control 5 (8-3 (clock, miso, mosi)) SPI devices on the same bus.
    • Transfert Speed

      • When data in and data out communication is needed (MOSI and MISO) the maximum transfer rate is around 15 k byte/s with no optimization.
      • With specific optimization for EEPROM downloading in batch of 128 pages of 64 bytes, the transfer rate can go up to 28 k byte/s.
      • Generally speaking when only data out communication is needed (no MISO) the transfer rate can go up to 20 k byte/s by using the class GpioSequence rather than the class SPIEngine. The class GpioSequence offers a way to optimize the bit banging.
      • Transfer speed vary depending on the SPI device and the Windows PC.
      • Nusbio and the C# class SPIEngine can transfer in one USB operation multiple SPI buffer (Select + Data + UnSelect + Select + Data + UnSelect).
      • Some SPI device like the OLED driver SH1106 or SSD1306, required on top of the Select pin (CS) another pin named D/C (Data or Command). Nusbio and the C# class SPIEngine can transfer in one USB operation multiple SPI buffer (Select + D/C + Data + UnSelect + Select + D/C + Data + UnSelect. (See our source code on GitHub).
  • I2C Protocol

    • Tested Devices:
      • 24LC256 32k EEPROM
      • MCP2308 - 8 Gpio Expander 
      • MCP9808 - Temperature sensor
      • MCP4725 - 12Bit DAC 
      • HT16K33 - Matrix Driver 
      • Adafruit I2C LED Matrix devices
    • Transfer Speed 
      • The tests were performed by downloading 32k from the I2C EEPROM 24LC256 . 
      • Transfer speed around 7.5K byte/s. 
      • Transfer speed vary depending on the device and the Windows PC.
  • SPI and I2C Protocol Combined

    With Nusbio it is possible to control SPI and I2C devices from the same configuration. For example

    • GPIO 0,1,2 would be reserved for SPI BUS: CLOCK, MOSI and MISO
    • GPIO 3,4,5 would be used as SELECT for 3 SPI Devices
    • GPIO 6,7 would be used as SDA and SCK for the I2C bus, allow to control up to 127 devices

  • UART

    Nusbio can also play the role of an UART (FTDI cable, FTDI Friend) to upload data into an micro-controller like an Adafruit Trinket or Diavolino.
    The .NET library MadeInTheUSB.Lib.dll does not support this mode. The Arduino IDE will support Nusbio to upload code into an micro-controller with no UART.

    Videos

  •  Library/Assembly

    • The MadeInTheUSB.Nusbio.Lib .NET assembly give access to the Nusbio device to any .NET language.
    • The MadeInTheUSB.Nusbio.Components assembly contains classes for specific components including the one used in the Nusbio's extensions.
    • Github Source

  • Internal EEPROM

    Nusbio can store up to 32 bytes of data into the Description field. Though the Description property is a .NET string, the EEPROM only support ASCII string.
  • Unique Serial Number

    Each Nusbio device is initialized with a unique Serial Number. See property SerialNumber.

Chip

Nusbio is based on the FTDI FT231X chip (Datasheet) or the FT232RL.
In 2017 only the FT232RL chip is used.

Friday, January 29, 2016

SPI EEPROM 25AA256 C++ Class For Arduino

Somehow I could not find a class for the SPI EEPROM 25AA256.

I created one. See Source on Github.

First test report reading the 32Kb in 215ms which means ~ 152Kb/s at 10 Mhz.

Thursday, January 21, 2016

How to plug and control an Liquid Crystal Display (LCD) into a Windows machine (C#)

How to plug and control an Liquid Crystal Display (LCD) into a Windows machine
Do you wonder why you can do some neat things with a Raspberry PI and Linux and hardware, but not with your PC and Windows.

With Nusbio, you can talk to other devices from a Windows machine using any .NET languages.
In this blog I show different i2c LCDs (Liquid Crystal Display).

A regular LCD requires a lot of wires. An i2c LCD requires only 4 wires (GND, 5V, DATA LINE and CLOCK LINE). The first i2c chip supported is the PCF8574. Other chip should easy to support.
LCD 16 columns 2 rows


$26 USA Shipping Included: Nusbio Board + Liquid Crystal Display 16x2


LCD 20 columns 4 rows


Videos


Source Code


Monday, January 11, 2016

How to plug and control an Liquid Crystal Display (LCD) into a Windows machine

Do you wonder why you can do some neat things with a Raspberry PI and Linux and hardware, but not with your PC and Windows.

With Nusbio, you can talk to other devices from a Windows machine using any .NET languages.
In this blog I show different i2c LCDs (Liquid Crystal Display).

A regular LCD requires a lot of wires. An i2c LCD requires only 4 wires (GND, 5V, DATA LINE and CLOCK LINE). The first i2c chip supported is the PCF8574. Other chip should easy to support.
LCD 16 columns 2 rows


$26 USA Shipping Included: Nusbio Board + Liquid Crystal Display 16x2


LCD 20 columns 4 rows


Videos


Source Code