Exemple #1
0
int main()
{
    uint32_t i;
  

    /*System clock configuration*/
	SystemInit();
//    *(volatile uint32_t *)(0x41001014) = 0x0060100; //clock setting 48MHz
    
    /* CLK OUT Set */
//    PAD_AFConfig(PAD_PA,GPIO_Pin_2, PAD_AF2); // PAD Config - CLKOUT used 3nd Function

    /*using debugging*/
    S_UART_Init(115200);
    /* UART0 and UART1 configuration*/
    UART_StructInit(&UART_InitStructure);
    /* Configure UART0 */
    UART_Init(UART0,&UART_InitStructure);
    /* Configure UART1 */
    UART_Init(UART1,&UART_InitStructure);
    /* Configure Uart0 Interrupt Enable*/
    UART_ITConfig(UART0, (UART_IT_FLAG_TXI|UART_IT_FLAG_RXI),ENABLE);
    /* NVIC configuration */
    NVIC_ClearPendingIRQ(UART0_IRQn);
    NVIC_EnableIRQ(UART0_IRQn);
    /* Configure Uart1 Interrupt Enable*/
    UART_ITConfig(UART1,(UART_IT_FLAG_TXI|UART_IT_FLAG_RXI),ENABLE);
     /* NVIC configuration */
    NVIC_ClearPendingIRQ(UART1_IRQn);
    NVIC_EnableIRQ(UART1_IRQn);
    /*send the data from UART0 to UART1*/    
    printf("Send UART0\r\n");
    for(i=0;i<409600;i++)
    {
        UartPutc(UART0,(uint8_t)i);
    }
    /*send the data from UART1 to UART0*/    
    printf("Send UART1\r\n");
    for(i=0;i<409600;i++)
    {
        UartPutc(UART1,(uint8_t)i);
    }
    /*confirm the rx/tx data counter of Uart0,1 using Uart2*/    
    printf("Press Any Key\r\n");
    while( S_UartGetc() != 0 )
    {
        printf("uart0_rx_cnt = %d, uart0_tx_cnt = %d\r\n",uart0_rx_cnt, uart0_tx_cnt);
        printf("uart1_rx_cnt = %d, uart1_tx_cnt = %d\r\n",uart1_rx_cnt, uart1_tx_cnt);
    }
  
}
Exemple #2
0
int main()
{
    uint32_t i;
  

    /*System clock configuration*/
	SystemInit();
    /*using debugging*/
    S_UART_Init(115200);
    /* UART0 and UART1 configuration*/
    UART_StructInit(&UART_InitStructure);
    /* Configure UART0 */
    UART_Init(UART0,&UART_InitStructure);
    /* Configure UART1 */
    UART_Init(UART1,&UART_InitStructure);
    /* Configure Uart0 Interrupt Enable*/
    UART_ITConfig(UART0, (UART_IT_FLAG_TXI|UART_IT_FLAG_RXI),ENABLE);
    /* NVIC configuration */
    NVIC_ClearPendingIRQ(UART0_IRQn);
    NVIC_EnableIRQ(UART0_IRQn);
    /* Configure Uart1 Interrupt Enable*/
    UART_ITConfig(UART1,(UART_IT_FLAG_TXI|UART_IT_FLAG_RXI),ENABLE);
     /* NVIC configuration */
    NVIC_ClearPendingIRQ(UART1_IRQn);
    NVIC_EnableIRQ(UART1_IRQn);
    /*send the data from UART0 to UART1*/    
    printf("Send UART0\r\n");
    for(i=0;i<409600;i++)
    {
        UartPutc(UART0,(uint8_t)i);
    }
    /*send the data from UART1 to UART0*/    
    printf("Send UART1\r\n");
    for(i=0;i<409600;i++)
    {
        UartPutc(UART1,(uint8_t)i);
    }
    /*confirm the rx/tx data counter of Uart0,1 using Uart2*/    
    printf("Press Any Key\r\n");
    while( S_UartGetc() != 0 )
    {
        printf("uart0_rx_cnt = %d, uart0_tx_cnt = %d\r\n",uart0_rx_cnt, uart0_tx_cnt);
        printf("uart1_rx_cnt = %d, uart1_tx_cnt = %d\r\n",uart1_rx_cnt, uart1_tx_cnt);
    }
  
}