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

USB low-full-high speed peripherals Forum Discussions

gean_3054931
Level 5
Level 5
10 likes given 5 likes given First like received

Hello,

Hello i am sending known pattern of 512 bytes through endpoint 6 from fx2lp to host.

i am adding count variable in the every 512 bytes transfer and making count increment.if i look at this count in the host side,i am not recieving proper count increment.i am requesting 51200 bytes in one TRANSFERIN button in the control center.count bytes are missing in the middle.please find the below code example and test patern recieved in the host.why some bytes are failed to commit to host?

int count=0;

BYTE Test_data;

void TD_Init( void )

{

  CPUCS = 0x02;

  SYNCDELAY;

// IFCONFIG = 0x03; 

/*Commented,default port mode*/

}

void TD_Poll( void )

{

  FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions

  SYNCDELAY;

  EP6FIFOCFG = 0x00; //switching to manual mode

  SYNCDELAY;

  for(loop=0;loop<512;loop++)

{

  EP6FIFOBUF[loop] = Test_data;

        SYNCDELAY;

        Test_data++;    

}

EP6FIFOBUF[511]=count;

SYNCDELAY;

  count++;

  EP6BCH=0x02; //512 bytes committed

  SYNCDELAY;

  EP6BCL=0x00;

  SYNCDELAY;

  FIFORESET = 0x00;  //Release NAKALL

        Test_data=0x00;

}

regadrs,

geetha.

0 Likes
1 Solution
Sananya_14
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Geetha,

Please use the following code snippet for TD_Poll()-

void TD_Poll( void )

{

  FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions

  SYNCDELAY;

  EP6FIFOCFG = 0x00; //switching to manual mode

  SYNCDELAY;

if(!(EP2468STAT & bmEP6FULL))

{

  for(loop=0;loop<512;loop++)

{

  EP6FIFOBUF[loop] = Test_data;

        SYNCDELAY;

        Test_data++;   

}

EP6FIFOBUF[511]=count;

SYNCDELAY;

  count++;

  EP6BCH=0x02; //512 bytes committed

  SYNCDELAY;

  EP6BCL=0x00;

  SYNCDELAY;

  FIFORESET = 0x00;  //Release NAKALL

        Test_data=0x00;

}

}

Best Regards,

Sananya

View solution in original post

0 Likes
1 Reply
Sananya_14
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Geetha,

Please use the following code snippet for TD_Poll()-

void TD_Poll( void )

{

  FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions

  SYNCDELAY;

  EP6FIFOCFG = 0x00; //switching to manual mode

  SYNCDELAY;

if(!(EP2468STAT & bmEP6FULL))

{

  for(loop=0;loop<512;loop++)

{

  EP6FIFOBUF[loop] = Test_data;

        SYNCDELAY;

        Test_data++;   

}

EP6FIFOBUF[511]=count;

SYNCDELAY;

  count++;

  EP6BCH=0x02; //512 bytes committed

  SYNCDELAY;

  EP6BCL=0x00;

  SYNCDELAY;

  FIFORESET = 0x00;  //Release NAKALL

        Test_data=0x00;

}

}

Best Regards,

Sananya

0 Likes