AnsweredAssumed Answered

MK12 UART

Question asked by mylim on Jul 2, 2020
Latest reply on Jul 2, 2020 by Kerry Zhou

Hi, I just started using Kinetis and MCUexpresso.

I am having some issue with my UART - RS485 which I am not sure if i did it correctly.

I transmitted data to the board but it didn't trigger the Interrupt.

 
I have referred to MCUExpresso SDK API Reference Manual.

I am using at 12MHz Crystal with 22pF capacitor.

Core/System/Bus Clock is 48MHz.
I have RS485 communication initialized as follow;

 

#define UART0_HANDLER UART0_RX_TX_IRQHandler

#define UART0_IRQ_ID UART0_RX_TX_IRQn

#define UART0_ERR_HANDLER UART0_ERR_IRQHandler

#define UART0_ERR_IRQ_ID UART0_ERR_IRQn

 

 

void Init_UART0(void)

{

   /* Structure of initialize UART */

   uart_config_t uartConfig;

   uart_stop_bit_count_t uartStopBit;

   UART_GetDefaultConfig(&uartConfig);

   uartConfig.baudRate_Bps = 4800U;

   uartConfig.parityMode = kUART_ParityDisabled;

   //uartConfig.stopBitCount = kUART_OneStopBit;

   uartStopBit = kUART_OneStopBit;

   uartConfig.txFifoWatermark = 0;

   uartConfig.rxFifoWatermark = 1;

   UART_Init(UART0, &uartConfig, 48000000U);    UART_EnableInterrupts(UART0,kUART_RxDataRegFullInterruptEnable);

 

   EnableIRQ(UART0_IRQ_ID);

  

   printf("\r\nUART0 Initialized ...");

}

 

void UART0_HANDLER(void)

{

   if(UART0->S1 & UART_S1_RDRF_MASK)

    {

    }

}

 

Please advise.

Thanks.

Outcomes