cancel
Showing results for 
Search instead for 
Did you mean: 

UART0 config problem

istvan
Associate II
Posted on March 17, 2013 at 15:21

Dear Colleagues,

My initialisation file is attached below. I have configuren 4 timer for PWM  and UART0 for communication.

The timers are working fine, but the UART does not give me any interrupt when 8 (or even more...) bytes come into the FIFO. Any idea what am I missing here?

I checked up everything else, it must be some initialisation mistake....

 SCU_MCLKSourceConfig(SCU_MCLK_OSC); /* Default configuration */

 

 FMI_Config(FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE,\

                 FMI_LVD_ENABLE, FMI_FREQ_HIGH);/*Insert 2 Wait States for read*/

                                               

 SCU_PLLFactorsConfig(192, 25, 2); /* PLL factors Configuration based on*/

                                        /* a OSC/Crystal value = 25Mhz*/    

 SCU_PLLCmd(ENABLE);  /* PLL Enable and wait for Locking*/    

 SCU_RCLKDivisorConfig(SCU_RCLK_Div1); /* RCLK @96Mhz */

 SCU_HCLKDivisorConfig(SCU_HCLK_Div1); /* AHB @96Mhz */

 SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1);/* FMI @96Mhz */

 SCU_PCLKDivisorConfig(SCU_PCLK_Div2); /* APB @48Mhz */

 SCU_MCLKSourceConfig(SCU_MCLK_PLL);  /* MCLK @96Mhz */

  

 SCU_AHBPeriphClockConfig(__VIC,ENABLE);   

 SCU_APBPeriphClockConfig(__GPIO6, ENABLE);

 SCU_APBPeriphClockConfig(__UART0, ENABLE);

 SCU_APBPeriphClockConfig(__TIM01, ENABLE);

 SCU_APBPeriphClockConfig(__TIM23, ENABLE);

 

_DeInit(UART0);

 UART_InitStructure.UART_WordLength = UART_WordLength_8D;

 UART_InitStructure.UART_StopBits = UART_StopBits_1;

 UART_InitStructure.UART_Parity = UART_Parity_No;

 UART_InitStructure.UART_BaudRate = 115200;

 UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;

 UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;

 UART_InitStructure.UART_FIFO = UART_FIFO_Enable;

 UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_7_8;  // TX...ha nagyon betellik...

 UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;  // 8 byte -os csomagokat fogok mindeg kuldeni

 UART_Init(UART0, &UART_InitStructure);

 

 UART_ITConfig(UART0, UART_IT_Receive , ENABLE);

 UART_Cmd(UART0, ENABLE);

 VIC_DeInit();

 VIC_InitDefaultVectors();

 VIC_Config(UART0_ITLine, VIC_IRQ, 0);

 VIC_ITCmd(UART0_ITLine, ENABLE);

#uart-init-problem-str912
1 REPLY 1
istvan
Associate II
Posted on March 17, 2013 at 16:37

I missed the RX pin number (didn't want spam that much so i left out the complete config part)....

Funny thing is that it took me 1 day to debug and I saw the issues immidiately as soon as I posted it here ;)