Serial data stored in USART and visualized on Tera term

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

void sendChar(char c)
{
  while (!(USARTC0_STATUS & USART_DREIF_bm ));
  USARTC0_DATA=c;
}

void init_usart(void)
{
 PORTC_DIR |=0X08;
 USARTC0_BAUDCTRLA=0XA0;//Baud 115200 SET34 0; BSEL=fPER/(2^BSCALE*16fBAUD)-1 BSCALE=-1;
 USARTC0_BAUDCTRLB=0X1;
 USARTC0_CTRLC|=USART_CHSIZE1_bm|USART_CHSIZE0_bm;
 USARTC0_CTRLB|=USART_CLK2X_bm|USART_RXEN_bm|USART_TXEN_bm;
}

Before changing USARTE0 into USARTC0, the serial data can be demonstrated on tera term, however it start showing nothing after I tried to stored it in USARTC0. Can anyone tell me how does it matter changing the data register?

And also, is there a reason that I couldn't find PE2 and PE3 on Xmega128 a1U?

 

 

Moved to Xmega - JGM

Last Edited: Thu. Aug 24, 2017 - 08:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This does not fit "tutorials". It really belongs in the xmega forum.

 

To Wenyu - is USARTC0 connected to the physical serial port that you are monitoring with TeraTerm? I don't know xmega very well and whether or not the pins used for USARDE0 can be remapped to USARTE0. I don't see anything that looks like remapping, to me. So, the question: are you monitoring the correct physical xmega serial port pins?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm...  I can't imagine how you chose the Tutorials forum to post your query.  Perhaps a @Moderator can move this to the XMEGA forum..?

 

And also, is there a reason that I couldn't find PE2 and PE3 on Xmega128 a1U?

I am sure there is.  How did you try to "find" them?

 

 Can anyone tell me how does it matter changing the data register?

How are you connecting USARTC0 to TeraTerm?  If you are, for example, using an XMEGA-A1U Xplained, USARTE0 Tx/Rx are connected to the EDBG to create the COM/CDC channel.  Moving from USARTE0 to USARTC0 will require a Serial-to-USB adapter in this situation, connected to USARTC0.

 

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry about the "fit". Honestly it is a bit hard for me to find a "post" button in this forum or tutorial. It's not user friendly to new people at least for me.

I'm not sure about the physical serial port. I can't tell; All I did is just a simple connection between the Xmega and my PC. I guess USARTC0 is not connected to tera term physically while USARTE0 is, because I just try to use a bluetooth to transmit the serial data from USARTC0 and received by my PC. It was a success. That should tell me I did stored the data to USARTC0 successfully. 

Wenyu

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Greg,

I apologize for posting all this on the Tutorial forum. I did't quite know how to post on the forums.

I tried to find the physical pins for PE2 and PE3 and plug in to my blue tooth, but I see no such labels as PE2 or PE3 on the Xmega, as well as some other pins. It is helpful for me to understand the way it work as you mentioned about a Serial -to-USB adapter to move from USARTE0 to USARTC0.

Thanks,

Wenyu

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is helpful for me to understand the way it work as you mentioned about a Serial -to-USB adapter to move from USARTE0 to USARTC0.

Assuming you are using an XMEGA-A1U Xplained, USARTC0 Tx/Rx appear on connector EXT1, pins 13 and 14.  You would need to connect an FTDI or other serial-to-USB adapter to these two pins (and GND).  If you are using a different board, which one are you using?

 

 

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW, you should the the <> button to add code:

 

void sendChar(char c)
{
    while (!(USARTC0_STATUS & USART_DREIF_bm ));
    USARTC0_DATA = c;
}
void init_usart(void)
{
    PORTC_DIR |= 0X08;
    USARTC0_BAUDCTRLA = 0XA0;
    USARTC0_BAUDCTRLB = 0X1;
    USARTC0_CTRLC |= USART_CHSIZE1_bm | USART_CHSIZE0_bm;
    USARTC0_CTRLB |= USART_CLK2X_bm | USART_RXEN_bm | USART_TXEN_bm;
}

 

EDIT: code

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

Last Edited: Thu. Aug 24, 2017 - 08:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using an XMEGA128A1U Xplained Pro. It was pretty easy to find USARTC0 Tx/Rx based on the data sheet. However, the problem is finding USARTE0 Tx/Rx, they should be PE2 and PE3 which does not physically exist on the board. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PE2 and PE3 are connected to the AT32UC3A4256 on board for the "EDBG_CDC_UART" function. They are not brought out to an external connector...

David (aka frog_jr)

Last Edited: Thu. Aug 24, 2017 - 08:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Exactly the answer I'm expecting. Thanks.