[SOLVED] Writing Stm32f401 one time programmable bytes

  • [SOLVED] Writing Stm32f401 one time programmable bytes

    I would like to be able to program the one time programmable (OTP) bytes of the stm32f401 in addition to its flash memory using Jlink commander or jflash by supplying a single hex image. The OTP bytes of the stm32f401 are in the 0x1fff7800-0x1fff7a10 range. Is this possible? I have tried multiple times with Jlink commander but when I read back the OTP memory it is untouched. We have some serial numbers stored in this range and for production purposes it would be nice to give the factory a single hex image containing both code and the serial data.

    Thanks for your help!
    Tom
  • Hi,

    Basically, programming the OTP area is doable using J-Link Commander but many read / write access to special function registers (flash controller) are necessary. Native support, so that download via loadbin / loadfile command is possible, is not support yet. We are currently working on an extension called open flash loader which allows users to add their own flash loaders. This would allow to add a flash loader which handles the OTP area programming.

    Other options:
    a) Write and download a small RAMCode + the OTP data to be programmed into RAM using J-Link Commander. Set the PC / SP to the beginning of the RAMCode, set a breakpoint at the end address and let the RAMCode run.
    b) The J-Link SDK which can be used to write your own application using the J-Link API. For further information regarding the J-Link SDK, please refer to segger.com/jlink-sdk.html
    c) Program the OTP area from within the application running in the flash (e.g. the firmware)
    The required steps that needs to be performed to program the OTP area are described in the ST STM32F4 programming manual.

    Apart from this, I will discuss internally if we have any plans to implement native support for programming the OTP area.


    - Erik
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Erik,

    Thanks for the update. I would be very interested in both native support for programming the OTP area and in the ability to add my own flash loader. I really hope you are able to add these in a future update.

    In the meantime, I will investigate the other options that you list.

    Thanks again for your assistance,

    Tom
  • Hi Tom,

    If you run into any issues or need any assistance, pleas let me know.
    Should we add you to the J-Link software and update notification list, so that you will get informed automatically about new versions?


    - Erik
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • The feature is still not available. Too many other open paid projects / projects with higher priority.

    Anyhow, we have released the opener flash loader concept in V5.41d which allows customers / vendors to add / use the J-Link DLL with their own flash loaders.
    Using this feature, you can easily add support for the OTP area on your own.

    The new version comes with an updated J-Link documentation that explains the process of adding support for a new device / flash bank.
    The process is explained in chapter 10 "Adding support for New Devices"

    segger.com/jlink-software-beta-version.html


    Best regards
    Erik
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.