MK66 SDRAM databus lost

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

MK66 SDRAM databus lost

Jump to solution
3,004 Views
danielrumary
Contributor II

Hi I`m thinking of using the MK66FN2M0VLQ18 in a project and need to add SDRAM but I`m a bit confused as I cannot find any examples. It seems that Databus 0 - 15 is not available on FB_AD0-15 as it is used for the address lines - Do I need to use latches to multiplex the data bus with the address lines?

Any help would be greatly appreciated

1 Solution
2,328 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have checked the data sheet of MT48LC8M16A2 – 2 Meg x 16 x 4 Banks, this is the parameters:

row addressing:4K A[11:0]

column addressing:512 A[8:0]

bank addressing:4 BA[1:0]

You have to use the Table 35-8. SDRAM Controller to SDRAM Interface (16-Bit Port, 9-Column Address Lines) in RM of K66, the data bus is hooked to the High half word, I think your connection is okay. but I do not check the pin assignment.

BR

Xiangjun Rong

View solution in original post

15 Replies
2,328 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

i attach a doc, hope it can help you especially for initializing the SDRAM controller. But you need modify it based on the spec of SDRAM.

BR

Xiangjun Rong

0 Kudos
2,326 Views
danielrumary
Contributor II

Great Thanks Xiangjun

0 Kudos
2,326 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Daniel,

Regarding your question, i am a bit confused, do you interface with SDRAM or SRAM? if you hook SDRAM, you have to use SDRAM SDR controller to connect, if you use SRAM/Nor flash, you can use FlexBus to connect.

If you use SDRAM, pls refer to the follwoing table in reference manual of K66.

pastedImage_1.png

Pls tell us the device even part number you want to hook.

BR

XiangJun Rong

2,327 Views
danielrumary
Contributor II

Hi XiangJun

Thanks for your reply.

The SDRAM is MT48LC8M16A2P-75 (2 Meg x 16 x 4 Banks) - I have attached the pin mapping to what I think may work?

MK66 Pin (LQFP)MK66 Pin NameMK66 mode MT48LC8M16A2P pinMT48LC8M16A2P pin NAME
81PTB0SDRAM_CAS_b 17SDRAM_CAS
82PTB1SDRAM_RAS_b 18SDRAM_RAS
83PTB2SDRAM_WE 16SDRAM_WE
84PTB3SDRAM_CS0_b 19SDRAM_CS0
106PTC3CLKOUT 38SDRAM_CLOCKOUT
125PTC18SDRAM_DQM1 39SDRAM_DQM1
126PTC19SDRAM_DQM0 15SDRAM_DQM0
136PTD7SDRAM_CKE 37SDRAM_CKE
      
96PTB17FB_AD16/ SDRAM_D16 2SDRAM_D0
95PTB16FB_AD17/ SDRAM_D17 4SDRAM_D1
92PTB11FB_AD18/ SDRAM_D18 5SDRAM_D2
91PTB10FB_AD19/ SDRAM_D19 7SDRAM_D3
90PTB9FB_AD20/ SDRAM_D20 8SDRAM_D4
89PTB8FB_AD21/ SDRAM_D21 10SDRAM_D5
88PTB7FB_AD22/ SDRAM_D22 11SDRAM_D6
87PTB6FB_AD23/ SDRAM_D23 13SDRAM_D7
120PTC15FB_AD24/ SDRAM_D24 42SDRAM_D8
119PTC14FB_AD25/ SDRAM_D25 44SDRAM_D9
118PTC13FB_AD26/ SDRAM_D26 45SDRAM_D10
117PTC12FB_AD27/ SDRAM_D27 47SDRAM_D11
102PTB23FB_AD28/ SDRAM_D28 48SDRAM_D12
101PTB22FB_AD29/ SDRAM_D29 50SDRAM_D13
100PTB21FB_AD30/ SDRAM_D30 51SDRAM_D14
99PTB20FB_AD31/ SDRAM_D31 53SDRAM_D15
      
132PTD5FB_AD1/ SDRAM_A9 32A7
131PTD4FB_AD2/ SDRAM_A10 31A6
130PTD3FB_AD3/ SDRAM_A11 30A5
129PTD2FB_AD4/ SDRAM_A12 29A4
115PTC10FB_AD5/ SDRAM_A13 26A3
114PTC9FB_AD6/ SDRAM_A14 25A2
113PTC8FB_AD7/ SDRAM_A15 24A1
112PTC7FB_AD8/ SDRAM_A16 23A0
 
