This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] MCU-PLUS-SDK-AM243X: How to use Tune PHY with MCU_PLUS_SDK for OSPI Controller ?

Part Number: MCU-PLUS-SDK-AM243X

Q1. How to tune PHY with MCU_PLUS_SDK ?

Q2. Why is PHY tuning required ?

  • Traditionally, the OSPI controller without PHY can work at 50MHz STR mode and 25MHz DTR mode.
    Due to requirements to read flash at much higher speed, the user can configure the controller at higher speed where PHY allows more flexible and power efficient transfers.

    AM243x supports up-to 166MHz OSPI controller clock if PHY is enabled. But to enable the PHY, it is required to be tuned based on the Custom Board trace, Flash part used, Protocol used, STR/DTR mode enabled, Clock frequency of the controller, Dummy cycles configured etc.

    Please follow the fore mentioned steps to tune the PHY in more efficient manner. We are taking MX25U51245G to follow the changes.

    Also perform this experiment in dev-boot mode so the flash is not pre-configured by RBL or SBL. For more information on dev-boot mode system initialization - 

    Step 1

    Import OSPI-FLASH-IO Project. It will show enabled Flash and OSPI.

    Step 2

    Configuring the MX25U to support 4S-4D-4D mode at 25MHz and test it to be functional.

    Refer to the FAQ - https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1230063/faq-mcu-plus-sdk-am243x-faq-how-to-debug-develop-migrate-the-flash-driver-for-custom-flash-on-non-ti-evm-ospi-xspi

    Step 3

    Configure the clock in OSPI mode and enable the PHY.

    Note : When the PHY is enabled, the Input Clock Divider is ignored. So in this configuration even if the PHY Enablement fails, the clock is still 25MHz which is safe zone for DTR mode.

    The maximum configuration supported according to datasheet is 100MHz in DTR mode for MX25U512 Flash.

    Step 4

    Add software in ospi_flash_io project - ospi_flash_io.c – ospi_flash_io_main

    Creating a global variable of phyTuneArray as follows -

    Add function to the main function.

    Step 5

    Run the example with Debugger connected. The intent is to get a dump of the array created i.e. phyTuneArray

    This array is of 4*128*128 i.e. 64KB. Also the program execution time might take maximum 2-3 minutes.

    Step 6

    Save the array in form of binary like this -

    Step 7

    Use a simple matplotlib to generate the graph for the data captured.

    This is just a reference tool to generate the plot - /cfs-file/__key/communityserver-discussions-components-files/908/phy_5F00_tuning_5F00_graph_5F00_analyzer-_2800_1_2900_.py

    This tool will generate something like this -

    This graph can give 4 color data -

    1. Red indicating rdCaptureDelay as 0
    2. Blue indicating rdCaptureDelay as 1
    3. Green indicating rdCaptureDelay as 2
    4. Pink indicating rdCaptureDelay as 3

    Step 8

    Select the most optimum region like most center region of the graph.

    The x-axis is txDll and the y-axis is rxDll. As the graph is blue.

    So in this case,

    • txDll = 46
    • rxDll = 81
    • rdCaptureDelay = 1

    Step 9

    Modify the Flash_norOspiOpen function to add the OSPI_PhyConfig params configuration, enable the PHY and disable the PHY Pipeline.

    Make sure to skip the PHY Tuning Algorithm as this is not required if the data is manually added by the user.

    A copy of the file is added for reference (valid for 08.06 release, may change in future) -

    flash_nor_ospi.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    /*
    * Copyright (C) 2021 Texas Instruments Incorporated
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the
    * distribution.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Step 10

    Try the ospi_flash_io example by removing the OSPI_PhyGrapher from the program flow. Now your PHY is enabled which allows OSPI controller at 100MHz.


    Special Notes :

    • Repeat this experimentation with working read dummy cycle configuration up to ± 2 cycles if you are not able to get an valid plot data.
    • The PHY characteristic and graph may vary based on board design, temperature, power etc. SDK does the tuning on every reset cycle to cater to all temperature ranges and is recommended for every reset cycle.
    • To support all conditions, user must verify and plot the graph on the extreme conditions and select the value accordingly.
    • PHY enablement is only required during read operations. Hence PHY is enabled only during Flash Read functions and disabled after the same. Make sure the PHY is not enabled whenever the Flash_writes are called.