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.
Hi Ti Team,
I'm using TMS570ls3137 demo board.
I enabled flashecc setting from Halcogen and use F021 API interface Fapi_issueProgrammingCommand(Fapi_AutoEccGeneration) to flash bank1, sector 0, 8 bytes, call _coreDisableFlashEcc before to do flash program check, I can see the data in the address is same as expected, then enable flash Ecc again. I checked ecc bit address 0xf0430000(for flash address 0x00180000) has been updated. The program continues, I refresh memory window, the error pin trigger. Do I need to program whole sector to avoid this pin trigger if I want refresh memory window? Thanks.
Hello,
When you erase the flash bank1, the flash ECC starting at 0xf0430000 are also erased. As the erase state of the flash is not a valid ECC condition, reading the flash content (memory browser) of un-programmed locations will trigger the un-correctable error.
Hello QJ,
More questions related to flash and eeprom.
CAN I use both Fee interface and f021 API in application?
I'm working on CAN bootloader, before I use F021 API to flash boot flag to bank1 sector0. Now I use f021 API put flag in bank7 sector0 to minimize code change in bootloader.
In application if I call FEE interface to flash boot flag, it store it in random address. I think it because of virtual sector and fee data structure. So I use f021 api to flash boot flag, fee interface to store other data. I change Fee settings in Halcogen like this. Is there any issue use both in application? Thanks.
Hello Judy,
There is no problem to use Bank7 this way. why don't you add the boot flag as one block of the FEE data? If you like to use 2 sectors as FEE, and other sectors as regular flash, it is also fine.
Hi QJ,
Yes, it is easy way to add boot flag as one block of FEE data in application. But in bootloader code, there is no Fee driver there, I didn't check how flash API read fee data structure. Could you please provide example? Thanks. BTW, the boot jumps to app works well, but app jumps to boot have to do power cycle, it looks software reset doesn't work. Any suggestion? Thanks.
Hello Judy,
To read FEE data, you need the FEE driver. There is no F021 Flash API for reading/writing FEE block data.
The SW reset should work. You can try to branch directly to 0x00 from your application.:
((void (*)(void))0x00000000)();
How do you initiate the SW reset? Here is the right way:
systemREG1->SYSECR = (0x10) << 14;
Hi Judy,
I am sorry for late response. The sections used in _copyAPI2RAM_() have to be defined in linker cmd file. you can use memcpy() to copy the code from flash to RAM:
extern unsigned int apiLoadStart;
extern unsigned int apiLoadSize;
extern unsigned int apiRunStart;
memcpy(&apiRunStart, &apiLoadStart, (uint32)&apiLoadSize);
Hi Judy,
I have been trying to reproduce the issue, but I am not lucky so far. I don't have any clue so far what causes this issue.
Can you please tell me dome details about the phantom Interrupt caused by the issue? What is the interrupt request number in VIM request register? Did you get data abort?
Hi QJ,
I have read SPNA063 about phantom interrupt. I notice the I and F flags both are set to 1 if the program is running in boot loader. But F flag is set to 0 and VIM IntReq2 value is 0x00200000 if program jumps from App to boot loader. I use FreeRTOS and CAN interrupt in App. I try to disable I or F interrupt or clear flag, but no luck.
Yes, I got data abort. Thanks.
Hello Judy,
For ARM Cortex-R4/5 microcontroller, the Program Counter (PC) always pointers two instructions beyond the current executed instruction.
For example , after the software (SVC) interrupt is received by the CPU, the CPU branches to 0x08 (SVC or software interrupt):
b #1FFF8
The branch offset must take account of the prefetch operation, which causes the PC to be 2 words (8 bytes) ahead of the current instruction.
The destination is PC + offset = 0x08 + 0x08 + 0x1FFF8 = 0x2008 --> which is the address of Software instruction in Application's Interrupt Vector table.
Hi Judy,
I tried couple times, and was not able to produce the issue.
Can you try memcpy() to copy the API to SRAM in your main()?
extern unsigned int api_load;
extern unsigned int api_size;
extern unsigned int api_run;
main(){
memcpy(&api_load, &api_run, (uint32)&api_size);
}
Hi QJ,
Thanks for your support. That works. I never thought this could be issues. If I change back to _copyAPI2RAM_(), the program stuck here. But if I use memcpy, the app can jump to boot no problem.
Why the function _copyAPI2RAM_() not working if program jumps from app to boot.
I am not sure what causes the issue. You can use memcpy instead since memcpy works for you. But I will figure out the root cause.