AnsweredAssumed Answered

UART Junk with TWR-k53n512

Question asked by smaschy on Nov 17, 2016
Latest reply on Feb 2, 2017 by smaschy

Hey Guys,

I'm trying to develop an UART Connection with the TWR-k53n512 TowerSystem. I use the Pins A41 and A42 from the Expansion Port for the UART 4.

 

My Code i use:

#include <stdio.h>
#include "derivative.h"

#include "io.h"
#include "uart.h"
#include "mcg.h"


int main(void)
{
     SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;
     PORTC_PCR14 = PORT_PCR_MUX(0x03);
     PORTC_PCR15 = PORT_PCR_MUX(0x03);

     uart_init(TERM_PORT, 50000, 115200);

     uart_putchar(TERM_PORT, '0');
     printf("0");

     uart_putchar(TERM_PORT, '1');
     printf("1");


     for(;;) {
     }

     return 0;
}

 

Now my Problem, i just receive junk in my terminal.

Line 17 and 18 gave me: "00 F0" and "00F0".

Line 20 and 21 gave me: "0E 3E FE" and "0E 3E FE".

 

So has anyone a clue for me? 

 

 

EDIT:

OK, it works!?

uart_init(TERM_PORT, 50000, 300);

When I change the baud rate in the code to 300 and the baud rate in my terminal to 600 it works. I receive the right data. It seems that I don't understand the baud rate or  the code correctly.

Outcomes