Problem to make a bulktransfer, FX2LP/CyConsole

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

I work with a FX2LP board (CY7C68016A). I try to communicate with the device in SLAVE FIFO mode and AUTO mode.

   

This is my initialization:

   

/***************************************************************************************************************/

   

void TD_Init(void)                 // Called once at startup
{


    CPUCS = 0x0A;        // CLKSPD[1:0]=10, for 24 MHz operation, output CLKOUT
    IFCONFIG = 0x6F;    // external clock source,24 MHZ drive IFCLK, asynchronous slave FIFO mode

    PINFLAGSAB = 0xAE; // FLAGA Empty flag EP6 - FlagB  FULL flag EP6
    SYNCDELAY;
    PINFLAGSCD = 0xE0; // FLAGD - EP2 Emtpy flag
    SYNCDELAY;

    PORTACFG |= 0x80;
 
    EP4CFG = 0x02; //clear the valid bits on ep4 and ep8
    SYNCDELAY;
    EP8CFG = 0x02;
    SYNCDELAY;
    EP2CFG = 0xA0; // OUT, 512-bytes, 4x, bulk
    SYNCDELAY;
    EP6CFG = 0xE0; // IN, 512-bytes, 4x, bulk

    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


    // handle the case where we were already in AUTO mode...
    // ...for example: back to back firmware downloads...

    SYNCDELAY; //
    EP2FIFOCFG = 0x00; // AUTOOUT=0, WORDWIDE=0


    // core needs to see AUTOOUT=0 to AUTOOUT=1 switch to arm endp's
    SYNCDELAY; //
    EP2FIFOCFG = 0x10; // AUTOOUT=1, WORDWIDE=0

    SYNCDELAY; //
    EP6FIFOCFG = 0x4C; // AUTOIN=1, ZEROLENIN=1, WORDWIDE=0, INFM = 1;


    SYNCDELAY;

    Rwuen = TRUE;                // Enable remote-wakeup
    EE_Page_Size = 0;           // Set the page size to 0, so we know to calculate it on an EEPROM write
   
    // Determine I2C boot eeprom device address; addr = 0x0 for 8 bit addr eeproms (24LC00)

    I2C_Addr = SERIAL_ADDR | ((I2CS & 0x10) >> 4); // addr=0x01 for 16 bit addr eeprom (LC65)
    // Indicate if it is a dual byte address part
    DB_Addr = (BOOL)(I2C_Addr & 0x01); // ID1 is 16 bit addr bit - set by rocker sw or jumper
}

   


   

/***************************************************************************************************************/

   

 

   

When I tried to send 1 byte with CyConsole the "bulk OUT" failed.

   

I'm new and I need help to know why I can't transfer just 1 byte on the device.

   

In addition I tested the device with "bulkloop.hex" and the device work, so I assume I have a problem in my device configuration.

   

 

   

Best regards

   

Thierry

0 Likes
7 Replies
Anonymous
Not applicable

 Hi Thierry,

   

 

   

In order to send any data to BULK OUT endpoint, you must Arm the endpoints. Since it sis quad buffered, it must be armed four times. Arming can be done as follows:

   

EP2BCL = 0x80;

   

SYNCDELAY;

   

   

EP2BCL = 0x80;

   

SYNCDELAY;

   

   

EP2BCL = 0x80;

   

SYNCDELAY;

   

   

EP2BCL = 0x80;

   

SYNCDELAY;

   

Please paste this code at the end of TD_Init() function, and this must solve the issue.

   

 

   

Regards,

   

Gayathri

0 Likes
Anonymous
Not applicable

 Few things that I noticed:

   

Are you testing with the FX2LP DVK board?

   

You have configured IFCONFIG to take external clock. Check whether the clock is available. Otherwise just for testing make it internal as it is in bulkloop examples.

   

Otherthing is that you are not arming the OUT endpoints. You need to do that.

   

Please refer to 9th chapter of the "EZ-USB® Technical Reference Manual" to get more details. Go through section 9.3 to find more details regarding your configuration.

   

Thanks,

   

sai krishna.

0 Likes
Anonymous
Not applicable

Thank you for your answers.

   

I will test it as soon as possible

   

Thierry

0 Likes
Anonymous
Not applicable

Hi,

   

I tested  Gayathri's code but it didn't work. So I check if the external clock was available and it wasn't. I modified my FPGA design and now I can see the clock on the FX2LP board with an oscilloscope. 

   

But now when I put the device on windows the device is not reconized with the clock. Before the PC could reconize it without problem.

   

Do you know why the device have this behavior?

   

Best regards

   

Thierry

0 Likes
Anonymous
Not applicable

 Hi,

   

    Please see http://www.cypress.com/?rID=43046.

   

Thanks

   

Prajith

0 Likes
Anonymous
Not applicable

Hi,

   

Thank you Prajith for this link, but this application use an internal clock.

   

I try to use a 24 MHz clock from FPGA chip (CycloneIII Altera).

   

Without this clock, Windows can reconize the device. When I put the clock windows see a "Unknown Device". I found this link:   http://www.cypress.com/?id=4&rID=37601

   

I checked  and followed I found but it didn't resolve my problem.

   

My question is, How can I use an external clock properly?

   

Best regards

   

Thierry

0 Likes
Anonymous
Not applicable

 Thierry,

   

Are you seeing issue with enumeration or re-enumeration?.

   

In other way, Are you able to download the code into FX2LP board?.

   

If yes, then please make sure that the external IFCLK is present before FX2LP starts executing the firmware.

0 Likes