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.

AM2434: Simultaneous Use of PSRAM and Flash on TMDS243EVM Custom Board (Flash and RAM are connected in OSPI0)

Part Number: AM2434
Other Parts Discussed in Thread: TMDS243EVM, SYSCONFIG

Tool/software:

Hi,

We are evaluating the TMDS243EVM custom board, which features both OSPI flash and PSRAM controlled by a high-speed switch. We successfully tested the Beyond-SDK example for PSRAM.

Currently, we are trying to evaluate the simultaneous use of PSRAM and flash, as our application requires both RAM and flash during run time. To test performance, we created a demo code. However, we are facing issues managing the function calls such as Flash_open and Psram_open. Additionally, we noticed that different chip selects are used for RAM and flash. How should we manage this?

Is there any test application available to evaluate this scenario, or guidance on how to use both OSPI flash and RAM in an application?

  • Hi Anand, we will discuss this internally and come back to you

    thank you,

    Paula

  • Hi,

    Thanks for your patience.

    Additionally, we noticed that different chip selects are used for RAM and flash. How should we manage this?

    It is true that different chip selects will be used to address two different slaves. If not slave then two different parts like PSRAM and Octal/Quad NOR/NAND Flash.

    Did you expected both to be on the same chip select? I think that would be a wrong understanding.

    Once the above is clarified we can go onto differentiating between the following.

    However, we are facing issues managing the function calls such as Flash_open and Psram_open

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Thanks for your reply. I understand the use case of chip select, but for this particular custom board, we are using a high-speed switch to control both PSRAM and Flash. So, why do we need chip select? I've attached a screenshot for your reference.

    (Please check this link: Beyond-SDK/am243x/examples/ospi/ospi_psram_io/am243x-evm/r5fss0-0_nortos/Docs at main · TexasInstruments/Beyond-SDK · GitHub)

    Since the hardware uses two chip selects, we need to control them as well as the high-speed switch. Could you please explain how we can manage these two devices in the codebase?

  • In addition to that, as you are aware, in sysconfig we can configure only one chip select. Therefore, we need to configure the other chip selects manually

  • I will discuss this with Paula and let you know once I have further updates.

    Thanks,

    Vaibhav

  • Hi Anand,

    I had a quick discussion with Paula who had more context on this.

    I believe based on the schematics, when the switch happens, all the lines gets switched where:

    1. OSPI1_xxx is OSPI Flash
    2. OSPI2_xxx is PSRAM - OSPI RAM

    Could you please verify the steps you are doing between calling PSRAM open and Flash Open?

    I am assuming you are atleast doing the following:

    PSRAM open

    Switch logic

    Flash open

    Please correct my understanding.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    I will explain the steps of my test application:

    1. By default, in sysconfig, we configure CS0 for flash.
    2. We need to manually configure the other chip select pin (CS1) in main.c.
    3. First, we call the 250µs RAM test function (we are using freertos - two tasks were defined, one is 250us RAM test task, and another one is 2ms Flash test task), which selects the required chip select (CS1) for RAM. We need to control the I2C expander to set the MUX to low (Low = RAM). Then, we close the flash and open the PSRAM.
    4. Next, we call the 2ms Flash test function, which selects the required chip select (CS0) for Flash. We need to control the I2C expander to set the MUX to high (High = Flash). Then, we close the PSRAM and open the Flash. (Note: Psram_close() doesn't perform any actions; it simply returns.)
    5. Steps 3 and 4 will continue in a similar manner.

    We are following the above steps but facing an issue with the Flash_open() function. It always fails, causing the code to assert there. I suspect the problem is due to using OSPI0 for both flash and RAM and attempting to create instances, which seems to be disallowed.

    Can you please check this and help me out?

  • Hi Anand,

    When inside Flash_open, can you narrow down to where the error occurs?

    Can you step inside Flash_open() API and let me know where exactly the exception or the error is thrown.

    Please share screenshots if possible.

    Note:

    I also want a snippet of the config values as shown in the screenshot below.

    Take this snapshot when you enter the API Flash_norOspiOpen and then when you go to the line 

    Looking forward to your response.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Please check the below screenshots,

    1. config values:

    2. Screenshot at function - Flash_norOspiOpen

    The issue lies with the Flash_norOspiReadId() function, which consistently returns a failure, causing the Flash_open() function to fail as well.

    Screenshot:

    You can reproduce this issue with the specific EVM by first loading the PSRAM example code (which will work as expected). Then, without performing a power-on reset, try loading any flash example. I am using the ospi_flash_io_am243x-evm_r5fss0-0_nortos_ti-arm-clang example. You will notice that the example code fails to open the flash.

    (For this particular test, in the Flash_IO example code, I am closing the flash and driver, performing a system deinit, and then reinitializing everything. Despite these steps, it still does not work.)

  • Hi Anand,

    All the values which you have shown look absolutely correct.

    I want to ask one thing, what is the clock frequency and clock divider value you have set in OSPI section of the application's SysConfig?

    (For this particular test, in the Flash_IO example code, I am closing the flash and driver, performing a system deinit, and then reinitializing everything. Despite these steps, it still does not work.)

    Good to know about these steps to reproduce.

    Allow me sometime to work through this and reproduce.

    I will put you a status update as I progress on this.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    I have attached the screenshot of clock frequency and divider value of OSPI,

    Since I'm using the SDK example, I haven't made any configuration changes.

    I've been exploring some other E2E queries and came across this link.(Follwing with this LINK) It clearly states that it's not possible to use different memory devices within an OSPI interface. Can you please check these links?

  • In the OSPI example, I am not calling the IO expander function to switch, which might be causing the issue. Could you please check that aspect as well? I am performing a CPU reset from CCS before loading the OSPI example, assuming that would be sufficient. Please correct me if I am wrong.

  • Hi Anand, just curious, if you do it the other way around (first Flash example, then PSRAM) does it work?

    thank you,

    Paula

  • Yes Paula, it is functional.

  • Hi Paula and Vaibhav,

    I am able to switch between PSRAM and flash during runtime.

    As I mentioned earlier, each time I need to control the IO expander, close the flash (using flash_close() if I am using PSRAM), close the OSPI, reopen the OSPI, change the chip select, and then open PSRAM or flash (using Psram_open() or Flash_open()). I believe these steps are necessary for switching between the two. Could you please check if there is any way to optimize these steps?

    I have noticed that some delays have been added in the Psram_ospiOpen() function, with the delay amount being 500ms. Can you please check why such a long delay is needed? (I have seen this delay added in several places.)

  • I am able to switch between PSRAM and flash during runtime.

    As I mentioned earlier, each time I need to control the IO expander, close the flash (using flash_close() if I am using PSRAM), close the OSPI, reopen the OSPI, change the chip select, and then open PSRAM or flash (using Psram_open() or Flash_open()). I believe these steps are necessary for switching between the two. Could you please check if there is any way to optimize these steps?

    The same logic I was able to implement when I was on call with Paula, the only catch here was that I was reloading another application which does OSPI Flash operations and a seperate one for PSRAM. I see you have done it collectively.

    change the chip select

    Can you advise how you are doing this? I know how to switch the IO Expander 0x13 from 1 to 0, but then the CS1 is already defined in pinmux config file generated from SysConfig. How are you defining the CS0 in pinmux config file?

  • Ok vaibhav,

    I have attached the code snippet used for changing the chip selection. Please check it

    Drivers_ospiClose();
    Drivers_ospiOpen();
    //Select CS0 - for Flash
    regVal = CSL_REG32_RD(&pReg->CONFIG_REG);
    chipSelect = OSPI_CHIP_SELECT(OSPI_CS0);
    decSelect = OSPI_DECODER_SELECT4; 
    regVal &= ~(CSL_OSPI_FLASH_CFG_CONFIG_REG_PERIPH_SEL_DEC_FLD_MASK | \
    CSL_OSPI_FLASH_CFG_CONFIG_REG_PERIPH_CS_LINES_FLD_MASK);
    regVal |= (decSelect << CSL_OSPI_FLASH_CFG_CONFIG_REG_PERIPH_SEL_DEC_FLD_SHIFT) | \
    (chipSelect << CSL_OSPI_FLASH_CFG_CONFIG_REG_PERIPH_CS_LINES_FLD_SHIFT);
    CSL_REG32_WR(&pReg->CONFIG_REG, regVal);

    status = Board_driversOpen();

    For the pin configuration, I am using a separate function that will be called during system initialization. I have created a Pinmux_PerCfg_t struct variable, which consists only of the CS1 pin (L18). (I am using CS0 in sysconfig)

  • Hi Anand,

    Thanks for providing the update.

    Currently the open question is:

    for switching between the two. Could you please check if there is any way to optimize these steps?

    Yes this is required.

    I have noticed that some delays have been added in the Psram_ospiOpen() function, with the delay amount being 500ms. Can you please check why such a long delay is needed? (I have seen this delay added in several places.)

    I will check with Paula as to why these were added.

    Regards,

    Vaibhav

  • Hi Anand,

    I have tested the PSRAM open, close, writes, read and reset APIs without the sleep APIs and all the functions are successful.

    I have tested this for about 1000 cycles.

    Please remove/comment the sleep APIs and let me know the behaviour which you see.

    Regards,

    Vaibhav

  • Yes Vaibhav, we already removed these delays.