2026-02-16 10:00 AM - last edited on 2026-02-16 11:19 AM by mƎALLEm
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:
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?
Solved! Go to Solution.
2026-02-17 11:30 PM - edited 2026-02-18 3:52 AM
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
2026-02-16 11:59 AM
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.
2026-02-16 8:12 PM
Well, I calculated these parameters using this article.
2026-02-17 8:41 AM - edited 2026-02-17 8:49 AM
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:
It looks like some configuration problem. I have "16-bit byte enabled" option enabled, btw.
2026-02-17 11:30 PM - edited 2026-02-18 3:52 AM
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
2026-02-18 6:51 AM
Yes, I have both NBL lines connected.
2026-02-18 6:54 AM
Ok. Did you try setting the SDRAM memory space as Device or Strongly-Ordered?
2026-02-18 7:12 AM
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;
2026-02-18 7:14 AM
Hello,
What do you mean by "I've resoldered NBL pins at uC side and memory side."? incorrect GPIO config for NBL? or what?
2026-02-18 7:21 AM
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 :\