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

#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)    
  {   
            
       UARTPutChar('A');
   
  }

}

void UARTPutChar(char ch)
{
    //if(UART0->S1  == 0X40)
    //{
        
        UART0->D=ch;
    //}
}

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.

Parents Reply Children
No data
More questions in this forum