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
SIM->SCGC4=1UL<<10; //Clock Enable Uart0
SIM->SCGC5 =1UL<<12;//Enable GPIO PORT D clock
UART0->C2=0X00; //Disable UART Tx
PORTD->PCR= 0x00000300; //Port pin declare as UART0TX
UART0->BDH=0x01; //9600 baudrate 72MHz system clock
UART0->C2=0X08; //Enable UART0 Tx
void UARTPutChar(char ch)
//if(UART0->S1 == 0X40)
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.
blessed said:I am new to Cortex M4 programming
Do you have experience with programming any other microcontroller(s)? Do you have experience with programming in general?
"Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
Have you used an oscilloscope or analyser to see what the actual baud rate is?
Wrong baud rate is likely due to you not clocking at the speed you thought; check by blinking a LED to see if you get the speed you expected.
View all questions in Keil forum