USB low-full-high speed peripherals Forum Discussions
I 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 LessHello,
I have implemented successfully cdc class in fx2lp firmware,i can recieve data from the fx2lp to pc(usb serial).
how can i check baudrate in this situation like in normal uart baud rate (baudrate settings require on both tx and rx side)?
how it will be configured in fx2lp side(firmware)?
in windows side,we are setting 9600bps in hercules terminal?
regards,
geetha.
Show LessI can't install CYUSB236 DVK software in my PC.
When I try to install, CyInstaller is said , "Microsoft VC ++ 2008 Redistributable is not install".
However, various versions of Redistributable package (including Ver. 2008) have already installed on the PC.
Why can't I install?
Is there anything else I should do?
Show Less
Hello, Cypress expert,
I have a question about the EZ-USB FX2. I am using uVision Toolchain C51 compiler/Assembler Kit Version:9.56.0.0.
after compile, it generates a hex file. I run "HEX2BIX -IR -M 16384 -F 0xC2 -O Scan_BD_FW.iic Scan_BD_FW.hex" to convert it to iic format,
this iic file works fine with cyconsole. but if I use the hex file write to microchip 24lc128. the system not work.
so I have to use Cyconsole to load the iic file to this eeprom. and use the eeprom programmer to read the master chip file out. then load this file to the chip.
I don't understand why the Hex file can't be used directly to load the EEprom. is there any trick? do we need to setup some special parameter of the eeprom programmer to make it work.
Thanks,
David Sun
Show Lesshello ,
we are using the CDC Class in FX2LP to write data to port we want to set the baud rate more than 921600 when i referred the application note AN58764 maximum baud rate is 115200 . how to increase that baud rate to around 921600 . if any one has idea please let me know .
thanks regards,
veerendra
Show LessHi,
I'm using CY7C68013A-56BAXC and I have a problem about heating issue of this device.
Heating occured after device configured.
What makes this device heating?
I think some register of device makes heating.
Please advice me about this heating issue.
Best Regards,
Matthew
Show LessGood afternoon all,
Am trying to blink an led using fx2lp breakout board. We connected one led at pin portA.0. By keeping examples program as reference given in the fx2lp dvk kit website We written the code for this one. We are getting error as shown below.
Please let me know how to solve this problem.
#include<reg51F.h>
sbit led = PA.0;
void wait(int x)
{
int i, j;
for(i = 0; i<x; i++)
{
for(j = 0; j<25; j++);
}
}
int main()
{
while(1)
{
led = 1;
wait(100);
led = 0;
wait(100);
}
return 0;
}
Regards
Vimala
Hi ,
We are using cypress USB products .when we will connect to PC via USB and checked in Device manager these devices comes under Universal serial Bus controller category but we want as imaging Device because we interfaced with image sensor i have attached the screenshot PFA. So we wanted to change from Universal serial Bus controller category to imaging Device .Can any one help me to change ?.
Thanks Regards ,
Veerendra
Show Less