AnsweredAssumed Answered

STM32F4 USART receive problem

Question asked by MrStive on Oct 25, 2012
Latest reply on Apr 1, 2014 by Clive One
I'm having problems receiving USART data on the F4. I can see the data is being sent from my LCD on my Saleae logic analyser, but the STM32 won't call the USART RXNE interrupt. I can send data no problems, just not receive

Can anyone see a problem in my code?

void USART_Configuration(void){
// sort out clocks
        RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOD, ENABLE);
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
    NVIC_InitTypeDef NVIC_InitStructure; // this is used to configure the NVIC
    NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;        // we want to configure the USART3 interrupts
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;// this sets the priority group of the USART3 interrupts
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;       // this sets the subpriority inside the group
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;          // the USART3 interrupts are globally enabled
        // Configure LED USART3 Tx (PD8) as alternative function input floating
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
        GPIO_Init(GPIOD, &GPIO_InitStructure);
        // Map USART3 to D.08
        GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_USART3);       
        // Configure USART3 Rx (PD9) as input floating
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_Init(GPIOD, &GPIO_InitStructure);
         // Map USART3 to D.09      
        GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_USART3);
        // Initialize USART
    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_Mode = USART_Mode_Tx | USART_Mode_Rx;
    // Configure USART3
    USART_Init(USART3, &USART_InitStructure);
    // Enable the USART
    USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); // enable the USART1 receive not empty interrupt
void USART3_IRQHandler(void){
   (do something)

Thanks for your help in advance!