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,
I am trying to do a custom CAN bootstrap. It is based on the hercules can download sample source for the r48 processor. I am using CCSv6 with optimization turned off.
I got the can stuff working (with the flash erasing/writing commented out).
Now I am trying to actually flash, which is the reason for the bootloader to exist.
The problem is when I run the HERCULES program it hangs and when I pause it, the PC is in the asm vector tables. The fault instruction address is 0x10, so no help pinpointing the failure. Putting a breakpoint on the vector does not give any better indication of the failure.
The weird thing is if I do a system reset and single step into the f021 library, the trap does not happen and the flash does get erased and later written. And yes I single step into the ram code in my case at 0x0800_a588... Stepping takes a very long time and lots of cycles, but I have single stepped through writing 3 16 byte blocks into flash at 0x20000+. At any time in this process if I tell ccsv6 to "go" the processor ends up hung in the vectors. So either ccsv6 on jtag alters enough processor state to "fix" the abort problem, or there is a speed problem in the r46 configuration.
Any ideas?
Is it possible to get the source for the library so I can try putting in some test delays etc?
Thanks, Steve
Good idea. I will try to build a simple test project that will be easier to debug.
Regards, Steve
Hi QJ,
No, I cannot tell where it aborts.I think it always fails in the ram based library.
I have not been able to tell from the registers. In the link reg it has 20014 which is where it was flashing starting at 0x20000
I am not sure how to decode all the abort info, so here is what I think are the interesting core and cp15 registers.
Hello Steve,
I copied your code to my project and it can erase and program the flash without any problem.
The flash operation code should be placed and executed in SRAM rather than flash. _copyAPI2RAM_() in sys_startup.c is used to copy those code into SRAM.
Regards,
QJ
Hi QJ,
Thanks, I hope it will work.
Like I said it will work for me if I just single step through the code. And yes ccsv6 will single step up into the RAM where the library is available for disassembly. So maybe a problem in some kind of speed setup?
Did you test on a rm46x processor? My crystal is 16Mhz so I assume the library setup the other clocks as it likes (I think it was 160Mhz). Also I assume the library handles flash wait state setups.
Did you start with the code in spna183.zip ?
I am not sure where I got the f021_api, I think it was pre-built in some monster halcogen zip file.
Steve.
Hi QJ,
I am confused about the visible parts of the library and the RM46x 16 32 Bit TRM spnu514b.pdf -
Your library uses:
C:\Users\scalfee\scalfee_1\scalfee_1\Triton\main\Ctl\SafetyMCU_Bootloader\inc\F021_API\Constants.h:
49 #define F021_FLASHECC_MAP_END 0xF04FFFFFU
50
51: #define F021_CPU0_REGISTER_ADDRESS 0xFFF87000U
52
53 /* Specific TI OTP Offsets */
C:\Users\scalfee\scalfee_1\scalfee_1\Triton\main\Ctl\SafetyMCU_Bootloader\inc\F021_API\Registers.h:
74 #define FWP_WRITE_OFFSET 0x120U
75 /* Macro that creates a byte accessor pointer to the FWPWRITEx registers */
76: #define FWPWRITE_BYTE_ACCESSOR_ADDRESS ((FwpWriteByteAccessorType*)(F021_CPU0_REGISTER_ADDRESS + 0x120U))
77 /* Macro that creates a byte accessor pointer to the FWPWRITE_ECC register */
78: #define FWPWRITE_ECC_BYTE_ACCESSOR_ADDRESS ((FwpWriteByteAccessorType*)(F021_CPU0_REGISTER_ADDRESS + 0x140U))
79 /* Macro that creates a dword accessor pointer to the FWPWRITEx registers */
80: #define FWPWRITE_DWORD_ACCESSOR_ADDRESS ((FwpWriteDWordAccessorType*)(F021_CPU0_REGISTER_ADDRESS + 0x120U))
But the trm does not talk about registers at offset 0x120 from the flash base a fff8_7000
In fact it skips them altogether. From page 279
FFF8 706Ch FDIAGCTRL Diagnostic Control Register Section 5.8.26
FFF8 7070h FRAW_DATAH Uncorrected Raw Data High Register Section 5.8.27
FFF8 7074h FRAW_DATAL Uncorrected Raw Data Low Register Section 5.8.28
FFF8 7078h FRAW_ECC Uncorrected Raw ECC Register Section 5.8.29
FFF8 707Ch FPAR_OVR Parity Override Register Section 5.8.30
FFF8 70C0h FEDACSDIS2 Flash Error Detection and Correction Sector Disable Register 2 Section 5.8.31
FFF8 7288h FSM_WR_ENA FSM Register Write Enable Section 5.8.32
FFF8 72A4h FSM_SECTOR FSM Sector Register Section 5.8.33
Maybe you can shed some light on the actual situation on my SOC?
Thanks, Steve
Hi Steve,
Attached is the project I used for test on RM46x launchpad. I used f021 API v02.01.01 too. The Flash API is located at C:\ti\Hercules\F021 Flash API\02.01.01
Regards,
QJ
HI QJ
I am still trying to get this to build. I finally figured out how to load the exact compiler version the project required.
Now I cannot find the required RTS library used in your project "rtsv7R4_A_le_eabi.lib". This exists in the older compiler but not in 16.6? So the linking fails.
I am using ccs Version: 6.2.0.00050
Regards, Steve
Hi Steve,
Attached please find the CAN bootloader with your code in the while(1) loop. It works well for step over and one time execution. The bootloader uses flash API rev 2.01.01, and the library is located at C:\ti\Hercules\F021 Flash API\02.01.01
Regards,
QJ
Hi QJ,
Is this zip different from the one you send earlier? I was also able to get the test code to run.
Thanks, Steve
Hi Steve,
The only difference is that the new zip project uses the header files and Flash API in installation folder (c:\ti\hercules\...) rather than the files and lib in bootloader folder. And the new zip doesn't include other bootloaders (SPI, UART, etc).
Regards,
QJ
Hi QJ,
I have things working pretty good now.
I did notice a bad instruction trap on rm46.
If I call Fapi_BlockErase(0, pagealignedaddr, 1) I get a bad inst trap.
If I call it with Fapi_BlockErase(0, pagealignedaddr, 0x400) it works.
Neither 1 or 0x400 is the page size, so it is somewhat surprising. However I give the workaround. Consider this a bug report.
Regards, Steve