can't read data back from SDRAM

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

can't read data back from SDRAM

1,556 Views
peterruesch
Contributor IV

Hi,

I'm trying to use the external SDRAM on the TWR-K65 board.

Setup was done with processor expert but unfortunately, I have no idea if these values are correct.

Can anyone make a statement if these values make sense?

2015_08_05_15_08_06_Hardware_k65_benchmark_Sources_main.c_Kinetis_Design_Studio_C_Users_Peter.png

my problem is, that following code always reaches the break statement which indicates that I can not read back the values I previously wrote from SDRAM.

#define SDRAM_BASE_ADD (0x8000000)

value = 0xabab;

     

      *((uint32_t*)(SDRAM_BASE_ADD)) = value;

     uint32_t readValue = *((uint32_t*)(SDRAM_BASE_ADD));

     if (readValue != value)

     {

     break;

     }

what am I doing wrong ?

I also noticed that the memory view in eclipse somehow freaks out when watching the SDRAM contents. It shows not whats expected. after the memset, i expect a large memory range to be 0x55.

2015_08_05_15_20_40_Debug_k65_benchmark_Sources_main.c_Kinetis_Design_Studio_C_Users_Peter.ru.png

0 Kudos
Reply
4 Replies

1,128 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Peter,

We have an application note about K65 SDRAM application on TWR-K65F180M board.

Please find and refer the AN5095 and related software.

Wish it helps.


Have a great day,
Ma Hui

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

0 Kudos
Reply

1,128 Views
peterruesch
Contributor IV

I'm trying to use Processor Expert to get my SDRAM running.

Can you check if I'm doing anything wrong ?

0 Kudos
Reply

1,128 Views
marek_neuzil
NXP Employee
NXP Employee

Hello Peter,

It seems that you have incorrect settings of SDRAM timing. I can see the refresh period on your screenshot only but there can be also another parameters set incorrectly. You can see the datasheet of the SDRAM silicon that is available on the TWR-K65F180M target board (see for example page Micron Technology, Inc. - MT48LC2M32B2P-5).

I have created a simple demo application (with Init_SDRAM component) that works properly on the TWR-K65F180M target board, see the attached archive. There is writing into SDRAM memory and reading/checking of the SDRAM memory content.

Best Regards,

Marek Neuzil

0 Kudos
Reply

1,128 Views
peterruesch
Contributor IV

Hi Marek,

thank you very much! I a appreciate your answer very much!

Thank you for providing the SDRAM exampel for Processor Expert! Did you do any perfomance measurements?

How much memset performance did you get?

I think the major problem I was facing was the one I'm describing in this post Init of FlexBus pins in SDRAM mdoe which you also answered :smileyhappy:

unfortunetely, I'm hitting the breakpoint instruction you built in if the comparison of memory contents fail :smileysad:

Did you face the same issue ?

SDRAM example compare fail.png

edit:

the breakpoint is triggered because the FelxBus pin muxing is not correctly done in the sdram pin init as i desribed in this post Init of FlexBus pins in SDRAM mode . Once you fix this, the test suceeds successfully. at lest for the sequence provided by your example

Best regards

0 Kudos
Reply