This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Wrong character received from UART?

I am new to Cortex M4 programming I am using teensy 3.2 board .I have connected it to PC using USB to TTL cable.I have written a code to transmit a character from Teensy UART to PC .I am using Dockight as terminal. The baudrate is 9600 for a 72MHZ system clock with 8 data bits ,1 start bit,1 stop bit and no parity bit. I have disabled interrupts and DMA Here is my code

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "MK20D7.h"
void UARTPutChar(char);
int main()
{
SIM->SCGC4=1UL<<10; //Clock Enable Uart0
SIM->SCGC5 =1UL<<12;//Enable GPIO PORT D clock
UART0->C2=0X00; //Disable UART Tx
PORTD->PCR[7]= 0x00000300; //Port pin declare as UART0TX
UART0->BDH=0x01; //9600 baudrate 72MHz system clock
UART0->BDL=0xEC;
UART0->C1=0X00;
UART0->C3=0X00;
UART0->S2=0X00;
UART0->S1=0X00;
UART0->C2=0X08; //Enable UART0 Tx
while(1)
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I have configured Docklight settings correctly but i dont receive the character i transmit Here is what i get

Whereas I should receive Ascii of 'A'.I have my self let the Transmit Empty Flag unused for checking. When i used S1 status flag,nothing is transmitted to PC.

0