K66F, 16-bit SDRAM, 16-bit FLEXBUS

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

K66F, 16-bit SDRAM, 16-bit FLEXBUS

1,495 Views
a8Chcx
Contributor V

Hi,

I am using K66F with 16-bit SDRAM, 16-bit external flash on FLEXBUS and have the following questions:

1) I configure flexbus and SDRAM to 16-bit port, and using KDS 3.2.0

2) When I am trying to read external flash on FLEXBUS, it works fine with 32-bit access

sdram_pointer = (UINT16*)(0x61EE0000);

PRINTF("\r\nINIT_30=0x%x_0x%x", sdram_pointer, *((UINT32*)(sdram_pointer)));

I get 0x12345678 because external flash is programmed as 0x12345678

3) When I access SDRAM with 32-bit access, I got 0x12341234 as following code:

sdram_pointer = (UINT16*)(SDRAM_START_ADDRESS + 0x00800000); // SDRAM_START_ADDRESS defined on fsl_sdram.h

*((UINT32*)(sdram_pointer)) = 0x12345678;

PRINTF("\r\nINIT_31=0x%x_0x%x", sdram_pointer, *((UINT16*)(sdram_pointer)));

3) When I access SDRAM with 32-bit access, I got 0x1234, 0x5678 as following code:

sdram_pointer = (UINT16*)(SDRAM_START_ADDRESS + 0x00800000); // SDRAM_START_ADDRESS defined on fsl_sdram.h

*((UINT16*)(sdram_pointer)) = 0x1234;

*((UINT16*)(sdram_pointer+1)) = 0x5678;

PRINTF("\r\nINIT_31=0x%x_0x%x_0x%x", sdram_pointer, *((UINT16*)(sdram_pointer)), *((UINT16*)(sdram_pointer+1)));

Looks like it works with 16-bit access, not 32-bit access on SDRAM, but it works fine with 16-bit and 32-bit on FLEXBUS...

Could you tell me where the problem is on SDRAM?

Can  I run program in 16-bit SDRAM and hot to configure for it?

Thanks,

Christie

Labels (1)
0 Kudos
9 Replies

790 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

Regarding your question

"

3) When I access SDRAM with 32-bit access, I got 0x12341234 as following code:

sdram_pointer = (UINT16*)(SDRAM_START_ADDRESS + 0x00800000); // SDRAM_START_ADDRESS defined on fsl_sdram.h

*((UINT32*)(sdram_pointer)) = 0x12345678;

PRINTF("\r\nINIT_31=0x%x_0x%x", sdram_pointer, *((UINT16*)(sdram_pointer)));

"

If you use 32 bits write and read, you should use the code:

*((UINT32*)(sdram_pointer)) = 0x12345678;

UINT32 temp;

temp=*((UINT32*)(sdram_pointer));  //change it with 32 bit access

PRINTF("\r\nINIT_31=0x%8x", sdram_pointer, temp);

BR

Xiangjun Rong

0 Kudos

790 Views
a8Chcx
Contributor V

Hi Xiangjun,

Are you trying 16-bit SDRAM on K66F?

I tried on TWR-K65F board and works as well with 16-bit or 32-bit access.

It didn't work on K66F with 16-bit SDRAM with 32-bit access. But it works with 16-bit access.

I think it may be related to SDRAM Settings. I change to 16-bit port for SDRAM initialization...

Thanks,

Christie

0 Kudos

790 Views
a8Chcx
Contributor V

Hi Xiangjun,

Any update on this? I want to confirm if it is related to hardware because I am going to update my hardware design?

Thanks,

Christie

0 Kudos

790 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

Based on your current 16 bits SDRAM board, pls use the code to access the SDRAM:

*((UINT32*)(sdram_pointer)) = 0x12345678;

UINT32 temp;

temp=*((UINT32*)(sdram_pointer));  //change it with 32 bit access

then check if you can get correct value.

From my knowledge, it does not matter if you use 16 bits data width or 32 bits data width, if you read/write a 32 bits data to SDRAM based on 16 bits data SDRAM, the SDRAM controller is smart enough to use twoice accesses to SDRAM.

Hope it can help you.

B R

Xiangjun Rong

0 Kudos

790 Views
a8Chcx
Contributor V

Hi Xiangjun,

Do you have any K66F+16-bit SDRAM to try?

I agree with you. The SDRAM controller in K66F should be the same as in K65F. There is DQM0~~DQM3 to select byte, right? I am only using DQM2, DQM3 on K66F, I can't configure to use 32-bit SDRAM, and form 32-bit because there is no data line(D0~~D15). So, if SDRAM in K66F still uses DQM0~~DQM3 to select byte, then I can't read 32-bit from SDRAM, only 16-bit SDRAM?

In MCF5282, I have to use 2 16-bit SDRAM to form 32-bit data by using BS0~~BS3...

Any idea?

Thanks,

Christie

0 Kudos

790 Views
a8Chcx
Contributor V

Hi Xiangjun,

Here are more information.

1) I am using MT48LC8M16A2P SDRAM. There are the following connections between K66F and SDRAM:

K66F                                SDRAM

SDRAM_A22-----------------BA0

SDRAM_A23-----------------BA1

SDRAM_A20-----------------A10

SDRAM_A16-----------------A0

SDRAM_A15-----------------A1

SDRAM_A14-----------------A2

SDRAM_A13-----------------A3

SDRAM_A12-----------------A4

SDRAM_A11-----------------A5

SDRAM_A10-----------------A6

SDRAM_A9------------------A7

SDRAM_A18-----------------A8

SDRAM_A19-----------------A9

SDRAM_A21-----------------A11

SDRAM_DQM3--------------DQMH

SDRAM_DQM2--------------DQML

2) I can access properly in 16-bit, but not in 32-bit mode.

3) I can access external flash(16-bit) in 32-bit mode on FLEXBUS, no problem...

Please let me know if need anything else to fix my problem?

Thanks,

Christie

0 Kudos

790 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

can you post the SDRAM access code with 32 bits access? what is wrong with you?

BR

Xiangjun Rong

0 Kudos

790 Views
a8Chcx
Contributor V

Hi Xiangjun,

The 32-bit access code is on above. My problem is 32-bit values is not right? Should be 0x12345678, but I can get 0x56785678.

Is it related to SDRAM configuration? Not hardware problem?

Thanks,

Christie

0 Kudos

790 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Christie,

i suppose your code to read/write 32 bits data is wrong, pls check your code, the hardware is correct.

Pls use the following code and have a try.

BR

Xiangjun Rong

3) When I access SDRAM with 32-bit access, I got 0x12341234 as following code:

sdram_pointer = (UINT16*)(SDRAM_START_ADDRESS + 0x00800000); // SDRAM_START_ADDRESS defined on fsl_sdram.h

*((UINT32*)(sdram_pointer)) = 0x12345678;

PRINTF("\r\nINIT_31=0x%x_0x%x",  *((UINT16*)(sdram_pointer)++),*((UINT16*)(sdram_pointer)));

0 Kudos