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.

Using DATA_SECTION and OTP

Other Parts Discussed in Thread: UNIFLASH

I was thinking of doing the following to store a constant into OTP. I was wondering when the value gets written. Is during writing to the flash or loading of the program? If the location is already written, and if I have another program that tries to write a different value, will the write fail gracefully. i.e. in the debugger, I get load fail.

In linker file:

DDCID : > OTP, PAGE = 0

In code:

#pragma DATA_SECTION(DDCID, "DDCID")

const Uint16 DDCID = 0x4DDC;


We are developing a feature where we have 2 cards on a CAN bus, and we want to write into OTP something different for each card so that the operator can't inadvertently load the wrong program into the card.

  • Hello Charles,

    0x4DDC is written to a specific location in OTP when you program the part.  That specific location can only be programmed once.

    Don't create the constant in OTP. Define a variable that points to a specific OTP address (i.e. Uint16 * DDCID = 0x00380400).  Then program that address using a debugger or some other tool.

    Stephen

  • Thanks for the reply. But I don't think that would help us. We would like to program the address when the unit is being tested. The technicians doing the test would not be qualified to do this with a debugger.

  • What about using the bootloader (already on the chip) to only program a specific OTP address or addresses?   You can create a hex file that only writes to that or those address.  The hex file can be updated with some type of scripting tool.  

  • You could also write a complete program with a GUI interface that communicates with the bootloader.
  • Our process is to make a hex file and have the technician use Uniflash to JTAG the card.

    Editing the hex file would be an option. I have seen it mentioned but we don't know how to do that. also, got your post regarding GUI. Sorry. don't know how to do that either.

    Any pointers would be helpful. Thanks.
  • To create the initial Hex file, create a simple project that only writes to a specfic address and then use the C2000 Hex Utility (in the project properties) to create the hex file.
  • Create a simple Hex file, as I previously mentioned.  Go on the web an find the hex file format (I think it should be Intel HEX).  Then, learn just enough Python so your python program can get input from a user and write to a file.  Or you can write a simple C/C++ program in the free visual C++ express version.  That might be easier since you know c language.  Then, code the program so that it outputs exactly what the initial hex file looks like with the exception of the values located at the specific address.  Your program will also need to update the end of line checksum.

  • Hello Charles,

    Did my post answer your question?

    Stephen