UART3 not working

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART3 not working

510件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kevin on Thu Mar 07 07:56:25 MST 2013
I'm trying to make the program receives a bit through the serial communication computer however does not receive anything.

the code I'm trying is this





===============================================================================
Name        : main.c
Author      :
Version     :
Copyright   : Copyright (C)
Description : main definition
===============================================================================
*/
#ifdef __USE_CMSIS
#include "LPC43xx.h"
#endif

#include <cr_section_macros.h>
#include <NXP/crp.h>

__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

// TODO: insert other include files here
#include"lpc43xx_uart.h"
#include"lpc43xx_cgu.h"
#include"lpc43xx_scu.h"
#include"lpc43xx_OLED.h"

// TODO: insert other definitions and declarations here

uint8_t teste_enviar[] = "Teste UART \n\r";
uint8_t teste_receber[10];


int main(void)
{
int delay;
int cont;

int teste;
int teste2 = 0;

UART_CFG_Type config_uart;

UART_FIFO_CFG_Type UARTFIFOConfigStruct;

config_uart.Baud_rate = 9600;
config_uart.Parity = UART_PARITY_NONE;
config_uart.Databits = UART_DATABIT_8;
config_uart.Stopbits = UART_STOPBIT_1;
config_uart.Clock_Speed = 0;

//-------------------------------------------------------------------------
// Clock Initialize/Config8
//-------------------------------------------------------------------------
SystemInit();
CGU_Init();

CGU_ConfigPWR (CGU_PERIPHERAL_UART3,  ENABLE);
CGU_GetPCLKFrequency (CGU_PERIPHERAL_UART3);
CGU_UpdateClock();


lcd_init();
lcd_clear();
//-------------------------------------------------------------------------
// UART Config and Initialize
//-------------------------------------------------------------------------
scu_pinmux(4, 1, MD_PLN, FUNC6);// TX
scu_pinmux(4, 2, MD_PLN, FUNC6);// RX

UART_Init(LPC_USART3, &config_uart);

UART_FIFOConfigStructInit(&UARTFIFOConfigStruct);

UART_TxCmd(LPC_USART3, ENABLE);


   /* Enable UART Rx interrupt */
    UART_IntConfig(LPC_USART3, UART_INTCFG_RBR, ENABLE);



set_cursor(5,0);
lcd_print(" Test UART 3");

teste = 0x20;
while(1)
{
UART_Receive(LPC_USART3, &teste_receber, 1,NONE_BLOCKING);
UART_Send(LPC_USART3, &teste_receber, 1,NONE_BLOCKING);


UART_SendByte(LPC_USART3, teste);
set_cursor(0,1);
lcd_putchar(teste);
teste= teste+1;

for(delay=0;delay<=3000000;delay++);
}
}
0 件の賞賛
返信
0 返答(返信)