S32R274 LIN UART can't send

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32R274 LIN UART can't send

563 Views
wanglongfeilf
Contributor I

I have a question about S32R274,I Send characters without interrupts But the program stays where the function is sent。Because I used the radar SDK, so LIN interrupt function mapping and interrupt priority I used the part of the radar SDK

Below is my initialization code and send code:

void uartCfgLIN(uint32_t baud_rate)
{
rsdkIsrRegisterParam_t irqStruct;

irqStruct.irqExecCore = RSDK_CURRENT_CORE;
irqStruct.pIrqHandler = &LIN1_rx_isr;
irqStruct.irqPriority = 7;
// SIUL Setup
SIUL2.MSCR[59].R = 0x12870002; // PAD59 / PD11 (BGA257, A13) SSS = 2 = LIN1_TXD
SIUL2.MSCR[95].R = 0x008C0000; // PAD95 / PF15 (BGA257, J17) input
SIUL2.IMCR[63].R = 3; // PAD95 / PF15 (BGA257, J17) SSS = 3 = LIN1_RXD

// UART Initialization
LINFlexD_1.LINCR1.R = 1; // exit sleep mode and enter initialization mode
baudRateSetupLIN(baud_rate, LINPS_CLK); // set desired baud rate
LINFlexD_1.UARTCR.R = 1; // enable UART mode first
LINFlexD_1.UARTCR.R = 0x00000033; // keep UART mode, WL = 01 = 8 bit word length, no parity control, transmitter&receiver enable, Tx&Rx buffer mode enable
LINFlexD_1.UARTSR.R = 0x0000FFFF; // clear all flags
LINFlexD_1.LINCR1.R = 0; // leave initialization mode, enter normal mode
RsdkRegisterIntcHandler(INTC_IRQ_OFFSET_LINFLEXD1_RX,&irqStruct);
LINFlexD_1.LINIER.R = 0x00000004; // disaable data transmission and enable reception interrupt
}

void my_putchar(char data)
{
LINFlexD_1.BDRL.R = data; // transmit data
while(LINFlexD_1.UARTSR.B.DTFTFF == 0 ); // wait for transmission complete
LINFlexD_1.UARTSR.R = 2; // clear DTF flag
}

0 Kudos
0 Replies