AM2432: OSPI FLASH - Change Protocol Enable Configuration

Part Number: AM2432
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi,

Is there a way to use two different read/write commands regarding flash with OSPI controller?

My goal is use two different read/write commands, one for reading/writing one section of memory(standard way, let me say) and one for reading/writing SSR region(like OTP region). My flash provides these two different commands for these two sections and I need to use these two commands.

Regards

Stefano

  • Hi Stefano,

    Thanks for your query.

    So I am going to comment on your question based on MCU PLUS SDK AM243 offering.

    This is the flow.

    1. Let us say you are running a sample application like ospi_flash_io, like this: https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/10_01_00_32/exports/docs/api_guide_am64x/EXAMPLES_DRIVERS_OSPI_FLASH_IO.html
    2. For this application, when you open application's SysConfig, then you can head to the section named as OSPI and Flash.
    3. These two sections define major aspects:
      1. In OSPI section you can configure the frequency, clock divider, DMA mode and the lines to be used for the flash operations.
      2. In Flash section, we define the flash configurations like various erase/read/write.commands and sizes of flash, block and so on. We also define the mode of operation here, or you can say protocol, for example 1S-1S-1S or 8D-8D-8D. Note you have only one option to define here, not two.
      3. So when your application is run, then Drivers_open() is called post which Board_driversOpen() is called.
      4. Inside Board_driversOpen(), we initialize the flash configuration registers and the OSPI SoC Registers as well according to the values defined under the Flash section inside application's SysConfig.
      5. It also sets up the flash to operate in the protocol defined by us in the Flash section, hence the dummy cycles to read and write are defined and set in our OSPI SoC Configuration registers which start at 0xFC40000. You can check this from TRM.
    4. Due to all of this, changing to a different protocol is not feasible according to me, as it will require you to call Board_driversOpen again or just the low level API sequence which does the initialization of the SoC's OSPI registers based on the flash protocol chosen.

    The intent behind me writing this exhaustive step is to make sure you understand how the flow happens, else a top level answer would be a NO.

    The following questions are purely for my understanding purpose, so that I can know your system better.

    • Please let me know the frequency of these writes/read and how many times you want to switch between protocols?
    • How badly is this going to affect your use case if you do not happen to switch between the protocols as I mentioned in the above points.

    Looking forward to your response.

    Regards,

    Vaibhav

  • Hi, Vaibhav

    I think that I have to switch between protocols only few times, only for writing some parameters once device is built.

    In case the switch goes bad, parameters are written in wrong sections. It's not so bad, but it's not a correct behaviour.

  • Hi Stefano,

    Thanks for mentioning your usecase, let me check if I can make something work in this case.

    I would need to do a good bit of testing at my end to understand if with few changes as possible I can make your use case work.

    So please go ahead and tell me if the following flow looks good to you?

    1. Init flash to work in 1S-1S-1S mode
    2. Erase, write 128 bytes and read back 128 bytes from a known offset of the flash, lets assume 0x200000
    3. Reinit the flash to work in a protocol(other than 1S-1S-1S mode)
    4. Read the same 128 bytes with the current new protocol.

    Let me know if you want to modify any of the above steps or add some of your own?

    Please also note, this will be an effort at my end to check for the protocol switch, for which I am initially saying it will be a NO, But I can try to match your requirement if you allow me sometime to run through this.

    Regards,

    Vaibhav

  • Hi,

    From my point of view the protocol does not matter, but I need only to find a way to manage the two commands. 

    Flash and OSPI is configured in 8D-8D-8D because is used for other reasons(FW Update, save parameters and ecc..), but now i need to use another section of flash, more secure for some parameters.

    I think that your solution could be good, if i can change command and manage flash then in some way as configured now.

    Regards

  • Hi, 

    Thank you, I will try this switch protocol implementation and let you know.

    Regards,

    Vaibhav

  • Hi,

    Do you have any updates regarding this issue?

    Regards

    Stefano

  • Hi Stefano,

    I have seen the effort it requires to perform protocol switching implementation.

    Amidst other high priority issues, I cannot spend sometime to implement this. But I can suggest you the method so that you can go ahead and try it on your own.

    Please build a simple application like ospi_flash_io which comes with the MCU PLUS SDK installer and can be found under examples/drivers/ospi directory.

    Once you build it, go through one of the generated files named as ti_board_open_close.c.

    Here you will come across flash configuration values defined, for the specific protocol the user has set in the SysConfig. So the flash configuration values defined in this file, is tied to to a protocol and if you change the protocol, a whole new flash configuration value will be generated in this file. So you need to make sure that when switching protocols, make sure to change these configuration values for the new protocol you are about to ask the OSPI Controller and Flash to operate in.

    Here is a pseudocode:

    1. Drivers_open();
    2. Board_driversOpen();
    3. Now you have a protocol P1 defined and set, you do some operations with this using Flash_write and Flash_read.
    4. At this point you want to switch the protocol to P2.
    5. Board_driversClose();
    6. Drivers_ospiClose();
    7. Redefine the flash configuration values in the file ti_board_open_close.c to make sure the new values are at par with the protocol P2.
    8. Drivers_ospiOpen();
    9. Board_driversOpen();
    10. Now you perform Flash_write and Flash_read with new protocol P2.
    11. Board_driversClose()
    12. Drivers_close()

    Regards,

    Vaibhav