AnsweredAssumed Answered

Need help with UART Initialization on S32V234

Question asked by vedha chalam on Jul 23, 2018

The UART initialization does not happen with the default code of accessing the specific fields directly, but it accepts the initialization if assigned whole word.

 

Default Init code( Not working):

                                 -> Board just hangs and does not cross the initialization part

UART_Init()

{

   LINFlexD_0.LINCR1.B.INIT = 0x1;

   LINFlexD_0.LINCR1.B.SLEEP = 0x0;

   LINFlexD_0.UARTCR.B.UART = 0x1;  //Linflex working in UART mode

   LINFlexD_0.UARTCR.B.TxEn = 0x1;    // Enable transmission of data now
   LINFlexD_0.UARTCR.B.RxEn = 0x1;    //Receiver enabled
   LINFlexD_0.UARTCR.B.WL0   = 0x1;    //8 bit data
   LINFlexD_0.UARTCR.B.PCE  = 0x0;    //No parity

   Linflex_SetSpeed();

   LINFlexD_0.LINCR1.B.INIT = 0x0;

}

 

Modified code for direct word assignment to specific address(partially working):

                               -> Board outputs some characters in console but not expected character

UART_Init()

{

        *(vuint32_t *) 0x40053000 = 0x1; 

        *(vuint32_t *) 0x40053010 = 0x33; //LINFlexD_0.UARTCR.B.UART = 0x1;  //Linflex working in UART mode

        *(vuint32_t *) 0x40053024 = 0x2; 
        *(vuint32_t *) 0x40053028 = 0x24;

        *(vuint32_t *) 0x40053000 = 0;

}

 

Query:

Could you please let me know if any other fields has to be set to initialize the bit fields directly as mentioned in the default code

 

Thanks and Regards,

Vedhachalam

Outcomes