你的浏览器版本过低,可能导致网站不能正常访问!为了你能正常使用网站功能,请使用这些浏览器。
harvardx 发表于 2018-3-18 22:43, X$ |' V5 C! s. O8 j2 R K% @, k 是经常拜读您文章的MilerShao吗
您好,我正在调试stm32f723开发板的USB模块,为什么开发板做全速主机时,寄存器PENA是1,但插入从机设备不会触发PCDET中断标志。怎样才能触发这个中断?
* Ãû ³Æ£ºUSART3_Configuration(void)
* ¹¦ ÄÜ£ºÅäÖô®¿Ú% D- m7 y& W; u) s9 d7 C" H1 u
* Èë¿Ú²ÎÊý£º) Q7 k, e4 S! o& j0 q+ V' W# y
* ³ö¿Ú²ÎÊý£ºÎÞ0 ?/ B& B0 Z3 {6 g$ q- f6 F
* ˵ Ã÷£º
* µ÷Ó÷½·¨£ºÀýÈç: USART3_Configuration()# h; z* L' M2 v0 `: V4 d
****************************************************************************/+ ^2 v: n; X% C- U% F3 |% C& ]
void USART3_Configuration(void)//´®¿Ú3³õʼ»¯º¯Êý
{ 2 {: g. W2 @! K! b! |& \7 P6 ?2 Q
//NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure3;
/* Enable GPIO TX/RX clock */
__HAL_RCC_GPIOC_CLK_ENABLE(); P }9 ~3 k: @1 [1 W) E! ?
/* Enable USART3 clock */9 i" t; y! V) [ E& v
__HAL_RCC_USART3_CLK_ENABLE();
/*
* USART3_TX -> PC4 , USART3_RX -> PC5
*/ * `! ^ X+ \/ E2 q' K: F+ T
GPIO_InitStructure3.Pin = GPIO_Pin_4|GPIO_Pin_5;
GPIO_InitStructure3.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure3.Pull = GPIO_NOPULL;3 m% l/ n" @8 O& o7 d
GPIO_InitStructure3.Alternate = GPIO_AF_1;
GPIO_InitStructure3.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure3); \- r: k6 n; F; E5 t- M0 G, Q- `
/**
* @brief UART Initialization # F6 W! G8 |& k7 \
*/
UartHandle3.Instance = USART3;
UartHandle3.Init.BaudRate = 115200;
UartHandle3.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle3.Init.StopBits = UART_STOPBITS_1;
UartHandle3.Init.Parity = UART_PARITY_NONE;$ [8 h/ X6 l: l. J: p& j+ i' _
UartHandle3.Init.HwFlowCtl = UART_HWCONTROL_NONE;3 B F6 G' [: r" S7 z
UartHandle3.Init.Mode = UART_MODE_TX_RX;
UartHandle3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if(HAL_UART_DeInit(&UartHandle3) != HAL_OK)
{; i/ C" F, J/ V! t/ T1 h$ L
Usart1Error_Handler();
} * t2 V2 s& N D
if(HAL_UART_Init(&UartHandle3) != HAL_OK)
{
Usart1Error_Handler();" ]3 r B, G8 d8 D; L- m. q
}
/*##-3- Configure the NVIC for UART ########################################*/ ( z9 k2 n9 W' o: L8 Z4 E# I
/* NVIC for USART1 */
//HAL_NVIC_SetPriority(USART3_4_IRQn, 3, 1);$ k$ P& O( `/ x7 A' r! V- g+ q
//HAL_NVIC_EnableIRQ(USART3_4_IRQn);
/* Enable USART1 Receive and Transmit interrupts */* u! r% _: j; z7 ]# l6 m
__HAL_UART_ENABLE_IT(&UartHandle3,UART_IT_RXNE);
__HAL_UART_ENABLE_IT(&UartHandle3,UART_IT_IDLE);
/* Enable the USART1 */4 x& z9 B [4 [# V" {
__HAL_UART_ENABLE(&UartHandle3);//ʹÄÜ´®¿Ú1
}
支持2位大神
您好,我正在调试stm32f723开发板的USB模块,为什么开发板做全速主机时,寄存器PENA是1,但插入从机设备不会触发PCDET中断标志。怎样才能触发这个中断?