ATXMEGA64A3U UART E0 and E1 config and testing

General discussion on mikroC PRO for AVR.
Post Reply
Author
Message
TLoser
Posts: 3
Joined: 20 Nov 2015 08:41

ATXMEGA64A3U UART E0 and E1 config and testing

#1 Post by TLoser » 20 Nov 2015 09:01

I have a problem using the two Uart com ports E0 and E1. I can configure either one at a time and TX info and there is no problem. When I configure both E0 and E1 then only the second one configured works! i.e. below it is E1 if I swap the config around then only E0 works? I have tried simple config using UARTE#_Init(9600); i.e. //8,n,1 for both but still the same thing happens. I cant transmit on both ports!!! No interrupts are configured!

// UARTE0 9600,7,e,2 - PC USB
UARTE0_Init(9600);
// even parity
PMODE0_USARTE0_CTRLC_BIT := 0;
PMODE1_USARTE0_CTRLC_BIT := 1;
// 2 stop bit
SBMODE_USARTE0_CTRLC_BIT := 1;
// 7 bit
CHSIZE0_USARTE0_CTRLC_BIT := 0;
CHSIZE1_USARTE0_CTRLC_BIT := 1;
CHSIZE2_USARTE0_CTRLC_BIT := 0;
// Asynchronous mode
CMODE0_USARTE0_CTRLC_BIT := 0;
CMODE1_USARTE0_CTRLC_BIT := 0;

// UARTE1 9600,8,n,1 - Xport
UARTE1_Init(9600);
// No parity
PMODE0_USARTE1_CTRLC_BIT := 0;
PMODE1_USARTE1_CTRLC_BIT := 0;
// 1 stop bit
SBMODE_USARTE1_CTRLC_BIT := 0;
// 7 bit
CHSIZE0_USARTE1_CTRLC_BIT := 1;
CHSIZE1_USARTE1_CTRLC_BIT := 1;
CHSIZE2_USARTE1_CTRLC_BIT := 0;
// Asynchronous mode
CMODE0_USARTE1_CTRLC_BIT := 0;
CMODE1_USARTE1_CTRLC_BIT := 0;


Delay_ms(100); // Wait for UART module to stabilize
UARTE0_Write('U'); // usb
UARTE1_Write('X'); // XPort

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: ATXMEGA64A3U UART E0 and E1 config and testing

#2 Post by filip » 27 Nov 2015 09:03

Hi,

Try using UART_Set_Active routine :

Code: Select all

UARTE0_Init(9600
UARTE1_Init(9600

UART_Set_Active(&UARTE0_Read, &UARTE0_Write, &UARTE0_Data_Ready, &UARTE0_Tx_Idle); // set UARTE0 active
UARTE0_Write('U'); // usb

UART_Set_Active(&UARTE1_Read, &UARTE1_Write, &UARTE1_Data_Ready, &UARTE1_Tx_Idle); // set UARTE1 active
UARTE1_Write('X'); // XPort
Regards,
Filip.

Post Reply

Return to “mikroC PRO for AVR General”