你的浏览器版本过低,可能导致网站不能正常访问!为了你能正常使用网站功能,请使用这些浏览器。
harvardx 发表于 2018-3-18 22:43 , |+ U) c* S, E, t3 W# J }是经常拜读您文章的MilerShao吗
您好,我正在调试stm32f723开发板的USB模块,为什么开发板做全速主机时,寄存器PENA是1,但插入从机设备不会触发PCDET中断标志。怎样才能触发这个中断?
* Ãû ³Æ£ºUSART3_Configuration(void)) q s# l( P; T2 j( o, u! O! R/ X
* ¹¦ ÄÜ£ºÅäÖô®¿Ú
* Èë¿Ú²ÎÊý£º
* ³ö¿Ú²ÎÊý£ºÎÞ
* ˵ Ã÷£º
* µ÷Ó÷½·¨£ºÀýÈç: USART3_Configuration()+ V8 A( z- E5 j/ x/ y2 a
****************************************************************************/
void USART3_Configuration(void)//´®¿Ú3³õʼ»¯º¯Êý
{ * x. y v3 {. j- G+ I* }
//NVIC_InitTypeDef NVIC_InitStructure;1 x3 r- v4 A! ^* W
GPIO_InitTypeDef GPIO_InitStructure3; + _' Y' ]# J0 o3 D; y
/* Enable GPIO TX/RX clock */9 u: ~6 I5 _) E0 q9 |
__HAL_RCC_GPIOC_CLK_ENABLE();
/* Enable USART3 clock */
__HAL_RCC_USART3_CLK_ENABLE();
/*8 ~: L* e) r2 ~( L o! m; |5 z- Z6 p
* USART3_TX -> PC4 , USART3_RX -> PC5
*/
GPIO_InitStructure3.Pin = GPIO_Pin_4|GPIO_Pin_5;
GPIO_InitStructure3.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure3.Pull = GPIO_NOPULL;
GPIO_InitStructure3.Alternate = GPIO_AF_1;- X% @9 I h6 t/ X
GPIO_InitStructure3.Speed = GPIO_SPEED_FREQ_HIGH; 7 j( b2 r2 C1 E) E! \( X
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure3); 4 _! Z7 b# ]' J
/** ) [- b7 y& q6 x9 i- T9 n( Q6 U
* @brief UART Initialization
*/ I/ j$ v* f. S* L. l& A
UartHandle3.Instance = USART3;6 @/ o: `8 I$ t6 G
UartHandle3.Init.BaudRate = 115200;
UartHandle3.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle3.Init.StopBits = UART_STOPBITS_1;8 A7 g7 E' |( B8 S
UartHandle3.Init.Parity = UART_PARITY_NONE;, L3 \+ R$ O; F# C8 E5 h1 Y
UartHandle3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UartHandle3.Init.Mode = UART_MODE_TX_RX;2 _7 [5 I; B2 [8 h
UartHandle3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if(HAL_UART_DeInit(&UartHandle3) != HAL_OK)( M3 R7 l! y9 Y% |$ z
{- M9 O( Z6 y2 x D& C. Y/ l |
Usart1Error_Handler(); R! K5 H; K }* R9 `8 F g+ Z2 `( i7 f
}
if(HAL_UART_Init(&UartHandle3) != HAL_OK)
{1 X, l) F, m$ o5 D0 Z& T
Usart1Error_Handler();
}
/*##-3- Configure the NVIC for UART ########################################*/
/* NVIC for USART1 */ : F8 i) |! g/ T4 Y9 o7 D
//HAL_NVIC_SetPriority(USART3_4_IRQn, 3, 1);/ |' z/ N% q& }7 N! @, I) {
//HAL_NVIC_EnableIRQ(USART3_4_IRQn);
/* Enable USART1 Receive and Transmit interrupts */
__HAL_UART_ENABLE_IT(&UartHandle3,UART_IT_RXNE);. L* D$ M7 `! d. I- k$ w6 g, c
__HAL_UART_ENABLE_IT(&UartHandle3,UART_IT_IDLE); % J+ E4 i: b- v
/* Enable the USART1 */
__HAL_UART_ENABLE(&UartHandle3);//ʹÄÜ´®¿Ú1
} 8 A+ P3 H% k. g" C% g
# `+ o0 c6 \' ]' Y
支持2位大神
您好,我正在调试stm32f723开发板的USB模块,为什么开发板做全速主机时,寄存器PENA是1,但插入从机设备不会触发PCDET中断标志。怎样才能触发这个中断?