LPC4337 with AS4C2M32SA-6TIN 64MB SDRAM

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

LPC4337 with AS4C2M32SA-6TIN 64MB SDRAM

1,099 Views
moller
Contributor II

I am trying to get the AS4C2M32SA-6TIN SDRAM to work with my LPC4337. I am not experienced with external memory.

I am able to write data to the first 32 addresses but the 33rd fails. I think the timings must be okay but something in my configuration is off.

 

Currently it is setup as: 2Mx32, 4BANKS, 11ROWS, 8COLS. Can someone verify this is the correct setup for this SDRAM?

 

Also, any ideas where I am failing to be able to access the whole 64 MB?

Labels (1)
7 Replies

572 Views
bernhardfink
NXP Employee
NXP Employee

Your configuration is correct: 4 banks, 11 Rows, 8 columns

As far as I can see this SDRAM can be configured the same way as the SDRAM which is on the LPC1800/LPC4300 board from Keil (MCB1857/MCB4357). This is one of our reference boards in the LPCOpen package, so I would like to refer you to the schematic of this board and also to the configuration in the board layer of the LPCOpen package for the LPC4357.

Regards,

NXP Support Team

572 Views
moller
Contributor II

Thank you for the confirmation.

I found an example I have been following and I have attached my configuration file. If someone could help me identify why I can only write 32 words of data I would be greatful as I want to understand WHY I am having this problem.

Regards,

Sigurd

0 Kudos

572 Views
bernhardfink
NXP Employee
NXP Employee

Standard mistake in hardware: wrong connection of address lines

  • connect A0 - A10 from the SDRAM to A0 - A10 from the LPC4337
  • connect BA0 from the SDRAM to A13 from the LPC4337
  • connect BA1 from the SDRAM to A14 from the LPC4337

Standard mistake in software:  wrong initialization. See some hot spots mentioned below

  • Configure the controoler for the right address mapping:
    LPC_EMC->DYNAMICCONFIG0 = 0x5300;  // BRC mapping
    or
    LPC_EMC->DYNAMICCONFIG0 = 0x4300;  // RBC mapping
  • init all timing registers
  • Write to the SDRAM mode register:
    /* Mode register: Burst Length: 4, Burst Type: Sequential, CAS Latency: 3   */
    WR_MODE(((3 << 4) | 2) << 12);

  • At the end of the init function the buffers must be enabled:
    LPC_EMC->DYNAMICCONFIG0   |= (1 << 19);   /* Enable buffer                  */

572 Views
moller
Contributor II

My address lines are correct.

I did not have the BRC/RBC address mappings but neither of them makes a huge difference.

Mode is already set to burst length 4, sequential with a CL of 3.

Only my static buffer was enabled before but enabling the dynamic buffer does not make a huge difference either. I still get errors when I read from the 33rd word to validate.

0 Kudos

572 Views
bernhardfink
NXP Employee
NXP Employee

Could you attach your init function for the static & dynamic memory interface, then I will have a look.

Also interesting would be the EMC frequency (with 1:2 clock divider or not).

Regards,

NXP Support Team

572 Views
moller
Contributor II

And here is another main.c attached for testing which is the more correct one I guess (testing with 8-bit and 16-bit values)

I really want this to work so I hope someone is able to tell me where I am making huge mistakes and point them out.

Kind regards

0 Kudos

572 Views
moller
Contributor II

I appreciate your rapid replies.

I have attached my setup (and my main where I do the actual testing).

Right now I am able to write 48 words and fails at the 49th word.

0 Kudos