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.

TMS320F28075: DCSM and Flash API interaction

Part Number: TMS320F28075

Hi,

I am trying to implement the DCSM module and am running in to some issues with the TI Flash library F021_API_F2837xD_FPU32.lib.

To give some background info as to what settings I am trying to use from the DCSM: I am trying to secure all Flash & RAM regions to Zone 1 of the DSCM so I have set GRABMR & GRABSECT TO 0xAAAAAAAA in Zone 1 OTP. I want to enable PSWDLOCK so I have written a value other than all 1's to the PSWDLOCK register for Zone 1. As I mentioned, I am mainly interested in securing all Flash & RAM regions to Zone 1. I am running in to some trouble with the TI Flash API after I have secured Zone 1 with the options that I mentioned. To give a better idea here is a screen shot of my OTP ( I have a password set that is not all 1's, I have just blocked it out in the screen shot):

I am also doing dummy reads on all registers that are outlined in Zone1 under section 3.13.2 of the TRM as to not cause improper interactions with other modules on the TMS320:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void DummyReads(void){
uint32_t dummyVar = 0;
dummyVar = HWREG(0x703F0);
dummyVar = HWREG(0x78000);
dummyVar = HWREG(0x78004);
dummyVar = HWREG(0x78008);
dummyVar = HWREG(0x78010);
dummyVar = HWREG(0x78014);
dummyVar = HWREG(0x78018);
dummyVar = HWREG(0x7801E);
dummyVar = HWREG(DCSM_Z1_BASE + DCSM_O_Z1_LINKPOINTER);
dummyVar = HWREG(0x78030);
dummyVar = HWREG(0x78032);
dummyVar = HWREG(0x78034);
dummyVar = HWREG(0x78036);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am also attaching excerpts from the .map file for the file I am flashing so you can see where the library is located in memory:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
.TI.ramfunc
* 0 00086000 00000875 RUN ADDR = 00008000
00086000 00000259 F021_API_F2837xD_FPU32.lib : FlashStateMachine.obj (.text:__Fapi_setupFlashStateMachine)
00086259 0000019d : Program.obj (.text:_Fapi_issueProgrammingCommand)
000863f6 00000088 : Read.obj (.text:__Fapi_loopRegionForValue)
0008647e 00000042 : BlankCheck.obj (.text:_Fapi_doBlankCheck)
000864c0 00000034 : Init.obj (.text:_Fapi_initializeAPI)
000864f4 0000002e : Utilities.obj (.text:_Fapi_calculateFletcherChecksum)
00086522 0000002d : FlashStateMachine.obj (.text:__Fapi_issueFsmCommand)
0008654f 0000002c : Utilities.obj (.text:__Fapi_divideUnsignedLong)
0008657b 00000025 : FlashStateMachine.obj (.text:_Fapi_setActiveFlashBank)
000865a0 00000022 : FlashStateMachine.obj (.text:_Fapi_isAddressEcc)
000865c2 00000022 : FlashStateMachine.obj (.text:__Fapi_setupSectorsForWrite)
000865e4 00000020 : Async.obj (.text:_Fapi_issueAsyncCommandWithAddress)
00086604 0000001a : Utilities.obj (.text:_Fapi_waitDelay)
0008661e 00000016 : Read.obj (.text:_Fapi_flushPipeline)
00086634 0000000d : Utilities.obj (.text:__Fapi_scaleCycleValues)
00086641 00000001 --HOLE-- [fill = 0]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
page address name
---- ------- ----
0 00008642 _Fapi_GlobalInit
0 000084f4 _Fapi_calculateFletcherChecksum
0 00008659 _Fapi_checkFsmForReady
0 0000847e _Fapi_doBlankCheck
0 0000861e _Fapi_flushPipeline
0 000084c0 _Fapi_initializeAPI
0 000085a0 _Fapi_isAddressEcc
0 000085e4 _Fapi_issueAsyncCommandWithAddress
0 00008259 _Fapi_issueProgrammingCommand
0 000087c9 _Fapi_serviceWatchdogTimer
0 0000857b _Fapi_setActiveFlashBank
0 00008842 _Fapi_setupBankSectorEnable
0 000087cb _Fapi_setupEepromSectorEnable
0 00008604 _Fapi_waitDelay
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am also going to attach the code for the linker file that we are using:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
MEMORY
{
PAGE 0 : /* Program Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
/* BEGIN is used for the "boot to Flash" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002
RAMM0 : origin = 0x000122, length = 0x0002DE
RAMD0 : origin = 0x00B000, length = 0x000800
// RAMLS0 : origin = 0x008000, length = 0x000800
// RAMLS1 : origin = 0x008800, length = 0x000800
RAMLS0_1 : origin = 0x008000, length = 0x001000
RAMLS2 : origin = 0x009000, length = 0x000800
RAMLS3 : origin = 0x009800, length = 0x000800
RAMLS4 : origin = 0x00A000, length = 0x000800
RESET : origin = 0x3FFFC0, length = 0x000002
/* Flash sectors */
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

From what I can see, this library resides within the FLASHD region & runs out of the RAMLS0_1 region, both of which I have allocated to Zone 1. 

I also see that in the TRM it outlines the following in section 3.13.3.1:

"However, reprogramming devices that already contain a custom password require the password to be supplied to the Flash utilities in order to unlock the device to enable programming. In custom programming solutions that use the Flash API supplied by TI, unlocking the CSM can be avoided by executing the Flash programming algorithms from secure memory."

Because of this, to my understanding, I should be able to run these flash functions just fine without unlocking the TMS320 as they are in a secure zone that is allocated to Zone 1, but this has not been the case. Prior to locking the TMS320 I had no issues running these flash functions, but now that the TMS320 has been locked I can not seem to run some of the functions from this library without them failing (specifically the _Fapi_doBlankCheck function). Even after putting the TMS320 into the WAIT_BOOT state & running the code in a debugger after it has been unlocked I am now seeing these functions fail which is what is especially confusing to me as prior to locking the TMS320 these functions executed just fine. I even have other TMS320s that are unlocked that I have loaded the same code on to and it functions just fine. 

Does anyone have any clue as to why these functions would be failing after enabling the CSM & ECSL?

Thank you,

Thomas Hickey