Based on example code provided in AN4466 I've written a simple memory calibration script for ARM DS-5 that runs same steps and prints out results for DQS, read and write calibration. This script can be run on new boards in order to find optimum calibration settings for the memory controller.
Prior to running this script it is necessary to run standard memory initialization script!
When bringing up new board:
- obtain default memory initialization script for memory type you're using (for example from DDR stress tester package) and modify the memory controller settings according to memory device you are going to use.
- run DDR stress tester with the given configuration on target frequency you're going to use to make memory works with given settings (default values for calibration are fine in most cases unless there's issues with PCB and/or routing).
- run memory init script and then the attached script to obtain calibrated values.