cancel
Showing results for 
Search instead for 
Did you mean: 

How to safely create a DDR definition file for HAL?

cbcooper
Senior

I've inherited a board that is based on an STM32MP135AAE3 and has an external DDR (W63AH6NBVABI, a DRAM 1Gb LPDDR3 from Winbond).  It appears I need to create a DDR.h file similar to the stm32mp13xx-ddr3-4Gb.h or stm32mp13xx-ddr3-8Gb.h files that STM provides (right?)  

 

I've taken the existing stm32mp13xx-ddr3-4Gb.h and am slowly going through, figuring out exactly what each line needs and then trying to track down the appropriate information from the DDR datasheet.  My biggest concern is that I get the timing ALMOST right and end up with a DDR that works 99.99% of the time (failing, of course, only at customer sites).

 

1) Is there an archive of DDR definition files somewhere that I missed?

2) Is there a better way to generate this DDR definition file?

3) Is there a way to test I did it right besides running various memory tests for days and days?

 

As an example, this file needs information like this:

// DDRCTRL SDRAM timing register 0

/*

Name Bits Meaning

---- ---- -------

WR2PRE 30:24 Minimum time between write and precharge to same bank

T_FAW 21:16 tFAW Valid only when 8 or more banks(or banks x bank groups) are present.

In 8-bank design, at most 4 banks must be activated in a rolling window

of tFAW cycles.

T_RAS_MAX 14:8 Maximum time between activate and precharge to same bank

T_RAS_MIN 5:0 Minimum time between activate and precharge to the same bank.

*/

 

2 REPLIES 2
PatrickF
ST Employee

Hi @cbcooper 

I think this is a current limitation on CubeMx. Meanwhile, you should use CubeMX creating a 'dummy' STM32MP135A Linux project with your DDR config.

Then in the device tree generated files, you could copy the .dtsi file and rename it in .h

 

Regards.

In order 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.
NEW ! Sidekick STM32 AI agent, see here

I created a project in CubeMX, set all the DDR parameters, and said Create Project.  It created an IOC file with lines like this:

DDR.DRAMTMG0=0x121B2418
DDR.DRAMTMG1=0x00040527
DDR.DRAMTMG14=0x0000004A
DDR.DRAMTMG2=0x05090C0F
DDR.DRAMTMG3=0x00A0B00C
DDR.DRAMTMG4=0x0B04070D
DDR.DRAMTMG5=0x02020808
DDR.DRAMTMG6=0x02020006

which certainly looks hopeful, but no .dtsi file and no other file containing the text DRAMTMG at all