极海APM32M3514串口使用PF0和PF1问题
[复制链接]
各位高手及极海的FAE,我在使用极海的APM32M3514串口时遇到如下问题,
我使用的板子根据硬件电路将串口的引脚改为PF0和PF1的串口时,开启中串口中断,代码跑飞,引脚配置如下:
在初始化代码中,只要把串口1中断打开,程序跑飞,使用的是COM1 初始化如下:
void APM_MINI_COMInit(COM_T COM)
{
GPIO_Config_T gpioConfig;
USART_Config_T usartConfigStruct;
/* Enable GPIO clock */
RCM_EnableAHBPeriphClock(COM_TX_PORT_CLK[COM] | COM_RX_PORT_CLK[COM]);
/* Enable COM1 or COM2 clock */
if (COM == COM1)
{
RCM_EnableAPB2PeriphClock(COM_USART_CLK[COM]);
}
else
{
RCM_EnableAPB1PeriphClock(COM_USART_CLK[COM]);
}
/* Connect PXx to USARTx_Tx */
GPIO_ConfigPinAF(COM_TX_PORT[COM], COM_TX_PIN_SOURCE[COM], COM_TX_AF[COM]);
/* Connect PXx to USARTx_Rx */
GPIO_ConfigPinAF(COM_RX_PORT[COM], COM_RX_PIN_SOURCE[COM], COM_RX_AF[COM]);
/* Configure USART Tx as alternate function push-pull */
gpioConfig.mode = GPIO_MODE_AF;
gpioConfig.pin = COM_TX_PIN[COM];
gpioConfig.speed = GPIO_SPEED_50MHz;
gpioConfig.outtype = GPIO_OUT_TYPE_PP;
gpioConfig.pupd = GPIO_PUPD_PU;
GPIO_Config(COM_TX_PORT[COM], &gpioConfig);
/* Configure USART Rx as input floating */
gpioConfig.pin = COM_RX_PIN[COM];
GPIO_Config(COM_RX_PORT[COM], &gpioConfig);
/* MINI_USARTs configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
usartConfigStruct.baudRate = 115200;
usartConfigStruct.mode = USART_MODE_TX_RX;
usartConfigStruct.hardwareFlowCtrl = USART_FLOW_CTRL_NONE;
usartConfigStruct.parity = USART_PARITY_NONE;
usartConfigStruct.stopBits = USART_STOP_BIT_1;
usartConfigStruct.wordLength = USART_WORD_LEN_8B;
USART_Config(COM_USART[COM], &usartConfigStruct);
/* Enable USART_Interrupt_RXBNEIE */
USART_EnableInterrupt(COM_USART[COM], USART_INT_RXBNEIE);
if (COM_USART[COM] == USART1)
{
NVIC_EnableIRQRequest(USART1_IRQn, 2);
}
else if (COM_USART[COM] == USART2)
{
NVIC_EnableIRQRequest(USART2_IRQn, 3);
}
/* Enable USART */
// USART_Enable(USART1);
USART_Enable(COM_USART[COM]);
}
出错时调试报错如下:
请问一下谁知道这是什么原因
|