110PTC5FB_AD10/ SDRAM_A18 33A8
109PTC4FB_AD11/ SDRAM_A19 34A9
105PTC2FB_AD12/ SDRAM_A20 22A10
104PTC1FB_AD13/ SDRAM_A21 35A11
103PTC0FB_AD14/ SDRAM_A22 20BANK SEL 0
97PTB18FB_AD15/ SDRAM_A23 21BANK SEL 1
0 Kudos
2,326 Views
stonos
Contributor II

When using 16-bit wide SDRAM and D16-D31 on the MCU (mandatory from what I understand), is this realy correct:

125PTC18SDRAM_DQM1 39SDRAM_DQM1
126PTC19SDRAM_DQM0 15SDRAM_DQM0

I thought one should connect MCU DQM3 and DQM2 to SDRAM DQM1 and DQM0, or?

0 Kudos
2,326 Views
danielrumary
Contributor II

Yes I`m pretty sure its correct, I have to admit the datasheet is pretty poor at explaining how to wire SDRAM but the tables 35-4 to 13 are correct so you can blindly follow them. We invited a NXP technical expert to our business to double check for us and he confirmed that the above wiring is correct.  The Prototype boards are being made next week so I`ll be pretty disappointed if they don`t work. 

0 Kudos
2,327 Views
stonos
Contributor II

Hi Daniel,

I am working with K65, but the Reference manual looks the same. We are about to order a board any day. What I have been looking at is "Figure 35-2. Connections for External Memory Port Sizes" and from that figure my conclusion is that BS3 and BS2 shall be used with 16-bit wide memory (BS[3:0] is the DQM, see table 35-2). You can also check this thread on the same topic: https://community.nxp.com/thread/437787

0 Kudos
2,328 Views
danielrumary
Contributor II

Hi

I am so confused - I think you are right BS3 and BS2 should be used with 16bit SDRAM  but as it is memory mapped does it matter?

Bank select and DQM are two separate items.

Synchronous dynamic random-access memory - Wikipedia 

  • DQM Data Mask. (The letter Q appears because, following digital logic conventions, the data lines are known as "DQ" lines.) When high, these signals suppress data I/O. When accompanying write data, the data is not actually written to the DRAM. When asserted high two cycles before a read cycle, the read data is not output from the chip. There is one DQM line per 8 bits on a x16 memory chip or DIMM.
  • Bank Selection (BAn)[edit]

    SDRAM devices are internally divided into either 2, 4 or 8 independent internal data banks. One to three Bank Address inputs (BA0, BA1 and BA2) are used to select which bank a command is directed toward.

I`m pretty sure that you can wire the bank select lines straight to the next available address lines. 

0 Kudos
2,328 Views
stonos
Contributor II

When checking table 35-2 BS[3:0] should be interpret as "Byte Select" and not "Bank Selection":

"SDRAM byte selects BS[3:0] function as byte enables to the SDRAMs. They connect to the DQM signals (or data qualifier masks) of the SDRAMs.".

In Figure 35-2 the BS signals have the text "Byte Enable" to the left of them to make it more confusing.

A problem is that NXP uses BS instead of DQM in the Reference manual and DQM in the Datasheet not BS.

I am still not 100% sure what is right, but I whould really like be 100% sure before we order our board...

2,328 Views
danielrumary
Contributor II

This is ridiculous - why is the datasheet so confusing?

I am going to contact NXP directly and get them to advise, once done I will let you know on this post.

Best Regards Dan.

0 Kudos
2,328 Views
danielrumary
Contributor II

Hi I have contact NXP and they kindly reviewed the design for me, it looks like the design was wrong and that the DQM signals need to connect to DQM2 and DQM3.

Also just to clarify the Bank address lines are correct:

In terms of the Bank Address lines, on the SDR these select one of the 4 internal banks. To make the memory space mapped to the K66 contiguous, we use the next 2 address lines. So I’m happy with using SDRAM_A22 and SDRAM_A23 connected to BANK_SEL0 and BANK_SEL1. That is consistent with both the TWR schematic and the Table 35-16 example in the device reference manual (pdf page 900) of Rev2 reference manual.

So with reasonable confidence below is how you connect 128Mbit of SDRAM to the MK66 in 16bit mode, although we will only 100% know once we have re-spun the PCB.

