This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with SDRAM and return of a function

Dear all,

I'm using the LPC2468 with SDRAM that ist configured in the startup and ind the memory layout. In general ist works. But I found one strange problem.

I have a sructure ExternalCFG that is in SDRAM (start adress at 0XA0000280). This structue has a value (ExternalCFG.ulMinCycleTime) that I want to check for zero:

if(DT50_tExternalCFG.ulMinCycleTime == 0)

this results in the following disassembly:

   485:       if(ExternalCFG.ulMinCycleTime == 0)
   486:       {
0x00004738  E51F0068  LDR       R0,[PC,#-0x0068]
0x0000473C  EB008F45  BL        __rt_uread4(0x00028458)
0x00004740  E3500000  CMP       R0,#0x00000000
0x00004744  1A000002  BNE       0x00004754

And know I jump to the __rt_uread4 that results tis dissambly:

0x00028458  E5D02001  LDRB      R2,[R0,#0x0001]
0x0002845C  E5D01000  LDRB      R1,[R0]
0x00028460  E5D03002  LDRB      R3,[R0,#0x0002]
0x00028464  E5D00003  LDRB      R0,[R0,#0x0003]
0x00028468  E1811402  ORR       R1,R1,R2,LSL #8
0x0002846C  E1811803  ORR       R1,R1,R3,LSL #16
0x00028470  E1810C00  ORR       R0,R1,R0,LSL #24
0x00028474  E12FFF1E  BX        R14

When I know execute the last line (BX R14) my hole system crashes and no jtag possible. The value in R14 is the right return adress.

So what can be the problem???

Big thanks for the help,

Christian