cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H730ZBT] FMC external SDRAM loses every second byte

sebxx4
Associate III

Continuation of this thread.

Hello, 

I've wired SDRAM (AS4C4M16SA-5TCN)  with STM32H730ZBT. Connection works, I can read/write data, but every other byte. 

Let's start with array declaration:

uint8_t *externalRAM = (uint8_t*)0xC0000000;
/* USER CODE END PV */

Then I'm trying to write some bytes to this array, ie:

externalRAM[0] = 0xAA;
externalRAM[1] = 0xAA;
externalRAM[2] = 0xAA;
externalRAM[3] = 0xAA;

  And to read it:

uint8_t test[4];
test[0] = externalRAM[0];
test[1] = externalRAM[1];
test[2] = externalRAM[2];
test[3] = externalRAM[3];

And this is the result:

sebxx4_0-1771264758670.png

Sometimes test[1] has 0xAA too, but mostly it's 0. I've tried to lower FMC frequency or change memory timings. What does this look like?

1 ACCEPTED SOLUTION

Accepted Solutions

Did you connect FMC_NBLx lines to SDRAM LDQM and UDQM pins?

If not I suspect you have the same issue described in this user’s thread.

So try to configure the SDRAM memory region as Device or Strongly-Ordered

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

15 REPLIES 15
mƎALLEm
ST Employee

Hello,

I'm not expert of SDRAM interface but probably it's a timing configuration issue of the SDRAM memory.

I may suggest to read this article on How to set up the FMC peripheral to interface with the SDRAM IS42S16800F-6BLI from ISSI it could be helpfull.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
sebxx4
Associate III

Well, I calculated these parameters using this article. 

sebxx4
Associate III

Maybe you Sir, @Tesla DeLorean could help?

EDIT:

When I do something like this:

*(__IO uint8_t*) 0xC0000000 = 0x01;
*(__IO uint8_t*) 0xC0000001 = 0x02;
*(__IO uint8_t*) 0xC0000002 = 0x03;
*(__IO uint8_t*) 0xC0000003 = 0x04;

uint8_t test[4];
test[0] = *(__IO uint8_t*) 0xC0000000;
test[1] = *(__IO uint8_t*) 0xC0000001;
test[2] = *(__IO uint8_t*) 0xC0000002;
test[3] = *(__IO uint8_t*) 0xC0000003;

It works fine:

sebxx4_0-1771346884799.png

It looks like some configuration problem. I have "16-bit byte enabled" option enabled, btw.

Did you connect FMC_NBLx lines to SDRAM LDQM and UDQM pins?

If not I suspect you have the same issue described in this user’s thread.

So try to configure the SDRAM memory region as Device or Strongly-Ordered

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Yes, I have both NBL lines connected.

Ok. Did you try setting the SDRAM memory space as Device or Strongly-Ordered?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
sebxx4
Associate III

Well, I don't know exactly what I did, but now it works.
I've resoldered NBL pins at uC side and memory side. I changed array declaration too:

volatile uint16_t* sdram = (volatile uint16_t *)SDRAM_BASE_ADDR;

And now it works fine, I can read/write 16-bit variables simply by: 

sdram[x] = x & 0xFFFF;

Hello,

What do you mean by "I've resoldered NBL pins at uC side and memory side."? incorrect GPIO config for NBL? or what?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

No, just make sure pins are soldered good ;) Maybe there was to little soldering tin.

Btw, I've just tested time needed to wrote whole memory and it's about 1800ms (per 4194304 writes), its about 433us per one write. Is it normal? I mean, I expected this memory to be faster. I want to use it to store audio data, so I have only ~22us per one sample to process it :\