[TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

For issues with communication ports, protocols, etc.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

[TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

Postby D.J.Peters » Nov 08, 2014 5:28

Today I got a cheap 7$ mini EZ-USB FX2LP High-Speed USB 2.0 dev board with a Cypress CY7C68013A-56 controler.

click to enlarge:
Image

Of course you can use the free USB driver CyUSB.sys with FreeBASIC. (I posted the USB stuff for Linux,Windows in the past)

If you will create your own USB device firmware you can download the docs and tools from Cypress
and you will get a toolchain and IDE from Keil as light/demo version for free.
(its limited you can compile only few KB on code)

I found the open source SDCC - The Small Device C Compiler on sourceforge.net.

Here are my first useless but working test. (blinking LED)

Code: Select all

#define ALLOCATE_EXTERN
#include "fx2regs.h"
#include "fx2types.h"
#include "delay.h"

void main(void) {
  OED=0xff; // port D as output
  for(;;) {
    IOD=0x00; // all 8 pins low
    delay(500);
    IOD=0xff; // all 8 pins high
    delay(500);
  }
}
Of course I use code blocks for this tiny dev board also.

You must compile the USB device descriptors *.asm and your own firmware *.c
asm: sdas8051 -logs dscr.asm

c: sdcc -lfx2.lib -L../../lib -I../../include -mmcs51 --code-size 0x2000 --xram-loc 0x3000 -Wl"-b DSCR_AREA = 0x2000" -Wl"-b INT2JT = 0x2200" led.c dscr.rel

optinal: convert the intel hex file to a binary for upload.
sdobjcopy -I ihex -O binary led.ihx led.bix

Some details of the CY7C68013A:
8051 CPU with 48 MHz, 24 I/O lines (Port A,B,D), Timers, GPIF (hardware I/O waveform designer), 16 KB SRAM + ATMEL AT24C128 serial Flash and much more.

I'ts a USB bus powered 3.3 V device but the I/O pins are 5V tolerant.

For example you can sample Ports B,D = 16 I/O lines in a loop
and transfer chunks of the samples via USB cable to your FreeBASIC Windows/Linux/ARM application.

The result are the base of a 16 channel 24 MHz USB logic analyzer for 7$. ;-)

Or you control what ever you want with 24 I/O lines over USB.
The good old LPT port does the same but with fewer lines and much lower speed and it dies more and more.

Joshy
Last edited by D.J.Peters on Oct 03, 2017 8:32, edited 3 times in total.
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: [TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

Postby D.J.Peters » Nov 08, 2014 6:45

I found the souce code of C library 'fx2lib' for the device for sdcc on sourceforge.net also.

https://sourceforge.net/projects/fx2lib/

It's a old version for SDCC, if you run make you will get ton's of error's.
You can solve it simple replace all this keywords xdata, interrupt, using, bit, at, sfsr, sbit, _asm, _endasm
with __xdata, __interrupt, __using, __bit, __at, __sfsr, __sbit, __asm, __endasm

Thats all.

Joshy

By the way it's a perfect device for your Arduino, Raspberry PI or Beaglebone too.
neirons
Posts: 1
Joined: May 03, 2015 13:59

Re: [TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

Postby neirons » May 03, 2015 14:06

Hello, there is part from your post:
You must compile the USB device descriptors *.asm and your own firmware *.c
asm: sdas8051 -logs dscr.asm

Can You please, show to us Your dscr.asm ?
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: [TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

Postby D.J.Peters » May 08, 2015 4:08

Sorry I don't have the stuff on my HD anymore.

Joshy
D.J.Peters
Posts: 7169
Joined: May 28, 2005 3:28
Location: Germany

Re: [TIP]Cheap USB2.0 High/Full speed CY7C68013A with SDCC.

Postby D.J.Peters » Mar 17, 2016 23:19

A Board with Cypress CY7C68013A FX2LP USB2.0 chip for 5$ free shipping
I tested the small devices C compiler SDCC on Windows and Ubuntu Linux today.
http://sdcc.sourceforge.net

Many new PC's does not have a LPT port for I/O projects so If you need 24 high speed USB GPIOs give it a try.

Joshy

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest