USB low-full-high speed peripherals Forum Discussions
I am using the CY7C68013A-128AXC to control a document scanner; the scanner transports items through an imager and lifts ~12MB of data.
Approximately 1 document is processed per second up to 75 documents can be managed as a bunch and stripped.
Command and response is managed over EP 4 & 2. EP 6 and 8 are used as BULK IN EPs for image and other data transfer.
The system is running at high speed (USB 2.0).
The system works well and I can see the normal flow of data on USB as we run commands over the BUS and ARM the image EPs to collect the data.
The BULK IN system works effectively and I can see the use of NAKs where appropriate.
Rarely though I will get a short window (100us) of BUS timeout/turnaround errors.
If I get three turnaround errors on a single EP the EP is halted and this effectively stops our transport, as we can't progress documents if we can't shift the image data.
This is an example of the issue.
I have just lifted 512 bytes from EP 8.
I then hit the window where each EP is effectively ignored by the FX2.
EP8 gets three strikes and the EP is halted by the USB HOST.
Interestingly EP 6 and 2 only get three strikes and actually recover with NAKs then deliver the data.
It looks like the FX2 has had it's Interrupt masked as the system has totally ignored the Host requests.
We are struggling to reproduce this at will, it is very rare but is impacting performance.
Is there a know weakness in this area, what could explain the turnaround errors.
My feeling is that I have some kind of race condition, I don't think this is noise or a ESD event it is too controlled and specific.
I suspect that all EPs are unresponsive, it was only EP 2 6 and 8 that were active during this window (100us).
Thanks in advance.
Don
Hi all,
I'm working on a project to use a CY7C65211/CY7C65211A as a USB-I2C interface in order to bootload several PSoC5 devices that are all on a single I2C bus.
To this end I picked up the CYUSBS234 kit to try and bear this out, but I've run into a few snags.
The description on the CYUSBS234 page (http://www.cypress.com/documentation/development-kitsboards/cyusbs234-usb-serial-single-channel-development-kit ) says it includes:
"Software drivers, Design documents for DVK (Schematics, Gerbers, and BOM), Configuration Utility, DVK User Guide, DVK Quick Start Guide, terminal application Tera Term, Application examples, and .NET framework files."
Of course what I found that this actually meant is that it includes the .NET Framework installer, not actual .NET libraries. They appear to be unmanaged C++ libraries, which seems a little funny, as it appears the cypress provided config utility is in written in .NET.
The idea was to build a bootloader host application in .NET as I have done with USB HID and UART bootload interfaces in the past. There are examples from Cypress, written in .NET that I was able to follow to get them going. The problem is for this USB-Serial API, there are no such examples.
Now, I'm a firmware guy and PC application development isn't my strong suit, so I have no idea how to get this API going in a .NET application. Getting the bootload host API going in .NET was as simple as following the instructions in chapter 5 of this guide: http://www.cypress.com/file/45376/download
The problem is, now I'm at the step where I have to talk to the USB-Serial bridge in order to write the OpenConnection/CloseConnection/ReadData/WriteData functions. The USB-Serial API is much larger, more complex, and there isn't a guide like the above link.
Does anyone maybe have some insight they could share into how I can get this working? It would be greatly appreciated.
Would I maybe be better off just writing a C++ console application so I can just call all this stuff native rather than having to worry about managed vs. unmanaged?
Show LessHello,
I have interfaced fx2lp with image sensor in slavefifo configuration with CDC usb class.
i have found this document link Flow control in USBUART in the cypress community.
how can i use XON /XOFF protocols in software/firmware.
I am using fx2lp 56 pin,it doesnot have UART physically.
regards,
geetha.
Show LessHello,
we are implemented CDC class in fx2lp.fx2lp is interfaced with image sensor in slavefifo configuration.we are developing
an android application.we are trying to recieve the image data from the fx2lp through usb (cdc class implemented).
because of contineous data from the usb,our android application.is not able to recieve the correct image data.so we need control
in the fx2lp side.is there any control (software/hardware) to control the flow of data from the fx2lp.
like cts,rts signals?
how to control data flow in the android application?
any control signals are there for the above scenario?
if it is cdc class,is there any tokens/siganls of USB that can acts as a cts or rts(like in uart) flow control signals?
if anything is there reagarding this,let me know.
regards,
geetha.
Show LessHi,
I need a USB 2.0 to audio bridge chip. Need high quality stereo output and microphone input. I'd prefer a canned solution. The
USB 2.0 will interface with a Cypress HX3PD Hub.
Thanks
Show LessHI engineer:
I have a demo board where from ADI .It uses CY7C68013A-128AXC to configure AD9517-4(Clock Generators, PLLs, Frequency Synthesizers,SPI interface ).What tool I can use to compile my code. And who can give me example codes? Because I'm a green hand.And how to cofigure FPGA、ADC are also needed.Thank you very much.
Show LessI have created a device that takes data generated and returns it to the PC. The data has a numbered sequence in it to allow us to know if we have data loss. Sometimes the device works well not dropping any data for long lengths of time. Other times it will dribble data, this is with the same hardware and same PC and App. Can you offer any advise as to how to get the data drop to cease?
Show LessHello,
I have a question:
why in CyUSB.dll you have to pass Byte array instead of OVERLAP struct
when call BeginDataXfer and/or FinishDataXfer ?
This increase complexity in develop program ...
Show LessHello Everyone,
I want to communicate with FPGA through FX2 USB using COM PORT. You can see my code( Virtual.c) down here, COM PORTis getting connected but data is not getting transfer.
This is the link of my firmware. i just changed code in "Virtual.c" file. http://www.cypress.com/documentation/application-notes/an58764-implementing-virtual-com-port-using-fx2lp
Can anyone guide me throgh this?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma NOIV // Do not generate interrupt vectors
//-----------------------------------------------------------------------------
// File: bulkloop.c
// Contents: Hooks required to implement USB peripheral function.
//
// Copyright (c) 2000 Cypress Semiconductor All rights reserved
//-----------------------------------------------------------------------------
#include "fx2.h"
#include "fx2regs.h"
#include "fx2sdly.h" // SYNCDELAY macro
extern BOOL GotSUD; // Received setup data flag
extern BOOL Sleep;
extern BOOL Rwuen;
extern BOOL Selfpwr;
xdata volatile unsigned char D3ON _at_ 0x9800;
xdata volatile unsigned char D3OFF _at_ 0x9000;
static int x;
unsigned char duk;
static int bcl,i;
xdata volatile unsigned char D5ON _at_ 0xB800;
xdata volatile unsigned char D5OFF _at_ 0xB000;
unsigned char dum;
static int z;
extern BYTE xdata LineCode[7] ;
BYTE Configuration; // Current configuration
BYTE AlternateSetting; // Alternate settings
void display_product(void);
void TD_Poll(void);
//-----------------------------------------------------------------------------
// Task Dispatcher hooks
// The following hooks are called by the task dispatcher.
//-----------------------------------------------------------------------------
BOOL DR_SetConfiguration();
BYTE TxByte0,RxByte0;
BYTE TxByte1,RxByte1;
void transmit(void)// Sends data to SBUF0
{
if (!(EP1OUTCS & 0x02))
{
if(i<bcl)
{
SBUF0=EP1OUTBUF;
i++;
dum=D5ON;
z^=1;
if (z)
{dum=D5OFF;}
}
else
{
EP1OUTBC = 0x04;// Arms EP1 endpoint
}
}
}
void Serial0Init () // serial UART 0 with Timer 2 in mode 1 or high speed baud rate generator
{
SCON0 = 0x5A; // Set Serial Mode = 1, Recieve enable bit = 1
T2CON = 0x34; // Int1 is detected on falling edge, Enable Timer0, Set Timer overflow Flag
if ((LineCode[0] == 0x60) && (LineCode[1] == 0x09 )) // 2400
{
RCAP2H = 0xFD; // Set TH2 value for timer2
RCAP2L = 0x90; // baud rate is set to 2400 baud
}
else if ((LineCode[0] == 0xC0) && (LineCode[1] == 0x12 )) // 4800
{
RCAP2H = 0xFE; // Set TH2 value for timer2
RCAP2L = 0xC8; // baud rate is set to 4800 baud
}
else if ((LineCode[0] == 0x80) && (LineCode[1] == 0x25 )) // 9600
{
RCAP2H = 0xFF; // Set TH2 value for timer2
RCAP2L = 0x64; // baud rate is set to 9600 baud
}
else if ((LineCode[0] == 0x00) && (LineCode[1] == 0x4B )) // 19200
{
RCAP2H = 0xFF; // Set TH2 value for timer2
RCAP2L = 0xB2; // baud rate is set to 19200 baud
}
else if ((LineCode[0] == 0x80) && (LineCode[1] == 0x70 )) // 28800
{
RCAP2H = 0xFF; // Set TH2 value for timer2
RCAP2L = 0xCC; // baud rate is set to 28800 baud
}
else if ((LineCode[0] == 0x00) && (LineCode[1] == 0x96 )) // 38400
{
RCAP2H = 0xFF; // Set TH2 value for timer2
RCAP2L = 0xD9; // baud rate is set to 38400 baud
}
else if ((LineCode[0] == 0x00) && (LineCode[1] == 0xE1 )) // 57600
{
RCAP2H = 0xFF; // Set TH2 value for timer2
RCAP2L = 0xE6; // baud rate is set to 57600 baud
}
else //if ((LineCode[0] == 0x21) && (LineCode[1] == 0x20 )) // 115200 (LineCode[0] == 0x00) && (LineCode[1] == 0xC2 ))
{
RCAP2L = 0xF3;
RCAP2H = 0xFF;
}
TH2 = RCAP2H; // Upper 8 bit of 16 bit counter to FF
TL2 = RCAP2L; // value of the lower 8 bits of timer set to baud rate
}
void TD_Init(void) // Called once at startup
{
// set the CPU clock to 48MHz
CPUCS = 0x12; //((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
// set the slave FIFO interface to 48MHz
IFCONFIG |= 0xCB;
SYNCDELAY;
// REVCTL = 0x00;
// SYNCDELAY;
PINFLAGSAB = 0xE0; // FLAGB - EP6FF
SYNCDELAY;
PINFLAGSCD = 0x0B; // FLAGC - EP8EF
SYNCDELAY;
FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions
SYNCDELAY; // see TRM section 15.14
FIFORESET = 0x02; // reset, FIFO 2
SYNCDELAY; //
FIFORESET = 0x04; // reset, FIFO 4
SYNCDELAY; //
FIFORESET = 0x06; // reset, FIFO 6
SYNCDELAY;
FIFORESET = 0x08; // reset, FIFO 8
SYNCDELAY; //
FIFORESET = 0x00; // deactivate NAK-ALL
SYNCDELAY;
EP1OUTCFG = 0xA0; // Configure EP1OUT as BULK EP
SYNCDELAY;
EP1INCFG = 0xA0; // Configure EP1IN as BULK IN EP
SYNCDELAY; // see TRM section 15.14
EP2CFG = 0x02; // Invalid EP
SYNCDELAY;
EP4CFG = 0x02; // Invalid EP
SYNCDELAY;
EP6CFG = 0xE2; //
SYNCDELAY;
EP8CFG = 0xA2; // Configure EP8 as BULK IN EP
SYNCDELAY;
EP8FIFOCFG = 0x00; // Configure EP8 FIFO in 8-bit Manual Commit mode
SYNCDELAY;
EP8FIFOCFG = 0x10;
SYNCDELAY;
EP6FIFOCFG = 0x08;
SYNCDELAY;
PORTACFG = 0x40;
SYNCDELAY;
T2CON = 0x34;
EPIE |= bmBIT3 ; // Enable EP1 OUT Endpoint interrupts
AUTOPTRSETUP |= 0x01; // enable dual autopointer feature
Rwuen = TRUE; // Enable remote-wakeup
EP1OUTBC = 0x04;
ES0 = 1; /* enable serial interrupts */
PS0 = 0; /* set serial interrupts to low priority */
TI = 1; /* clear transmit interrupt */
RI = 0; /* clear receiver interrupt */
EA = 1; /* Enable Interrupts */
Serial0Init(); // Initialize the Serial Port 0 for the Communication SCO
}
void TD_Poll(void) // Called repeatedly while the device is idle
{
// Serial State Notification that has to be sent periodically to the host
if (!(EP1INCS & 0x02)) // check if EP1IN is available
{
EP1INBUF[0] = 0x0A; // if it is available, then fill the first 10 bytes of the buffer with
EP1INBUF[1] = 0x20; // appropriate data.
EP1INBUF[2] = 0x00;
EP1INBUF[3] = 0x00;
EP1INBUF[4] = 0x00;
EP1INBUF[5] = 0x00;
EP1INBUF[6] = 0x00;
EP1INBUF[7] = 0x02;
EP1INBUF[8] = 0x00;
EP1INBUF[9] = 0x00;
EP1INBC = 10; // manually commit once the buffer is filled
}
// recieving the data from the USB Host and send it out through UART
// recieve the data from UART and send it out to the USB Host
}
BOOL TD_Suspend(void) // Called before the device goes into suspend mode
{
return(TRUE);
}
BOOL TD_Resume(void) // Called after the device resumes
{
return(TRUE);
}
//-----------------------------------------------------------------------------
// Device Request hooks
// The following hooks are called by the end point 0 device request parser.
//-----------------------------------------------------------------------------
BOOL DR_GetDescriptor(void)
{
return(TRUE);
}
BOOL DR_SetConfiguration(void) // Called when a Set Configuration command is received
{
Configuration = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetConfiguration(void) // Called when a Get Configuration command is received
{
EP0BUF[0] = Configuration;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_SetInterface(void) // Called when a Set Interface command is received
{
AlternateSetting = SETUPDAT[2];
return(TRUE); // Handled by user code
}
BOOL DR_GetInterface(void) // Called when a Set Interface command is received
{
EP0BUF[0] = AlternateSetting;
EP0BCH = 0;
EP0BCL = 1;
return(TRUE); // Handled by user code
}
BOOL DR_GetStatus(void)
{
return(TRUE);
}
BOOL DR_ClearFeature(void)
{
return(TRUE);
}
BOOL DR_SetFeature(void)
{
return(TRUE);
}
BOOL DR_VendorCmnd(void)
{
return(TRUE);
}
//-----------------------------------------------------------------------------
// USB Interrupt Handlers
// The following functions are called by the USB interrupt jump table.
//-----------------------------------------------------------------------------
// Setup Data Available Interrupt Handler
void ISR_Sudav(void) interrupt 0
{
GotSUD = TRUE; // Set flag
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUDAV; // Clear SUDAV IRQ
}
// Setup Token Interrupt Handler
void ISR_Sutok(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUTOK; // Clear SUTOK IRQ
}
void ISR_Sof(void) interrupt 0
{
EZUSB_IRQ_CLEAR();
USBIRQ = bmSOF; // Clear SOF IRQ
}
void ISR_Ures(void) interrupt 0
{
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
pOtherConfigDscr = pFullSpeedConfigDscr;
}
else
{
pConfigDscr = pFullSpeedConfigDscr;
pOtherConfigDscr = pHighSpeedConfigDscr;
}
EZUSB_IRQ_CLEAR();
USBIRQ = bmURES; // Clear URES IRQ
}
void ISR_Susp(void) interrupt 0
{
Sleep = TRUE;
EZUSB_IRQ_CLEAR();
USBIRQ = bmSUSP;
}
void ISR_Highspeed(void) interrupt 0
{
if (EZUSB_HIGHSPEED())
{
pConfigDscr = pHighSpeedConfigDscr;
pOtherConfigDscr = pFullSpeedConfigDscr;
}
else
{
pConfigDscr = pFullSpeedConfigDscr;
pOtherConfigDscr = pHighSpeedConfigDscr;
}
EZUSB_IRQ_CLEAR();
USBIRQ = bmHSGRANT;
}
void ISR_Ep0ack(void) interrupt 0
{
}
void ISR_Stub(void) interrupt 0
{
}
void ISR_Ep0in(void) interrupt 0
{
}
void ISR_Ep0out(void) interrupt 0
{
}
void ISR_Ep1in(void) interrupt 0
{
}
void ISR_Ep1out(void) interrupt 0// Places first byte of EP1 OUT buffer in SBUF0
{
EZUSB_IRQ_CLEAR(); //Clears the USB interrupt
EPIRQ = bmBIT3; //Clears EP1 OUT interrupt request
while (TI == 1) ;
i=0;
bcl=EP1OUTBC;
SBUF0=EP1OUTBUF;
i++;
}
void ISR_Ep2inout(void) interrupt 0
{
}
void ISR_Ep4inout(void) interrupt 0
{
}
void ISR_Ep6inout(void) interrupt 0
{
}
void ISR_Ep8inout(void) interrupt 0
{
}
void ISR_Ibn(void) interrupt 0
{
}
void ISR_Ep0pingnak(void) interrupt 0
{
}
void ISR_Ep1pingnak(void) interrupt 0
{
}
void ISR_Ep2pingnak(void) interrupt 0
{
}
void ISR_Ep4pingnak(void) interrupt 0
{
}
void ISR_Ep6pingnak(void) interrupt 0
{
}
void ISR_Ep8pingnak(void) interrupt 0
{
}
void ISR_Errorlimit(void) interrupt 0
{
}
void ISR_Ep2piderror(void) interrupt 0
{
}
void ISR_Ep4piderror(void) interrupt 0
{
}
void ISR_Ep6piderror(void) interrupt 0
{
}
void ISR_Ep8piderror(void) interrupt 0
{
}
void ISR_Ep2pflag(void) interrupt 0
{
}
void ISR_Ep4pflag(void) interrupt 0
{
}
void ISR_Ep6pflag(void) interrupt 0
{
}
void ISR_Ep8pflag(void) interrupt 0
{
}
void ISR_Ep2eflag(void) interrupt 0
{
}
void ISR_Ep4eflag(void) interrupt 0
{
}
void ISR_Ep6eflag(void) interrupt 0
{
}
void ISR_Ep8eflag(void) interrupt 0
{
}
void ISR_Ep2fflag(void) interrupt 0
{
}
void ISR_Ep4fflag(void) interrupt 0
{
}
void ISR_Ep6fflag(void) interrupt 0
{
}
void ISR_Ep8fflag(void) interrupt 0
{
}
void ISR_GpifComplete(void) interrupt 0
{
}
void ISR_GpifWaveform(void) interrupt 0
{
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Show Less