[Cryptech Tech] Alpha SDRAMs

Pavel Shatov meisterpaul1 at yandex.ru
Sun May 22 11:37:56 UTC 2016


Hello!

I got one of the Alpha boards from Fredrik and was busy trying to bring 
up the two on-board SDRAM chips. I believe, I finally have them working.

There turns out to be a stupid bug in low-level HAL code. Actually, 
there are in fact two similar bugs, that don't cancel each other out 
unfortunately.

In brief, our STM32 should have two independent SDRAM banks. When you 
start reading the fine print, you find out that they are not completely 
independent, i.e. they can only operate at the same frequency and share 
some of the timing parameters. This is not a problem itself, because we 
have two identical memory chips. The problem is that there are two 
configuration registers, the first register also controls some of the 
parameters for the second bank, therefore in the second register 
corresponding control bits are reserved. Sane person would configure the 
first bank, read its configuration register, mask reserved bits and 
write into the second bank. I believe this is what original 
FMC_SDRAM_Init() and FMC_SDRAM_Timing_Init() thought they were doing 
when they tried to configure the second bank, but those functions just 
messed up configuration of both banks instead.

Anyways, both external memory chips seem to work now. I uploaded simple 
test program, that basically fills entire memory with pseudo-random 
pattern, reads it back and compares with what was written.


-- 
With best regards,
Pavel Shatov


More information about the Tech mailing list