2013-02-26 01:10 AM
Hi
I want to show the output(i.e. sended data) on tera term terminal. How to setup tera term for that.(I am using UART for serial communication in which i am sending data from one port and receiving from other one.) Please reply me asap.2013-02-27 12:42 PM
To which COM port is it attached? Say COM3, then you'll need to configure Tera Term to COM3 115200 Baud, 8 Bit, No Parity, 1 Stop.
The STM32 will not interface directly to RS232 ports, it uses 3V CMOS levels, and will either need a CMOS Serial to USB type adapter, or a MAX232 type converter. If you are new to all this stuff, I will again, recommend you get a board that has the interfaces on you require, learn how to use that, and then progress to more complicated chip level interfacing. Jumping in the deep end of the pool, and not being able to swim, will likely get you drowned.2013-02-27 09:13 PM
Thanks for your reply.Should I implement UART on STM32F10XX eval board.? It has connected UART on board. Please give me your suggestion.
2013-02-28 01:11 AM
I have written and run this following code on IAR for STM32F10X. It compiled but i am not able to see that the data i am sending is written to data register of uart or not. I even debug and download the code on stm32f10xx eval board , set breakpoint etc.
/* Code for sending data through UART(evaluation board STM32F10x)#include<stdio.h>#include ''stm32f10x.h''#include ''stm32f10x_rcc.h''#include ''stm32f10x_gpio.h''#include ''stm32f10x_usart.h''void outstring(char *s){ while(*s) { /* Loop until transmit data register is empty */ while (USART_GetFlagStatus(UART4, USART_FLAG_TXE) == RESET); USART_SendData(UART4, (uint8_t)*s++); printf(''%u'',UART4->DR); }} int main(void){ USART_InitTypeDef USART_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; /* Disable the serial controller interface */ USART_Cmd(UART4, DISABLE); /* Configure (PC10) UART4 Tx as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Set pull-up on UART Tx pin */ GPIO_SetBits(GPIOC, GPIO_Pin_10); /* Configure (PC11) UART4 Rx as input with pull-up */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Set pull-up on UART Rx pin */ GPIO_SetBits(GPIOC, GPIO_Pin_11); /* UARTx configured as follow: - BaudRate = 9600 baud - Word Length = 8 Bits - One Stop Bit - No parity - Hardware flow control disabled (RTS and CTS signals) */ 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; /* UART configuration: Set up the parameters specific for the UART operating mode */ USART_Init(UART4, &USART_InitStructure); /* Enable the UART peripheral */ USART_Cmd(UART4, ENABLE); while(1) outstring(''Welcome to wherever you are!\r\n'');}2013-02-28 03:59 AM
Needs some clock initialization on the F1
#include <
stdio.h
>
#include ''stm32f10x.h''
#include ''stm32f10x_rcc.h''
#include ''stm32f10x_gpio.h''
#include ''stm32f10x_usart.h''
void outstring(char *s)
{
while(*s)
{
/* Loop until transmit data register is empty */
while (USART_GetFlagStatus(UART4, USART_FLAG_TXE) == RESET);
USART_SendData(UART4, (uint8_t)*s++);
}
}
int main(void)
{
USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); /* Enable GPIOC */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4, ENABLE); /* Enable UART4 */
/* Configure (PC10) UART4 Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Configure (PC11) UART4 Rx as input with pull-up */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* UARTx configured as follow:
- BaudRate = 9600 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
*/
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;
/* UART configuration: Set up the parameters specific for the UART operating mode */
USART_Init(UART4, &USART_InitStructure);
/* Enable the UART peripheral */
USART_Cmd(UART4, ENABLE);
while(1)
outstring(''Welcome to wherever you are!
'');
}
2013-02-28 06:36 AM
Thanks for reply. I have donr the same thing but I am not able to read the data register contents . I put printf statement as ''printf(''%u'',UART->DR);'' and debug but I am getting 0 on I/o terminal. please tell me how to get the exact sended data.
2013-02-28 06:46 AM
Reading DR would show receiveded data not sended data
2013-02-28 07:00 AM
Then How I able to see the sended data? please reply me
2013-02-28 10:26 AM
Once you have sent data it enter internal registers you cannot see. The output will be sent to your terminal (Tera Term, Real Term, whatever), if you have it wired and set up correctly.
Data sent from the terminal will be received by the STM32, you can observe reception by examining the RXNE bit of the status register (SR), and then reading the data register (DR) in response. If the STM32 doesn't receive any data you will need to examine the connectivity.2013-02-28 06:57 PM
Thanks for reply. I have TeraTerm. When I connected my eval board by usb it selected in the catagory of disk drives. Please tell me how to make wire connectivity so that i can see the sended data on the terminal.
2013-03-01 04:03 AM
Awesome, use a serial cable and attach it to the DB9 on your non-specific ST32F1xx board, not USB.