Can't write to SDRAM (16-bit vs 32-bit)

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

Can't write to SDRAM (16-bit vs 32-bit)

3,798 Views
KRichard
Contributor II
Hello I have a problem. I am using an MCF5373L ColdFire MPU with a EDS2516AFTA (16M words × 16 bits) SDRAM and when CodeWarrior tries to write my software into the SDRAM I get an error saying:

----

Memory Write Verify Failure

Memory Write to address 0x40000480 failed to verify: Expected value: 0x4001aa60 Actual value: 0xaa60 Retry?

----

I think (beware, I have almost zero experience in this matter) the problem is that CodeWarrior handles this module as it would be 32bit, while it is a 16 bit module (as you can see from the error message, the lower 16bit is OK).

Any hints?

I can read/write the module from Tools -> Hardware diagnostic fine.

Thanks.
Labels (1)
0 Kudos
Reply
4 Replies

1,389 Views
JWW
Contributor V
KRichard,

I had one quick thought when I read this.  And I hope it is not bad news.  :smileysad:

You appear to be using SDR memory.  And you stated that it is 16 bit wide.  My assumption is that you did use two of these memories to form a 32 bit wide bus in SDR mode.  At least I hope you did...

See note in user's manual: Page 18-6

NOTE
When the SDRAMC is configured to support an external 32-bit data bus. It
is not possible to connect a smaller device(s) to only part of the SDRAM’s
data bus. For example, if 16-bit wide devices are used, then user must use
two 16-bit devices connected as a 32-bit port.



And yes.. Codewarrior does default to what is configured in the MEM file for the type of transaction that is performed in a given address range.  This mem file is just a text file that allows you to set up different types of transaction types (port sizes) for numerious address ranges.


Let me know if I mis-understood your problem.

-JWW



0 Kudos
Reply

1,389 Views
KRichard
Contributor II
Hello JWW, first I would like to thank you for taking the time to participate in this thread, your suggestions are most welcome! :smileyhappy:

Yes, my board has a single 16 bit SDR memory module and a 16 bit flash (but I think the latter doesn't count in this matter).

I am using a custom-made MCF5373 based board, I only do the software part, another student designed the hardware.

What I want to do: make CodeWarrior upload my code into the SDRAM and run it from there (it works from the internal SRAM). I know that there can be lots of things I don't know about, please feel free to point out mistakes / misunderstandings in my thinking.

What I did:

- I configured the external bus width to 16 bit via the .CFG file, the relevant source line is:
writemem.l 0xFC0B8004 0xC1082002 # SDCR config

- I also modified the memory configuration .MEM file, I added:
range 0x40000000 0x41ffffff 2 ReadWrite # 16 bit SDRAM

Unfortunately I don't understand how CodeWarrior uploads the data (and I haven't found any documentation about it yet).

I think this (or something like this) should happen:

- CodeWarrior uploads a 32bit value like 0x12345678, the SDRAM controller writes that value into the SDRAM as two 16bit value, 0x1234 and 0x5678;

- CodeWarrior fetches a 32 bit value to verify, the controller fetches two 16bit values (0x1234 and 0x5678), assembles it into a 32 bit value (0x12345678) then gives it to CodeWarrior;

- CodeWarrior sees that the write was successful and repeats;

Clearly it doesn't happen that way, I conclude from the error message (see my first post in the thread) that CodeWarrior tries to upload a 32bit value into SDRAM, but upon verifying it receives back only one half of the data. Like it tries uploads 0x12345678 then downloads only 0x00005678.

What may be my mistake?

Thanks in advance, Richard
0 Kudos
Reply

1,389 Views
JWW
Contributor V
KRichard,

Any further luck with your SDRAM problem?  I've been away for awhile and couldn't look at your issue.

If you are still struggling, can you share the pseudo code for how you init the SDRAM controller?  Or just attach the MEM file and CodeWarrior CFG file to your next post?

It may actually be a problem in the CFG file.


-JWW


0 Kudos
Reply

1,389 Views
KRichard
Contributor II
Dear JWW,

Thank you, the problem is solved. It was a miscommunication issue between me and the fellow student, the board was designed in a way that I must handle it as a 32 bit memory but only use the lower 16 bits. I assume, that with a self-imposed design limitation like that he was able make the board simpler, or something like that. So I can only use the SDRAM for data storing, I can't run code from there.

I have contacted Freescale support about this issue and got some prompt help with troubleshooting pretty fast, it was cool. I thought they would not respond to a silly problem of a "random no one", I was pleasantly surprised, kudos to Freescale.

Running code from Flash memory works, so I am very happy actually. :smileyhappy:

Richard
0 Kudos
Reply