AnsweredAssumed Answered

FRDM-KE06Z UART0 code is not working

Question asked by Lajitha CS on Jul 28, 2017
Latest reply on Jul 31, 2017 by Kerry Zhou

Kindly help me in testing UART0 of FRDM-KE06Z in transmitting a character. When the code is run no signal is coming out of UART0 transmit pin. code is attached. 

main.c

int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
uint8_t data;
uint8_t tx_array[]={0x06,0x02,0x03,0x04,0x05};
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Initialization of SS1 component */
// Error = SS1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */

 

UART0_Init();
//SPI0_mstrInit();
for(;;)
{

 

 

UART_tx(0x55);

 

}

 

uart.c

 

void UART0_Init()
{

SIM_PINSEL0 |= SIM_PINSEL_UART0PS_MASK; //uart0 pin select
SIM_SCGC |= SIM_SCGC_UART0_MASK ; //Bus clock to the UART0 module is enabled
UART0_BDH =0x00;
UART0_BDL =0x4E; //Baud rate reg. value SBR[12:0]=0x004E 
//UART0_C1 =UART_C1_LOOPS_MASK|UART_C1_RSRC_MASK ; // Loop back enabled and single wire uart mode

UART0_C2 |=UART_C2_TE_MASK ; //Tx enabled

}

void UART_tx(uint8_t value)

{


// while (!(UART0_S1 & UART_S1_TDRE_MASK));
while ((UART0_S1 & UART_S1_TDRE_MASK) == 0);// wait if tx buf is full

 

UART0_D = value;

}

Outcomes