I am working on a custom board with k10mcu mk10dx256. IM trying to implement uart program with it.I have attached the program.I am getting a garbage value on my serial terminal.
heres my program:
#include <__cross_studio_io.h>
#include "MK10DZ10.h"
main(){
char data = 'a';
int i;
unsigned long int SBR_value=0;
char data1,ch;
//pin selection
SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK;
PORTD_PCR3 |= PORT_PCR_MUX(3);
PORTD_PCR2 |= PORT_PCR_MUX(3);
//uart selection
SIM_SCGC4 |= SIM_SCGC4_UART2_MASK;
UART2_C2 |= (1<<3)|(1<<2);
SBR_value = (int) ( (72*1000000)/ ( 16 * 9600) ) ;
UART2_BDH |= ( ( SBR_value >> 8 ) & 0x1F );
UART2_BDL = ( SBR_value & 0xFF );
while(1)
{
while( !(( UART2_S1 >> 7) & 0x01));
ch|= data;
UART2_D |=ch;
debug_printf("sending\n %s \n %d \n ",data,i#);}
}
i m getting interrupts but my data is not able to captured in receive program.