This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cannot write to I/O port of Cypress' EZ-USB FX2 cy7c68013.

Hi everybody,
I want to write to I/O port by vendor command. But it doennot work. The firmware is like this:

	 case VR_WRITE_PORTA:  //0xD5

  		while(EP0CS & bmEPBUSY);

	 	OEA = 0xff;
		SYNCDELAY;

		IOA =  EP0BUF[0];

		SYNCDELAY;
	        EP0BCH = 0x00;
		SYNCDELAY;
		EP0BCL = 0x01; // Arm endpoint with # bytes to transfer
	        SYNCDELAY;

		EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
	 	SYNCDELAY;
		break;



Could anyone give me some suggestions, please? Thanks.

  • Well, since you have told us absolutely nothing about why you have arrived at "it doennot work", I will take a guess:

    • SYNCDELAY is too short
    • SYNCDELAY is too long
    • SYNCDELAY is just right and something else is wrong
    Did I guess correctly?

  • Hi Dan,
    I test the firmware like this:

    First, I got the PortA state as,for example '0x00'.Then I want to change it to '0xff' by vendor command '0xd5'.

    On Control Panel,I fill in '0xd5' in Req, and Choice the Dir as'OUT', then fill the data I want to send, for example 'ff',Length as '1',then I click the 'Vend Req'button. If the firmware runs I will get 'ff' on PortA, but, PortA keeps its former state '00'. The firmware does not affect PortA at all.

    Could this be the reason of incorrect use of 'SYNCDELAY'? Could you give me some suggestions, please?

    Thanks.