AnsweredAssumed Answered

KL03Z4 LPUART Interrupt (Newbie)

Question asked by Beau Rogers on Jul 14, 2017
Latest reply on Jul 24, 2017 by Beau Rogers

This is a fairly basic question but I am fairly new to this and I have not been able to find any solution. I am trying to initilize an interrupt routine when the Receive Data Register is full for the LPUART function. My debug tests have shown that when I transmit 0x55 into pinB2, there is a detection on the rising edge (LPUART0_STAT(RXEDGIF =1)), but it never fills up the buffer (LPUART0_STAT(RDRF=0)). My register set up is seen below, am I missing something for setting up the registers or is there something else?


/////////////////////////////////////LPUART Setup///////////////////////////////////////////////////////

//setting System Integration Module//
SIM_BWR_SOPT5_LPUART0RXSRC(SIM_BASE_PTR, 0); //select LPUART_RX pin to receive data
SIM_BWR_SCGC5_LPUART0(SIM_BASE_PTR, 1);//enabling UART clock
SIM_BWR_SCGC5_PORTB(SIM_BASE_PTR, 1);//enables clock gate of Port B


///////Port Set-up///////
PORT_BWR_PCR_MUX(PORTB, 2, 0b010); //Set the Alt2 muxing on Port B, pin 2 for UART0_RX
PORT_BWR_PCR_IRQC(PORTB, 2, 0b1011);//Interrupt configuration to happen on either edge

//Setting the BAUD register//

//To achieve a baud rate of 300, we want SBR=2 [0000000000010] and OSR=4 [11111]
LPUART_BWR_BAUD_SBR(LPUART0,0b0000000010110); //Setting SBR =22
LPUART_BWR_BAUD_RXEDGIE(LPUART0, 1); //enabling hardware interrupts from STAT register


//setting CTRL register//
LPUART_BWR_CTRL_RIE(LPUART0, 1); //receiver data buffer full interrupt (1-enable 0-disable)
LPUART_BWR_CTRL_RE(LPUART0, 1);//enabling receiver mode
LPUART_BWR_CTRL_IDLECFG(LPUART0, 0b010);//configures 4 idle characters before an idle flag is set



Would really appreciate it and sorry for the relative simplicity of this question. Let me know if you need any more information.