USART3_4_IRQn undefined
Hi Forum,
I'm looking to implement USART3 on the stm32091, but get the following errorerror: #20: identifier ''USART3_4_IRQn'' is undefined.
when I compile at the following line. NVIC_InitStructure.NVIC_IRQChannel = USART3_4_IRQn;It looks like USART3_4_IRQn is defined in stm32f0xx.h as is USART3_8_IRQn.This was previously a stm32f051 project which had been ported across.
The following code is the configuration for USART3.Any help greatly appreciated.Bobvoid Usart3Init(void)
{USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
DMA_InitTypeDef DMA_InitStructure;
// Enable GPIOA and DMA clock
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB , ENABLE);
// Enable USART3 APB clock
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
// Connect pin to Periph
GPIO_PinAFConfig(GPIOB, GPIO_PinSource3, GPIO_AF_1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource4, GPIO_AF_1);
// Configure pins as AF pushpull
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 ; // CTS pin
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN ;
GPIO_Init(GPIOB, &GPIO_InitStructure); /// GPIO D
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 ; // RTS pin
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN ;
GPIO_Init(GPIOB, &GPIO_InitStructure);
// GPIO_WriteBit(GPIOA,GPIO_Pin_1, RESET);// LOW
// USARTx configured as follow:
//- BaudRate = 19200 baud
//- Word Length = 8 Bits
//- Stop Bit = 1 Stop Bit
//- Parity = No Parity
//- Hardware flow control disabled (RTS and CTS signals)
//- Receive and transmit enabled
// USART_DeInit(USART3);
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No; // USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_RTS_CTS;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
USART_Cmd(USART3, ENABLE);
// // Enable the COM2 Receive interrupt: this interrupt is generated when the // COM3 receive data register is not empty
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
// USART3 IRQ Channel configuration
NVIC_InitStructure.NVIC_IRQChannel = USART3_4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
