Using DUART in SRAM bare board project

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DUART in SRAM bare board project

239 Views
Contributor II

Hi,

I have problem using DUART under code warrior on T1024RDB based board. I didn't link serial library included in CW under PA folder (I cannot figure out how to do it for SRAM download configuration); however I use similar code to init UART, calculate divisor etc. Input/output is polling based and is very simple. 

The only problem I cannot get any character out from serial port as well as I don't see any input. Internal DUART loopback mode works well. It looks like frequencies and baud rate is way off. 

Nonetheless all platform PLL ratio and everything else looks good.

Do you have any ideas of what to check and why DUART may not work under code warior bare board SRAM project?

Thank you,

Ed

5 Replies

56 Views
NXP TechSupport
NXP TechSupport

Hello Eduard Kromskoy,

The UART libraries are compiled with a specific CCSRBAR address. For a different value of the CCSRBAR you need to rebuild the UART library:
1. From your CW install directory, import the
<CWInstallDir>\PA\PA_Support\Serial\T1024RDB_aeabi_32bit_serial (or T1024RDB_aeabi_64bit_serial) project in CodeWarrior IDE from File->Import->General->Existing Projects into Workspace.
2. Switch to the correspondent Build Target (eg DUART A Lib T1024RDB).
Open duart_config.h file and change the value of the "MMR_BASE" accordingly
3. Re-build the project (and copy the output library in you project)


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

56 Views
Contributor II

Hi Yiping,

Ok, I compiled and linked library. It doesn't work same way as my code. I don't see any characters shifted out by connected terminal (putty). I am pretty sure MMR_BASE is proper (0xfe000000) because

1) I use same base to access GPIO registers to toggle LEDs and it works fine.

 2) I see changes under Debugger/Registers in DUART1. Moreover if I set internal loop back mode I see last sent character in RX holding register DUART1_UDLB1 0x00 0x0fe11c500`Physical cache - inhibited

Platform ratio read from RCW is 1:4 as expected and UART divisor is same as in u-boot. In u-boot serial port works fine. Hardware is OK. Just cannot get it working under CW debug configuration. 

Should I enable some clocks, check PLL ratio for DRAM etc?

Thank you.

Ed

0 Kudos

56 Views
NXP TechSupport
NXP TechSupport

Hello Eduard Kromskoy,

Please use the default ARM Bareboard project to connect the target board with "ARM download" to do verification, which could be created following the new project wizards,  it will print "Welcome to CodeWarrior from Core x - Thread y!" out of the common serial port (DUART1).

The SRAM version project contains a simple main file, which doesn't invoke "printf", because SRAM memory space is too small to accommodate printf stack running environment.

If your problem persists, please attach your CodeWarrior project to me, I will verify it on my target board.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

56 Views
Contributor II

Hi Yiping

I will try to build default T1024 bare board project and run it on T1024RDB board. I am on PPC, not ARM. And then compare projects. I am sure it will work with DDRAM enabled. Our custom board has different DRAM memory, so that was reason I didn't want to play with DDRAM settings. 256K is more than enough for my project and it should run on custom board not RDB SDK board from Freescale. In u-boot we use serial port in SPL (first stage loader running from SRAM) with no problem. 

Do you have any ideas what is different between SRAM and DDRAM default projects beside of memory space? My guess is some PLL is not set correctly or some bit is not enabled for DUART to function in SRAM default project. I was hoping someone knows differences. 

I do not use any buffered IO or formatted input/output. After I compiled serial driver library according to your instructions above; I copied it to my project and added it to project's libraries. My main function in main_SRAM.c is just 3 lines:

int main(void)
{

#if SMPTARGET
initSmp();
#endif

InitializeUART(kBaud115200);
WriteUARTString("Hello word\n\r");
while (1){;}  /* dead loop forever */

}

I removed all recursive function calls as not relevant for me.

0 Kudos

56 Views
Contributor II

Found the problem. I used PBL tool to generate hardcode override RCW and didn't check that default UART_BASE bits are all 0; therefore SIN/SOUT pins were configured as GPIO.

Serial library as well as bare register serial programming works fine. There is no difference in CPU/platform initialization between DRAM and SRAM projects beside of DRAM initialization and using DRAM as oppose to SRAM.

Thank you,

Ed