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;
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.