MPC5744P LINFlexD_1 uart receive is always timeout

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

MPC5744P LINFlexD_1 uart receive is always timeout

1,363 Views
jack-cap
Contributor III

Hi nxp:

I usb LINFlexD_UART_MPC5744P testing the board of DEVKIT-MCP5744P. It's can send message to PC terminal, But MCP5744P can not get the message from PC termianl. I find the program beed locked on the line of "while (LINFlexD_1.UARTSR.B.DRFRFE == 0)". I add some judegment statement, as shown int the following figure. I find the timeout bit been set. How to solve this problem? anyone can help me? Thanks.

微信截图_20200409112604.png

0 Kudos
7 Replies

955 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi, 

I tested that example and added a given routine to echo character and have no problem to receive character from PC. I wrote "simple echo test" in TeraTerm.

testLINFlexD_1(); /* Send test message to PC terminal.*/

for(;;)
{
   echoLINFlexD_1();
}

pastedImage_5.png

BR, Petr

0 Kudos

955 Views
jack-cap
Contributor III

In addition, I have a question about configure the register of UARTCR. 

LINFlexD_1.UARTCR.R = 0x0033; /* UART Ena, 1 byte tx, no parity, 8 data*/

In example the register of UARTCR is configured with 0x0033, And it says in the notes will enable UART mode, no parity, data bit is 8. But when I look at the MPC5744PRM, I don't think the register is configured correctly,because 31th bit is zero. It is strange that this configuration works, In pc terminal can receive the message from mpc5744p. Can you explain it to me ? Thanks.20200409175020.png

0 Kudos

955 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I used LINFlexD_UART_MPC5744P demo example from the S32DS.Power.2.1

The value 0x33 written to UARTCR register means RxEN, TxEN, WL0 and UART bits are set, so correct setting for a given description.

Note bit position is reversed in Power architecture.

BR, Petr

0 Kudos

955 Views
jack-cap
Contributor III

Could you please privide me a demo example with serial interrupt receiving data? Thank you very much.

0 Kudos

955 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

what is the board revision you have? If you have a scope/analyzer try to measure RX signal from MCU's PD12 pin back to K20's RXD_K20 pin, if you see character sent from PC. Use board schematic to know measure points.

You can simply add RX interrupt code for the LINFlexD_UART_MPC5744P demo example.

In main.c file use

void LINFlexD_1_RXISR(void)
{
     echoLINFlexD_1();
}

__attribute__ ((section(".text")))
int main(void)
{

     xcptn_xmpl (); /* Configure and Enable Interrupts */

     peri_clock_gating(); /* Config gating/enabling peri. clocks for modes*/
     /* Configuraiton occurs after mode transition */
     system160mhz(); /* sysclk=160MHz, dividers configured, mode trans*/

     initGPIO();

     initLINFlexD_1(80,19200);

     testLINFlexD_1(); /* Send test message to PC terminal.*/

     /* enable RX interrupt */
     LINFlexD_1.LINIER.R = 0x0004;
    // assign required peripheral priorities
    INTC_0.PSR[380].R = 0x8001; // LINFlex1_RXI

   

    for(;;)
    {
         //echoLINFlexD_1();
    }
; //Loop forever

return 0;
}

and put the address of interrupt routine into vector table.

So within intc_SW_mode_isr_vectors_MPC5744P.c add

/*========================================================================*/
/* PROTOTYPES */
/*========================================================================*/
void dummy (void);
extern void LINFlexD_1_RXISR(void);

and find proper line and change it to 

(uint32_t) &dummy, /* Vector # 379 Reserved for LINFlex/eSCI0_3 LINFlex_0 */
(uint32_t) &LINFlexD_1_RXISR, /* Vector # 380 LINFlex_RXI LINFlex_1 */
(uint32_t) &dummy, /* Vector # 381 LINFlex_TXI LINFlex_1 */

BR, Petr

0 Kudos

955 Views
jack-cap
Contributor III

The S32DS.Power version I'm used is also 2.1, we are use the same demo example. I modified the demo as you do, But when I type characters in the pc terminal, there is no echo. What's the problem?

version.png

微信截图_20200410105443.png

pc.png

0 Kudos

955 Views
jack-cap
Contributor III

are you use S32 Design Studio ?  Could you give me the example what you used? Thanks you very much.

0 Kudos