Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

User7457
Level 2
First like received
Level 2
Hi,
I'm trying Uart communication into xmc4500. As I'm porting firmware from another microcontroller I'm trying to configure the Uart without FIFO and without DMA.
So I used the Uart001 app from DAVE changing some register settings as follow in order to use UART the "normal way" ie rx interrupt on each received char:

// enable shift buffer empty interrupt
WR_REG(USIC0_CH0->CCR, USIC_CH_CCR_TSIEN_Msk, USIC_CH_CCR_TSIEN_Pos,1);

// shift buffer empty interrupt on SR0
WR_REG(USIC0_CH0->INPR, USIC_CH_INPR_TSINP_Msk, USIC_CH_INPR_TSINP_Pos,0);

//Receive event event is enabled.
WR_REG(USIC0_CH0->CCR, USIC_CH_CCR_RIEN_Msk, USIC_CH_CCR_RIEN_Pos,1);

//Alternative receive event event is enabled.
WR_REG(USIC0_CH0->CCR, USIC_CH_CCR_AIEN_Msk, USIC_CH_CCR_AIEN_Pos,1);

//Interrupt node 1 is selected for Receive event
WR_REG(USIC0_CH0->INPR, USIC_CH_INPR_RINP_Msk, USIC_CH_INPR_RINP_Pos,1);

//Interrupt node 1 is selected for Alternative receive event
WR_REG(USIC0_CH0->INPR, USIC_CH_INPR_AINP_Msk, USIC_CH_INPR_AINP_Pos,1);

Uart settings are 57600 8 N 1 ( Uart_Conf settings taken from DAVE)
I have no other peripheral active.
The problem is that inside rx interrupt, sometimes I get a wrong character. I mean, I'm sending a repetitive pattern of 6 chars from PC ( +++AT[CR] ) every 100ms. After some good receptions ( random number ) where all characters are received well, a wrong vharacter is received. I monitored the situation through oscilloscope: incoming chars are good. From xmc tx line I see that if I transmit something the timings are correct.
Inside interrupt I read received chars as follow:

if(UART001_GetFlagStatus(&UART001_Handle0_CH0,UART001_RECV_IND_FLAG) == UART001_SET)
{
ch = UART001_Handle0_CH0.UartRegs->RBUF;
if( ( ch == (short)'+' ) || ( ch == (short)'A' ) || ( ch == (short)'T' ) || ( ch == 0x0d ) ) {
UART001_Handle0_CH0.UartRegs->TBUF[0] = ch;
P5_1_toggle();
}

UART001_ClearFlag(&UART001_Handle0_CH0,UART001_FIFO_STD_RECV_BUF_FLAG);


}
}

Does anybody has any idea why sometimes I get a wrong char? Am I missing something?

Thanks.
Frank
2 Replies
User7457
Level 2
First like received
Level 2
Hi again,
it seems to me that the problem disappears if I remove the echo from the rx interrupt:
UART001_Handle0_CH0.UartRegs->TBUF[0] = ch;

Can a single channel of a Usic module be used in full duplex mode? Or have I tu use two different channels if I want full duplex?

Thanks
Frank
0 Likes
user8710
Level 3
5 questions asked 50 sign-ins 10 replies posted
Level 3

9 years later and no one answer this guy....

0 Likes