USB low-full-high speed peripherals Forum Discussions
Hi
I want make output direction partially out and in.
When i set to OEA=oxff, as i know, this direction is out.
But i think another pin also have same direction.
How can i set partially?
Also what is IOA ?
Show LessHi
In USBTV, i have confused in i2c_hw.c.
I can see that sub_type variable is in DBG of I2CWrite function but (sub_type!=0) syntex is not existed in DBG.
If i not use DBG, what have default value to sub_type variable?
Also , how should i understand this syntex?
Could you please let me know?
Show LessHi,
I've had a working FX2 application that sends back data from a device over a quad-buffered bulk IN endpoint (EP2) for the past year. On the host side I'm using libusb with the usb_bulk_read() command to read the EP:
int usb_bulk_read
(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout);
If data in the device has not yet filled the FIFO, the above request times out (after a period of timeout milliseconds) and this is the way I always assumed it had to work.
Recently however, I've been in touch with another person who explained that upon a bulk read on their device, the device automatically sends NACK tokens until the device is ready; apparently avoiding the necessity of a time out.
Likewise, on http://www.beyondlogic.org/usbnutshell/usb4.shtml#Bulk it says:
IN: When the host is ready to receive bulk data it issues an IN Token. If the function receives the IN token with an error, it ignores the packet. If the token was received correctly, the function can either reply with a DATA packet containing the bulk data to be sent, or a stall packet indicating the endpoint has had a error or a NAK packet indicating to the host that the endpoint is working, but temporary has no data to send.
I bolded the key phrase. So there seems to be 3 conditions, not 2 (data or timeout (stall?)). Perhaps my endpoint is configured to respond to the host with a Stall while perhaps it's possible for me to respond with a NACK and have the host just repeatedly request the packet until data shows up?
Can anyone help me understand this, especially in the context of how I might configure the FX2 Endpoints to respond differently to a bulk read request?
Note that I've read over the TRM (not always getting every detail understood) and do see some brief discussion on the STALL bit which might be the key, but little explanation on how a Stall packet vs. NACK packet would be interpreted by the host when doing a bulk-read command...
Thanks!
Scott
Show Lesshi
i use i2c_hw.c and i comment DBG, but error happened.. like this
//#define DBG
what am i do ? could you please check the code again?
I2C_HW.C(43): warning C236: '_I2CWrite': different length of parameter lists
I2C_HW.C(114): error C202: 'sub_type': undefined identifier
I2C_HW.C(116): error C202: 'sub_type': undefined identifier
I2C_HW.C(158): error C202: 'sub_type': undefined identifier
I2C_HW.C(168): error C202: 'sub_type': undefined identifier
I2C_HW.C(208): error C202: 'i': undefined identifier
I2C_HW.C(210): error C202: 'i': undefined identifier
Show LessHi.
I have some question about using i2c_hw.c form USBTV example.
1.As i know, i2c is need initalize firstly. can i use EZUSB_InitI2C?
2.If i use Device ID is 0x40 and Slave address is 0x63,these are need right shift (>>1) ?
3.Am i just replace from EZUSB_WriteI2C to I2CWrite?
Show LessHi,
I'm working with a CY7C68013A-FX2LP. We started with the provided mass storage device example firmware and added a second interface that uses endpoint 1.
We use winusb to communicate over this second interface, with a custom protocol, when the device receives something on endpoint 1 it results in an I2C transaction / GPIO wiggling.
This works perfectly as it is, I plug in the dongle, it loads it's firmware, enumerates, the windows "what shall we do with this mass storage thing" pops up. I run my windows code to do a set of sample transactions over the second interface, which runs as expected.
I can also read, write and delete from the mass storage device correctly.
However I have a problem if I am doing a mass storage transfer (say writting 50MB to the dongle) and running my custom code at the same time. The first request tends to go through OK (sending 01 00), however the second request fails. Debugging has told me that the bytes I send are on the wire (02 00 0A). The EP1 OUT BUSY bit is 0 in the EP01STAT register, meaning there is data to read. However the EP1OUTBC register is 0. Meaning there is no data to read. If I ignore this and read 10 bytes anyway fromthe EP1OUTBUF buffer, I see (01 00 .....) which matches the first packet I read in.
After this request fails, about 1s later the USB reset interrupt fires and the device resets (although the mass storage transfer continues running). This doesn't always happen, but it does quite often. Also using a USB analyser I was unable to see a reset condition on the line.
So as far as I can tell, I send a request, it's defintiely on the wire, the dongle receives it and notifies that it has been received, yet the buffer and byte count registers haven't been updated.
USB descriptors: http://slexy.org/view/s21Tk2YNtj
Endpoint setup: http://slexy.org/view/s20U5otzq5
EP1 poll code: http://slexy.org/view/s21itwaq6L (the autoptrs are commented out for debugging, the problem happens either way).
Apologies if any of the code is messy / un-needed, I've been trying not to touch stuff that works, with the aim of tidying it all up later.
Any help would be greatly appeciated, as I can't figure out where to go from here.
Show LessHi
Can i handle device id in I2c function of EZUSB.LIB?
I think there is not i2c device address handle function in EZUSB.LIB.
So is there any way how to use device address ?
I think there is only EZUSB_WriteI2C and EZUSB_ReadI2C.
Show LessHi.
I working i2c with fx2lp.
My i2c chip address is 0x23. and i2c address 8bit and data 8bit.
I want write address 0x18 , data 0x37. So how do i make i2c command line?
Could you please let me know where is not correct and how can i fix?
Firmware :
BOOL DR_VendorCmnd( void )
{
BYTE addr;
BYTE fail;
BYTE count;
BYTE tmp;
WORD wValue;
WORD wIndex;
wValue = SETUPDAT[2];
wValue |= SETUPDAT[3]<<8;
wIndex = SETUPDAT[4];
wIndex |= SETUPDAT[5]<<8;
switch (SETUPDAT[1])
{
case VENDOR_CMD1:
EZUSB_InitI2C();
Cmd1[0] = 0x02;
while(EZUSB_WriteI2C(0x23 >> 1, 0x01, Cmd1) != I2C_OK) {
;
}
EZUSB_WaitForEEPROMWrite(0x23 >> 1);
Cmd1[0] = 0x37;
while(EZUSB_WriteI2C(0x18 >> 1, 0x01, Cmd1) != I2C_OK) {
;
}
EZUSB_WaitForEEPROMWrite(0x18 >> 1);
EZUSB_ReadI2C(0x18 >> 1, 0x01, Cmd1);
EP0BUF[0] = Cmd1[0];
EP0BCH = 0;
EP0BCL = 1;
EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
break;
default:
return(TRUE);
}
return(FALSE);
}
PC application side :
if(init_USB()){
ept0 = USBDevice->ControlEndPt;
ept0->Target = TGT_DEVICE;
ept0->ReqType = REQ_VENDOR;
ept0->Direction = DIR_FROM_DEVICE;
ept0->ReqCode = 0xDA;
ept0->Value = ii;
ept0->Index = 0x00;
unsigned char buf[2];
ZeroMemory(buf,2);
LONG buflen = 2;
ept0->Read(buf,buflen);
UpdateData(FALSE);
}
Please let me know where am i do fix ?
Show Less1)Hardware enviroment
Our board use CY7C68013A as synchronouse slave fifo, and a fpga as master.
CY7C68013A's CLKOUT at 12MHz, and FPGA's PLL use as input, output 40Mhz as CY7C68013A's IFCLK.
EEPROM is blank.
2)firmware and modification
use Cypress Suite USB 3.4.7\Firmware\Bulkloop example, and only modify BulkLoop.c as follow:
// CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
// CPUCS = (CPUCS & ~bmCLKSPD) |bmCLKSPD0; //24MHz
CPUCS = CPUCS & ~bmCLKSPD ; //12MHz CLKOUT
// set the slave FIFO interface to 48MHz
//IFCONFIG |= 0x40;
IFCONFIG = 0x03; //slave fifo, sync, external
3)host pc
windows 7 32bit.
Cypress Suite USB 3.4.7
CY3684_EZ-USB_FX2LP_DVK