AnsweredAssumed Answered

Configure UART for T4240RDB at Lauterbach Trace32 Script

Question asked by vinothkumar s on Jan 3, 2019
Latest reply on Jan 4, 2019 by alexander.yakovlev

Hi All,

 

I am using Lauterbach Trace32 Script for UART in t4240rdb machine. But, I am not getting Uart baud rate properly. 

I want to you guys suggestion for configure UART register.

 

The script flow,

 

DO ~~~~/demo_set_rcw_rev1.cmm

;Calculation of UART settings for 115200Bd
&SYS_PLL_RAT="((data.long(ANC:iobase.address()+0xE0100)>>25.)&0x0000001F)" ;Get PLL ratio from RCW for                    correct DUART settings
&UARTH=0x0
&UARTL=0x0
IF &SYS_PLL_RAT==0x4
&UARTL=0x48
ELSE IF &SYS_PLL_RAT==0x5
&UARTL=0x5A
ELSE IF &SYS_PLL_RAT==0x6
&UARTL=0x6D
ELSE IF &SYS_PLL_RAT==0x7
&UARTL=0x7F
ELSE IF &SYS_PLL_RAT==0x8
&UARTL=0x91
ELSE IF &SYS_PLL_RAT==0x9
&UARTL=0xA3
ELSE IF &SYS_PLL_RAT==0xA
&UARTL=0xB5
ELSE IF &SYS_PLL_RAT==0xB
&UARTL=0xC7
ELSE IF &SYS_PLL_RAT==0xC
&UARTL=0xD9
ELSE IF &SYS_PLL_RAT==0xD
&UARTL=0xEB
ELSE IF &SYS_PLL_RAT==0xE
&UARTL=0xFD
ELSE IF &SYS_PLL_RAT==0xF
&UARTL=0x10F
ELSE IF &SYS_PLL_RAT==0x10
&UARTL=0x121

ELSE
(
PRINT %ERROR "ERROR: invalid RCW SYS_PLL_RAT settings."
STOP
)

;configure DUART1 - UART1
Data.Set ANC:IOBASE()+0x11C501 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C503 %Byte 0x83
Data.Set ANC:IOBASE()+0x11C500 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C501 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C503 %Byte 0x03
Data.Set ANC:IOBASE()+0x11C504 %Byte 0x03
Data.Set ANC:IOBASE()+0x11C502 %Byte 0x07
Data.Set ANC:IOBASE()+0x11C503 %Byte 0x83
Data.Set ANC:IOBASE()+0x11C500 %Byte &UARTL
Data.Set ANC:IOBASE()+0x11C501 %Byte &UARTH
Data.Set ANC:IOBASE()+0x11C503 %Byte 0x03

;configure DUART1 - UART2
Data.Set ANC:IOBASE()+0x11C601 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C603 %Byte 0x83
Data.Set ANC:IOBASE()+0x11C600 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C601 %Byte 0x00
Data.Set ANC:IOBASE()+0x11C603 %Byte 0x03
Data.Set ANC:IOBASE()+0x11C604 %Byte 0x03
Data.Set ANC:IOBASE()+0x11C602 %Byte 0x07
Data.Set ANC:IOBASE()+0x11C603 %Byte 0x83
Data.Set ANC:IOBASE()+0x11C600 %Byte &UARTL
Data.Set ANC:IOBASE()+0x11C601 %Byte &UARTH
Data.Set ANC:IOBASE()+0x11C603 %Byte 0x03

;configure DUART2 - UART1
Data.Set ANC:IOBASE()+0x11D501 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D503 %Byte 0x83
Data.Set ANC:IOBASE()+0x11D500 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D501 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D503 %Byte 0x03
Data.Set ANC:IOBASE()+0x11D504 %Byte 0x03
Data.Set ANC:IOBASE()+0x11D502 %Byte 0x07
Data.Set ANC:IOBASE()+0x11D503 %Byte 0x83
Data.Set ANC:IOBASE()+0x11D500 %Byte &UARTL
Data.Set ANC:IOBASE()+0x11D501 %Byte &UARTH
Data.Set ANC:IOBASE()+0x11D503 %Byte 0x03

;configure DUART2 - UART2
Data.Set ANC:IOBASE()+0x11D601 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D603 %Byte 0x83
Data.Set ANC:IOBASE()+0x11D600 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D601 %Byte 0x00
Data.Set ANC:IOBASE()+0x11D603 %Byte 0x03

Data.Set ANC:IOBASE()+0x11D604 %Byte 0x03
Data.Set ANC:IOBASE()+0x11D602 %Byte 0x07
Data.Set ANC:IOBASE()+0x11D603 %Byte 0x83
Data.Set ANC:IOBASE()+0x11D600 %Byte &UARTL
Data.Set ANC:IOBASE()+0x11D601 %Byte &UARTH
Data.Set ANC:IOBASE()+0x11D603 %Byte 0x03

;print message DUART1 - UART1
Data.Out ANC:IOBASE()+0x11C500 %Byte 0x0D 0x0A
Data.Out ANC:IOBASE()+0x11C500 %Byte 0x0D 0x0A
Data.Out ANC:IOBASE()+0x11C500 %Byte "This text is printed via the TRACE32 configuration script for T4240QDS" 0x0D 0x0A
Data.Out ANC:IOBASE()+0x11C500 %Byte "===================================================================" 0x0D 0x0A
Data.Out ANC:IOBASE()+0x11C500 %Byte 0x0D 0x0A
Data.Out ANC:IOBASE()+0x11C500 %Byte 0x0D 0x0A

 

 

 

Thank You for All Your Help..........!

Regards, VinothS

Outcomes