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;
}
Solved! Go to Solution.
Hi Lajitha CS,
Thank you for your root problem sharing.
If your problem is solved, please mark the correct answer to close this question, thank you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi
I don't see an error with the UART code.
As reference I have attached three firmware versions for the FRDM-KE06Z which you can load as reference to check the HW.
uTaskerV1.4.12_FRDM-KE06Z_UART1-115kB.bin - this uses the OpenSDA VCOM UART (PTC7 for Tx and PTC6 for Rx) connection to deliver a command line menu shell. After a reset there will be a message sent at 115200 Baud and later it will respond to inputs
uTaskerV1.4.12_FRDM-KE06Z_UART0-PTB-115kB.bin - same but using UART0 (instead of UART1) and the pins are multiplexed to PTB1 for Tx and PTB0 for Rx
uTaskerV1.4.12_FRDM-KE06Z_UART0-PTA-115kB.bin - same but using UART0 (instead of UART1) and the pins are multiplexed to PTA3 for Tx and PTA2 for Rx
I build these with the uTasker project using the defines
#define FRDM_KE06Z
#define DEMO_UART 1
,
#define FRDM_KE06Z
#define DEMO_UART 0
#define UART0_ON_A
and
#define FRDM_KE06Z
#define DEMO_UART 0
respectively.
Beware that on the FRDM-KE06Z board the UART0 UART pins are not connected to the connectors by default since they are used by other peripheral connections. There are zero-Ohm resistors to modify this if needed, therefore measure the Tx output directly at the processor pins to be sure that it is not a measurement issue.
Regards
Mark
Thank you Mark. It was a hardware issue. UART0 tx signal i checked at the connector, which was not coming there as you have mentioned. Now its working .
Hi Lajitha CS,
Thank you for your root problem sharing.
If your problem is solved, please mark the correct answer to close this question, thank you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------