Connecting MT48LC8M16A2P to MK66FN2M0VLQ18.

MK66 Pin (LQFP)MK66 Pin NameMK66 mode MT48LC8M16A2P pinMT48LC8M16A2P pin NAME
81PTB0SDRAM_CAS_b 17SDRAM_CAS
82PTB1SDRAM_RAS_b 18SDRAM_RAS
83PTB2SDRAM_WE 16SDRAM_WE
84PTB3SDRAM_CS0_b 19SDRAM_CS0
106PTC3CLKOUT 38SDRAM_CLOCKOUT
124PTC17SDRAM_DQM3 39SDRAM_DQMU
123PTC16SDRAM_DQM2 15SDRAM_DQML
136PTD7SDRAM_CKE 37SDRAM_CKE
      
96PTB17FB_AD16/ SDRAM_D16 2SDRAM_D0
95PTB16FB_AD17/ SDRAM_D17 4SDRAM_D1
92PTB11FB_AD18/ SDRAM_D18 5SDRAM_D2
91PTB10FB_AD19/ SDRAM_D19 7SDRAM_D3
90PTB9FB_AD20/ SDRAM_D20 8SDRAM_D4
89PTB8FB_AD21/ SDRAM_D21 10SDRAM_D5
88PTB7FB_AD22/ SDRAM_D22 11SDRAM_D6
87PTB6FB_AD23/ SDRAM_D23 13SDRAM_D7
120PTC15FB_AD24/ SDRAM_D24 42SDRAM_D8
119PTC14FB_AD25/ SDRAM_D25 44SDRAM_D9
118PTC13FB_AD26/ SDRAM_D26 45SDRAM_D10
117PTC12FB_AD27/ SDRAM_D27 47SDRAM_D11
102PTB23FB_AD28/ SDRAM_D28 48SDRAM_D12
101PTB22FB_AD29/ SDRAM_D29 50SDRAM_D13
100PTB21FB_AD30/ SDRAM_D30 51SDRAM_D14
99PTB20FB_AD31/ SDRAM_D31 53SDRAM_D15
      
132PTD5FB_AD1/ SDRAM_A9 32A7
131PTD4FB_AD2/ SDRAM_A10 31A6
130PTD3FB_AD3/ SDRAM_A11 30A5
129PTD2FB_AD4/ SDRAM_A12 29A4
115PTC10FB_AD5/ SDRAM_A13 26A3
114PTC9FB_AD6/ SDRAM_A14 25A2
113PTC8FB_AD7/ SDRAM_A15 24A1
112PTC7FB_AD8/ SDRAM_A16 23A0
 
110PTC5FB_AD10/ SDRAM_A18 33A8
109PTC4FB_AD11/ SDRAM_A19 34A9
105PTC2FB_AD12/ SDRAM_A20 22A10
104PTC1FB_AD13/ SDRAM_A21 35A11
103PTC0FB_AD14/ SDRAM_A22 20BANK SEL 0
97PTB18FB_AD15/ SDRAM_A23 21BANK SEL 1

Regards Dan.

2,328 Views
coyote47
Contributor I

Hi Daniel, 

Any update to how the above pinout worked?

Thanks,

Ryan

0 Kudos
2,329 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have checked the data sheet of MT48LC8M16A2 – 2 Meg x 16 x 4 Banks, this is the parameters:

row addressing:4K A[11:0]

column addressing:512 A[8:0]

bank addressing:4 BA[1:0]

You have to use the Table 35-8. SDRAM Controller to SDRAM Interface (16-Bit Port, 9-Column Address Lines) in RM of K66, the data bus is hooked to the High half word, I think your connection is okay. but I do not check the pin assignment.

BR

Xiangjun Rong

2,328 Views
danielrumary
Contributor II

Thanks Xiangjun

Just one more clarification:

Do I wire the bank select lines to the upper address lines?

i.e.

BANK_SEL_0 = SDRAM_A22

BANK_SEL_1 = SDRAM_A23

Best Regards Dan.

0 Kudos
2,328 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

For K66, you can locate the SDRAM to the address space:

0x8000_0000–0x8FFF_FFFF SDRAM (External RAM - Write-through) All masters

in other words, your SRDAM space will be:

0x8000 0000 to 0x80FF FFFF for MT48LC8M16A2

But you have to initialize the SDRAM controller before you access the SDRAM.

I attach an doc, hope it can help you.

BR

XiangJun Rong