UART1 TX

IPQ
Posts: 6
Joined: Wed Apr 06, 2016 7:32 pm

UART1 TX

Postby IPQ » Tue Apr 12, 2016 2:32 pm

Hello,

I'm using RTOS 1.4 and I'm stuck trying to use UART1 for debugging purposes.

I added the uart driver provided with the SDK but I cannot see the function to make the UART1 work. This is the content of my user_init function:

void user_init(void)
{
uart_init_new();
UART_SetBaudrate(UART0,BIT_RATE_115200);
printf("\n\r\nSDK version: %s\n", system_get_sdk_version());
printf("Chip ID: 0x%x\n", system_get_chip_id());
}

Which is the instruction to send info through the UART1???...OS_PRINT???

Thanks in advance!

hualaonanxiaoniao
Posts: 11
Joined: Wed Apr 27, 2016 4:22 pm

Re: UART1 TX

Postby hualaonanxiaoniao » Wed Apr 27, 2016 4:29 pm

you should see the asscication documents,the name is sdk_programming_guide,in that can found how to make the uart1 as debug function
and that is my demo ,you can see it;
uart_init(BIT_RATE_115200, BIT_RATE_115200);
os_install_putc1((void *)uart1_write_char);//this is use uart1 for debug infomations.

jhinkle
Posts: 32
Joined: Tue Apr 19, 2016 12:09 am

Re: UART1 TX

Postby jhinkle » Thu Apr 28, 2016 12:44 am

I did not want to touch UART0 since my GDB stubb was using it.

This is how I implemented UART1

Code: Select all

   UART_ConfigTypeDef uart_config;
   uart_config.baud_rate = BIT_RATE_115200;
   uart_config.data_bits = UART_WordLength_8b;
   uart_config.parity = USART_Parity_None;
   uart_config.stop_bits = USART_StopBits_1;
   uart_config.flow_ctrl = USART_HardwareFlowControl_None;
   uart_config.UART_RxFlowThresh = 120;
   uart_config.UART_InverseMask = UART_None_Inverse;
   UART_ParamConfig(UART1, &uart_config);
   UART_SetPrintPort(UART1);


Hope that helps

Who is online

Users browsing this forum: No registered users and 14 guests