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'm porting some existing bare metal application to TI-RTOS. The chip we use is the F28M35H52C1.
The code has firmware upgrade feature which resets the CPU after programming new firmware by using SysCtlReset().
My question is; why is the SYSCTL_CAUSE_SW not set after it resets? This is specifically the case after programming the flash. If the flash programming routines are commented out and not called, the SysCtlReset() works fine and CPU resets correctly with the SYSCTL_CAUSE_SW set when it boots. However if the programming of flash is done, the CPU resets , but SYSCTL_CAUSE_SW isn't set. It gets stuck waiting for the C28. To get out of this I had to cycle the power, where the new programmed firmware will boot correctly.
As part of the start up code early in main(), the SysCtlResetCauseGet() is checked against a software reset SYSCTL_CAUSE_SW where it would send a reset to C28 and synchronise with the C28 startup. Code follows:
// In case of software reset, control and/or analog system need to be manually reset. if (SysCtlResetCauseGet () & SYSCTL_CAUSE_SW) { SysCtlResetCauseClear (SYSCTL_CAUSE_SW); unsigned long ulResetConf = SYSCTL_CONTROL_SYSTEM_RES_CNF | SYSCTL_ANALOG_SYSTEM_RES_CNF; SysCtlSubSystemReset (ulResetConf); } // Send boot command to allow the C28 application to begin execution IPCMtoCBootControlSystem(CBROM_MTOC_BOOTMODE_BOOT_FROM_FLASH);
What are your Boot module settings in your SYS/BIOS cfg file? I'm wondering if there's maybe some conflict between what SYS/BIOS is doing to try to Boot the device and what your application code is doing.
Whitney
Here is the condensed cfg. I don't see any boot configs. It was basically taken from a min project.
var Clock = xdc.useModule('ti.sysbios.knl.Clock'); Clock.tickPeriod = 10; var Defaults = xdc.useModule('xdc.runtime.Defaults'); Defaults.common$.namedModule = true; var Error = xdc.useModule('xdc.runtime.Error'); Error.policyFxn = Error.policyDefault; Error.raiseHook = Error.print; Error.maxDepth = 2; var halHwi = xdc.useModule('ti.sysbios.hal.Hwi'); var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); halHwi.checkStackFlag = true; m3Hwi.enableException = true; m3Hwi.nvicCCR.DIV_0_TRP = 0; m3Hwi.nvicCCR.UNALIGN_TRP = 0; var Idle = xdc.useModule('ti.sysbios.knl.Idle'); var BIOS = xdc.useModule('ti.sysbios.BIOS'); BIOS.assertsEnabled = true; BIOS.heapSize = 1024; BIOS.includeXdcRuntime = false; BIOS.libType = BIOS.LibType_Custom; BIOS.runtimeCreatesEnabled = true; BIOS.logsEnabled = false; var Memory = xdc.useModule('xdc.runtime.Memory'); if (!Program.build.target.$name.match(/iar/)) { Program.stack = 768; } if (Program.build.target.$name.match(/gnu/)) { var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport'); } var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); Semaphore.supportsPriority = false; Semaphore.supportsEvents = false; var Swi = xdc.useModule('ti.sysbios.knl.Swi'); var System = xdc.useModule('xdc.runtime.System'); System.abortFxn = System.abortStd; System.exitFxn = System.exitStd; System.maxAtexitHandlers = 2; var SysMin = xdc.useModule('xdc.runtime.SysMin'); SysMin.bufSize = 128; System.SupportProxy = SysMin; var Task = xdc.useModule('ti.sysbios.knl.Task'); Task.checkStackFlag = true; Task.defaultStackSize = 512; Task.enableIdleTask = true; Task.idleTaskStackSize = 512; Task.numPriorities = 16; var Text = xdc.useModule('xdc.runtime.Text'); Text.isLoaded = true; var Types = xdc.useModule('xdc.runtime.Types'); var mwConfig = xdc.useModule('ti.mw.Config'); var driversConfig = xdc.useModule('ti.drivers.Config'); driversConfig.libType = driversConfig.LibType_NonInstrumented;
Also I do not think it is related to boot options because the issue happens when flashing an existing (working) bare metal firmware too. So that's not booting into an rtos app.
It should be using the default Boot module settings then. I also did a quick search through the SYS/BIOS code and didn't see it doing anything to potentially clear the reset cause.
What is SysCtlResetCauseGet returning in this scenario? Just 0? Where exactly in IPCMtoCBootControlSystem() is it getting stuck? What is the C28x doing?
Whitney
Apparently nothing to do with reset cause. I still have the issue but it's more to do with optimisation. If everything was sitting at optimisation setting 0 (register), it's all working nicely (fw updates to rtos or bare metal versions). The moment I up the optimisation to 1 (Local) or higher , the the firmware update and reset procedure would brick after the reset. Is the problem pre-update or post-update is very hard to diagnose. The moment cpu resets after the fw flash, the debugger is lost.
I would like to think I can fix it pre-update, because all existing versions of bare-metal firmware has higher optimisation that will brick when attempting to update the fw to.
Strange thing is whatever target fw I was attempting to flash to is successful. It just needed a power cycle.
Just an update. I did resolve my issue. Turns out my SysCtlReset() wasn't in ram.