Jump to content

    
Sign in to follow this  
V_M_Luck

STM32 USB FS OTG

Recommended Posts

Да ладно. Вот лог. Тут я пару раз вставил вытащил кабель. А в конце отключил в диспетчере устройств с воткнутым кабелем.

Спойлер

Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 27
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 28
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 29
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 30
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND

 

 

Share this post


Link to post
Share on other sites
13 hours ago, VladislavS said:

Да ладно. Вот лог. Тут я пару раз вставил вытащил кабель. А в конце отключил в диспетчере устройств с воткнутым кабелем.

  Reveal hidden contents


Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 27
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 28
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 29
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND
Int_WKUP
Int_USBRST
GET_Device_Descriptor 64 bytes
Int_USBRST
SET_ADDRESS 30
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 255 bytes
GET_String_Serial 255 bytes
GET_String_LangID 255 bytes
GET_String_Product 255 bytes
GET_Device_qualifier_Descriptor 10 bytes
GET_Device_Descriptor 18 bytes
GET_Configuration_Descriptor 9 bytes
GET_Configuration_Descriptor 67 bytes
GET_Configuration_Descriptor 265 bytes
SET_CONFIGURATION 1
GET_LINE_CODING
SET_CONTROL_LINE_STATE
SET_LINE_CODING
SET_LINE_CODING DATA
GET_LINE_CODING
Int_SUSPEND

 

 

 И где там resume? может WKUP ?

void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
{
  /* USER CODE BEGIN 3 */
  /* USER CODE END 3 */
  USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData);
  
}

Ставлю в этой функции точку прерыванию и она здесь не останавливается при подключении отключении USB. Зато в этой функции

void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{  
   /* Inform USB library that core enters in suspend Mode */
  USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData);
  __HAL_PCD_GATE_PHYCLOCK(hpcd);
  /*Enter in STOP mode */
  /* USER CODE BEGIN 2 */
	usb_connect = 0 ; //
  if (hpcd->Init.low_power_enable)
  {
    /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
    SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
  }
  /* USER CODE END 2 */
}

останавливается два раза как при подключении так и при отключении. А определить подключение это или отключение невозможно.

Edited by retro55

Share this post


Link to post
Share on other sites

 

5 часов назад, retro55 сказал:

определить подключение это или отключение невозможно.

Подключение проще всего по Reset определять.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this