i just want to build a HID device with STM32f103,and start with most new USB lib:STM32_USB-FS-Device_Lib_V4.1.0;
after carefully reading the demo code of usb_pwr.c, i think one line in below funciton is not correct,as i marked below;
#if !defined (USE_NUCLEO)
/*** cable plugged-in ? ***/
/*** CNTR_PWDN = 0 ***/
wRegVal = CNTR_FRES;
/* The following sequence is recommended:
1- FRES = 0
2- Wait until RESET flag = 1 (polling)
3- clear ISTR register */
/*** CNTR_FRES = 0 ***/
wInterrupt_Mask = 0;
/* Wait until RESET flag = 1 (polling) */
while((_GetISTR()&ISTR_RESET) == 1);//-->change to while((_GetISTR()&ISTR_RESET) == 0); ??
/*** Clear pending interrupts ***/
/*** Set interrupt mask ***/
wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
in fact i am still not sure if i was right,since the lib must have pass the test;
Please kindly give your advice,if i need to correct it as i marked.
Thanks in advance!