>>Я пробовал в "CyConsole.exe" рестартовать устройство, или его ресетить, но у меня не получилось, чтобы оно снова ренумерировалось и нормально работало
Как ты загружал? Я в консоли делал Select Monitor->выбрал хекс файл->Load Monitor.
Все загрузилось.
Я увидел новые PID/VID в USBView (это прога у микрософта есть бесплатна).
Ты прогой этой после загрузки посмотри там все параметры девайса выдаются.
Программно хекс гружу так
Код
void USBIO32::LoadHexFile(wchar_t* filename)
{
//reset and hold
Reset(true);
HANDLE hex = CreateFile(filename,GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if(hex == 0)
{
MessageBox(0,L"Failed to open file",L"Error",MB_OK);
return;
}
int len = 0;
int offset = 0;
int type = 0;
char code[9];
char data[2];
UCHAR decoded[40];
DWORD nbr = 0;
while(true)
{
ReadFile(hex,&code,9,&nbr,0);
if((nbr!=9)||(code[0]!=':'))
{
MessageBox(0,L"Invalid hex file",L"Error",MB_OK);
return;
}
len = GetCode(code+1,2);
offset = GetCode(code+3,4);
type = GetCode(code+7,2);
if(len<=0)
break;
if(len>40)
{
MessageBox(0,L"Hex data record is too long",L"Error",MB_OK);
return;
}
for(int i=0;i<len;++i)
{
ReadFile(hex,data,2,&nbr,0);
if(nbr!=2)
{
MessageBox(0,L"Error reading hex data",L"Error",MB_OK);
return;
}
decoded[i] = GetCode(data,2);
}
//sending data to device
cendp->ReqCode = 0xA0;
cendp->Index = 0;
cendp->Value = offset;
LONG length = len;
cendp->Write(decoded,length);
//DoControlTransfer(decoded,len,offset);
ReadFile(hex,code,4,&nbr,0);
if(nbr!=4)
{
MessageBox(0,L"Failed to read checksum",L"Error",MB_OK);
return;
}
}
//reset and run
Reset(false);
}