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.

TMS320F280025C: Watchdog problem : don't set reset

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE, UNIFLASH

Hi,

I have a problem with the watchdog reset, I have configured it to trigger a target reset. In my initialization phase, I turn on and off a led to visualize my passage through this phase. The reset is set to a time of 419ms. I also have an ADC interrupt configured for my application, but when I don't reset the counter, I can see the RST pin go to 0, proof that the reset has taken place (duration 50µs at low state). However, I don't revisit my initialization toogle led, so the reboot doesn't work. So I'm missing an element of understanding. Can you please help me?

In another test phase, when I use the ServiceDog() function to reset the counter in my main loop, I only go through the interrupt once, but I still stop in my main loop. The counter increments WDCNTR and is reset to 0 when the servicedog function updates the WDKEY register. So that's strange too. What's the problem, please?

Here my

void init_watchdog(void)
{
    // Reset the watchdog counter
    ServiceDog();
    // Configure timings to set reset for software watchdog, PREDIVCLK = INTOSC1 / Pre-divider and WDCLK = PREDIVCLK / Prescaler
    // With INTOSC1 = 10 MHz, WDCLK = 2441.4 / 4 = 610.35 Hz, 1 tick -> 1/610.35 = 1.638ms and counter is on 8 bits so 256 ticks -> 419 ms
    // XRS pin is low for 512 OSCCLK cycles so 512 * (1 / 10.10^6) = 51µs
    // Pre-divider = 4096
    EALLOW;
    //WdRegs.WDCR.bit.WDCHK = 0x5
    //WdRegs.WDCR.bit.WDPRECLKDIV = 0x3
    // Prescaler = 4
    //WdRegs.WDCR.bit.WDPS = 0x3
    WdRegs.WDCR.all = 0x032B;

    // Counter expiration triggers a reset, this is the default state on the power-up and after any system reset.
    // Write to the whole SCSR register to avoid clearing WDOVERRIDE bit
    WdRegs.SCSR.all = 0;
    EDIS;
}
#pragma CODE_SECTION(adc_isr, ".TI.ramfunc");
__interrupt void adc_isr()
{
    EALLOW;


    // Clear INT1 flag.
    AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    // Check if overflow has occurred.
    if(AdccRegs.ADCINTOVF.bit.ADCINT1 == 1)
    {
        // Clear INT1 overflow flag
        AdccRegs.ADCINTOVFCLR.bit.ADCINT1 = 1;
        // Clear INT1 flag
        AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
    }
    // Acknowledge PIE group 1 to receive more interrupts from this group.
    PieCtrlRegs.PIEACK.bit.ACK1 = 1;
    EDIS;
}
 code :
int main(void)
{
    // PLL initialization and load the code in flash memory by the pre defined symbols include in Project -> Properties -> Pre defined symbols _FLASH to execute the flash initialization.\n
    // MemCpy to copy the code in RAM.
    InitSysCtrl();

    // Read reset cause register to know which reset is the cause (external or software watchdog)
    if(CpuSysRegs.RESC.bit.WDRSn == true)
    {
        // Indicates reset cause : software
        reset_status = 1;
        // Reset flag in cause register
        CpuSysRegs.RESCCLR.bit.WDRSn = true;
    }
    else if(CpuSysRegs.RESC.bit.XRSn == true)
    {
        // Indicates reset cause : external watchdog
        reset_status = 2;
        // Reset flag in cause register
        CpuSysRegs.RESCCLR.bit.XRSn = true;
    }

    // GPIO initialization
    gpio_init();

    GpioCtrlRegs.GPAPUD.bit.GPIO8 = 1;          // Disable the pullup on GPIO8
    GpioCtrlRegs.GPADIR.bit.GPIO8 = 1;          // GPIO8 = output
    GpioCtrlRegs.GPAODR.bit.GPIO8 = 0;          // Normal output not open drain
    GpioCtrlRegs.GPAQSEL1.bit.GPIO8 = 0;        // Synchronous
    GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0;         // GPIO8 = GPIO8
    GpioDataRegs.GPASET.bit.GPIO8 = 0;          // Force output data latch to high level.
    GpioDataRegs.GPADAT.bit.GPIO8 = 0;          // Set output value

    GpioDataRegs.GPADAT.bit.GPIO8 = 1;          // Set output value
    DELAY_US(2000000);
    GpioDataRegs.GPADAT.bit.GPIO8 = 0;          // Set output value

    // Disable CPU interrupts.
    DINT;
    // Initialize the PIE control registers to their default value.
    InitPieCtrl();
    // Disable CPU interrupts and clear all cPU interrupt flags.
    IER = 0x0000;
    IFR = 0x0000;
    // Initialize the PIE vectors table with pointers to the shell Interrupt Service Routine.
    InitPieVectTable();

    // Authorize register access.
    EALLOW;
    // Mapping adc_isr function to ADCC_I NT interrupt.
    PieVectTable.ADCC1_INT = &adc_isr;
    // Lock register access.
    EDIS;

    // Authorize register access.
    EALLOW;
    // Mapping tripzone_isr function to EPWM1_TZ_INT interrupt.
    PieVectTable.EPWM1_TZ_INT = &tripzone_isr;
    // Lock register access.
    EDIS;

    // Enable group 1 interrupts for ADCC interrupt and WAKE interrupt.
    IER |= M_INT1;
    // Enable group2 interrupts for trip zone interrupt.
    IER |= M_INT2;
    // Enable the PIE block
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    // Enable PIE interrupt 1.3 for ADCC1 interrupt.
    PieCtrlRegs.PIEIER1.bit.INTx3 = 1;
    // Enable PIE interrupt 2.1 for EPWM1 trip zone interrupt.
    PieCtrlRegs.PIEIER2.bit.INTx1 = 1;

    // Read master/slave configuration pin to initialize PWM correctly with phase shift equal 60° between them
    if(GpioDataRegs.GPADAT.bit.GPIO12 == false)
    {
        uc_state_master_slave = MASTER;
        // EPWM initialization function.
        epwm_init_spwm_branch_u();
        epwm_init_spwm_branch_v();
        epwm_init_spwm_branch_w();
        // Configure synchronization signal : load program to uC1 firstly because uC2 need external synchronization
        epwm_synch_init();
    }
    else
    {
        uc_state_master_slave = SLAVE;
        epwm_init_spwm_branch_x();
        epwm_init_spwm_branch_y();
        epwm_init_spwm_branch_z();
    }
    // Software watchdog initialization
    init_watchdog();

    // Analog to Digital Converter initialization.
    adc_init();
    // Comparator subsytem initialization.
    // Fuel cell OVP and Battery OCP
    cmpss1_init();
    // Battery OVP and Mi_U peak current
    cmpss2_init();
    // Mi_W peak current
    cmpss3_init();
    // MI_V peak current
    cmpss4_init();
    // Configure trip zone for return driver (GPIOmux -> InputXbar -> Trip_zone -> Epwm_module)
    tz_driver_return_init();

    // CPUTimer2 is used for extern watchdog.
    init_cpu_timers(&CpuTimer2Regs);

    // CAN bus initialization
    can_init();
    // I2C bus initialization
    i2c_init();
    // Reset timer
    CpuTimer2Regs.TCR.bit.TRB = 1;

    // Enable Global interrupt INTM
    EINT;
    // Enable Global realtime interrupt DBGM
    ERTM;

    while(1)
    {
        // Extern watchdog (200ms)
        // Toggle pin for watchdog for WDI signal on TPS3823-33Q1
        level_wdi_watchdog_pin = !level_wdi_watchdog_pin;
        GpioDataRegs.GPADAT.bit.GPIO25 = level_wdi_watchdog_pin;
        extern_watchdog_meas.start_time = CpuTimer2Regs.TIM.all;

        // Reset the watchdog counter
        ServiceDog();

        extern_watchdog_meas.end_time = CpuTimer2Regs.TIM.all;
        // Measure main loop timing
        extern_watchdog_meas.timediff = extern_watchdog_meas.start_time - extern_watchdog_meas.end_time;
        // Reset timer
        CpuTimer2Regs.TCR.bit.TRB = 1;
    }
}

Thanks

Damien

  • Hi Damien,

    Are you running the test with CCS connected ? If yes then please note that with CCS connected, device BOOT as EMULATION BOOT and you need to set the emulation BOOT properly so that after reset device boot to your application in flash. Please refer device TRM to detail about emulation boot.

    I am not clear on the issue mentioned in second test phase.  When you write the KEY WDCNTR will get reset and that is expected. Can you please explain the issue by pointing to the specific execution sequence ?

    Vivek Singh

  • Hi Vivek,

    I tested both cases with my debug probe connected or not, the problem remains the same, the reset pulse on pin XRS is generated but the initialization of the code of is not reexecuted because my led does not light up again. I now perform the following operation with an ADC interrupt configured, the watchdog configured at a time much greater than the ISR. I get an error message when CCS is connected, despite switching to EMU BOOT FLASH mode via Scripts-> EMU BOOT MODE SELECT -> EMU BOOT FLASH.

    How can I reset the DSP and run my initialization with toggle led again ? I've commented out the ServiceDog function in main so as not to reset the counter and thus trigger a reset, is that OK?

    I'd like to do a simple reset of the target when the counter has reached 256 with the defined clock and visualize this reset with my toggle led. Is it a configuration problem ?

    Thanks

    Damien

  • Hi,

    I get an error message when CCS is connected, despite switching to EMU BOOT FLASH mode via Scripts-> EMU BOOT MODE SELECT -> EMU BOOT FLASH.

    What is the error message ?

    When you run with debugger connected, after reset where is the code execution stuck ? Did you look into that ?

    Vivek Singh

  • Hi Vivek,

    The error can be seen in the previous message with the image, it break in boot rom memory I think. The error message is "Break at address "0x3f4751" with no debug information available, or outside of program code." It correspond to ESTOP0 line, if I make F8 to resume it's already in this line.

    Here you can see my cmd file :

    MEMORY
    {
       BOOT_RSVD		: origin = 0x00000002, length = 0x00000126
       RAMM0           	: origin = 0x00000128, length = 0x000002D6//2D8
       RAMM1            : origin = 0x00000400, length = 0x000003F8     /* on-chip RAM block M1 */
    // RAMM1_RSVD       : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
       
    /* RAMLS4           : origin = 0x0000A000, length = 0x00000800
       RAMLS5           : origin = 0x0000A800, length = 0x00000800
       RAMLS6           : origin = 0x0000B000, length = 0x00000800
       RAMLS7           : origin = 0x0000B800, length = 0x00000800 */
    
       /* Combining all the LS RAMs */
       RAMLS4567        : origin = 0x0000A000, length = 0x00002000
       RAMGS0           : origin = 0x0000C000, length = 0x000007F8
    // RAMGS0_RSVD      : origin = 0x0000C7F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    
       BOOTROM          : origin = 0x003F0000, length = 0x00008000
       BOOTROM_EXT      : origin = 0x003F8000, length = 0x00007FC0
       RESET            : origin = 0x003FFFC0, length = 0x00000002 //.reset is a standard section used by the compiler.  It contains the the address of the start of _c_int00 for C Code.
       
    #ifdef __TI_COMPILER_VERSION__
       #if __TI_COMPILER_VERSION__ >= 20012000
    GROUP {      /* GROUP memory ranges for crc/checksum of entire flash */
       #endif
    #endif
       BEGIN           	: origin = 0x085000, length = 0x000002 // origin = 0x080000
       /* Flash sectors */
       /* BANK 0 */
    // FLASHBANK0       : origin = 0x00080000, length = 0x0000FFF0
       //FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x000FFE	/* on-chip Flash */
       //FLASH_BANK0_SEC1  : origin = 0x081000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC2  : origin = 0x082000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC3  : origin = 0x083000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC4  : origin = 0x084000, length = 0x001000		/* on-chip Flash */
       FLASH_BANK0_SEC5  : origin = 0x085008, length = 0x000FF8	/* on-chip Flash */
       FLASH_BANK0_SEC6  : origin = 0x086000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC7  : origin = 0x087000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC8  : origin = 0x088000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC9  : origin = 0x089000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC5_6_7_8_9_10_11_12_13_14_15  : origin = 0x085008, length = 0x0AFF0 // origin = 0x085000
    // FLASH_BANK0_SEC15_RSVD     : origin = 0x08FFF0, length = 0x000010  /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    #ifdef __TI_COMPILER_VERSION__
      #if __TI_COMPILER_VERSION__ >= 20012000
    }  crc(_table_name, algorithm=C28_CHECKSUM_16)
      #endif
    #endif
    
    }
    
    
    SECTIONS
    {
       codestart        : > BEGIN, ALIGN(8)
       // Executable code and constants.
       .text            : >> FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11 | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 | FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15,   ALIGN(8)
       // Tables for explicitly initialized  global and static variables.
       .cinit           : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Jump tables for large switch statements.
       .switch          : > FLASH_BANK0_SEC4,  ALIGN(8)
       .reset           : > RESET,                  TYPE = DSECT /* not used, */
    	// In stack memory
       .stack           : > RAMM1
    	// Table of constructors to be called at startup (EABI output format only), it is the case, see project options.
       .init_array      : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Global and static variables (EABI output format only)
       .bss             : > RAMLS4567
       .bss:output      : > RAMLS4567
       .bss:cio         : > RAMGS0
       // Global and static variables that are explicitly initialized and contain string literals.
       .const           : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Global and static non-const variables that are explicitly initialized.
       .data            : > RAMLS4567
       // Memory for malloc functions (EABI output format only).
       .sysmem          : > RAMLS4567
    
        ramgs0 : > RAMGS0
    
        /*  Allocate IQ math areas: */
       IQmath           : > RAMLS4567
       IQmathTables     : > RAMLS4567
    
      .TI.ramfunc      : LOAD = FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11 | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 | FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15,
                      RUN = RAMGS0,
                      LOAD_START(RamfuncsLoadStart),
                      LOAD_SIZE(RamfuncsLoadSize),
                      LOAD_END(RamfuncsLoadEnd),
                      RUN_START(RamfuncsRunStart),
                      RUN_SIZE(RamfuncsRunSize),
                      RUN_END(RamfuncsRunEnd),
                      ALIGN(8)
    
       /* crc/checksum section configured as COPY section to avoid including in executable */
       .TI.memcrc          : type = COPY
    
    }
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
    

  • And as I said, if I don't run in debug mode and comment out the ServiceDog line so as not to reset the counter to 0 and thus trigger the reset, well, I don't observe anything (no reset, my toggle led doesn't execute again).

  • With debugger connected, please follow below sequence.

    Connect to CCS.

    Change the EMU BOOT setting via Scripts. 

    Issue reset from CCS 

    Click on run

    If it's stuck in the bootrom. Lood the BOOTROM symbol using load symbol option. BOOT ROM symbol file can be find at "<C2000Ware_Install>\libraries\boot_rom\f28002x\rev0\rom_sources\ccs_files\cpu\Release". 

    By doing this you should be able to find at what location code execution is stuck.

    Vivek Singh

  • Hi Vivek,

    Thank you i'll try this next monday as i'm in training at the moment.

    Damien

  • Hi Vivek,

    I tested your sequence but without success, I first loaded my executable code then before launching the run I loaded the bootrom symbol file (see photo) with a new ccs error (see photo) with a stop at address 0x859ca (which corresponds to a flash address if I'm not mistaken).

    If I close this error window and run the program, then my code executes correctly (led on then off), I observe a stop in the CPU1BROM_itrapISR(): function. From a software point of view, I don't observe a reset, my code doesn't execute again. However, the reset pulse on pin XRS does occur (photo attached with a low-state duration of 48us). This seems correct to me.

    An error message appears on the ccs console: "Can't find a source file at "D:/Projects/Boot_ROM/bootrom_f28002x/F28002x_ROM_dev_PG1.0/F28002x_ROM/bootROM/source/cpubrom_interrupts.c". Locate the file or edit the source lookup path to include its location."

    What does this message mean? Why do I need to include this file? Is it the only source of my problem?

    Is it compulsory to integrate the driverlib because i don't want to? because for perfect control i use the bitfield

    Thanks for your help

    Damien

  • Hi,

    I first loaded my executable code then before launching the run I loaded the bootrom symbol file (see photo) with a new ccs error (see photo) with a stop at address 0x859ca (which corresponds to a flash address if I'm not mistaken).

    That just means it can not locate the source because you have loaded BOOTROM symbol. 

    If I close this error window and run the program, then my code executes correctly (led on then off), I observe a stop in the CPU1BROM_itrapISR():

    Stop in CPU1BROM_ItrapISR() is not good. It means that CPU fetched some illegal instruction. This can happen is CPU is trying to execute from a location which is not code region. What happens if after loading your code you reset the CPU and follow the step which I mention. and try to run ?

    An error message appears on the ccs console: "Can't find a source file at "D:/Projects/Boot_ROM/bootrom_f28002x/F28002x_ROM_dev_PG1.0/F28002x_ROM/bootROM/source/cpubrom_interrupts.c". Locate the file or edit the source lookup path to include its location."

    This is just asking you to location the boot rom source files. It's not an error. 

    Vivek Singh

  • Hi Vivek,

    If I load my code with debugger connected and reset CPU (via Run->Reset->CPU Reset) then CCS message is "_system_post_cinit() at C:/...

    And next I close this message and try yours steps which you mention : Scripts -> EMU BOOT MODE SELECT -> EMU BOOT FLASH and load symbols for BOOT ROM.

    I have include cpubrom_Init_Boot.asm because message is set to CCS. So I visualize init when I run, all of bootROM init is set at 0x3fxxxx address. After I jump to 0x080000 address but I haven't this one in my memory map so it's curious ? And after I jump to 0x08635f address, knowing that according to my mapping the begin is at address 0x085000 why don't I see this passage ? Next I continue and I break at address 0x00c057 with no information ?

    Knowing that without performing your manipulation my code still executes, so this whole initialization phase must be done correctly, right? It's a problem linked to debugger mode with a path through assembler files. Is the problem not linked to my mapping (attached) ?

    Thanks

    Damien

    MEMORY
    {
       BOOT_RSVD		: origin = 0x00000002, length = 0x00000126
       RAMM0           	: origin = 0x00000128, length = 0x000002D6//2D8
       RAMM1            : origin = 0x00000400, length = 0x000003F8     /* on-chip RAM block M1 */
    // RAMM1_RSVD       : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
       
    /* RAMLS4           : origin = 0x0000A000, length = 0x00000800
       RAMLS5           : origin = 0x0000A800, length = 0x00000800
       RAMLS6           : origin = 0x0000B000, length = 0x00000800
       RAMLS7           : origin = 0x0000B800, length = 0x00000800 */
    
       /* Combining all the LS RAMs */
       RAMLS4567        : origin = 0x0000A000, length = 0x00002000
       RAMGS0           : origin = 0x0000C000, length = 0x000007F8
    // RAMGS0_RSVD      : origin = 0x0000C7F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    
       BOOTROM          : origin = 0x003F0000, length = 0x00008000
       BOOTROM_EXT      : origin = 0x003F8000, length = 0x00007FC0
       RESET            : origin = 0x003FFFC0, length = 0x00000002 //.reset is a standard section used by the compiler.  It contains the the address of the start of _c_int00 for C Code.
       
    #ifdef __TI_COMPILER_VERSION__
       #if __TI_COMPILER_VERSION__ >= 20012000
    GROUP {      /* GROUP memory ranges for crc/checksum of entire flash */
       #endif
    #endif
       BEGIN           	: origin = 0x085000, length = 0x000002 // origin = 0x080000
       /* Flash sectors */
       /* BANK 0 */
    // FLASHBANK0       : origin = 0x00080000, length = 0x0000FFF0
       //FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x000FFE	/* on-chip Flash */
       //FLASH_BANK0_SEC1  : origin = 0x081000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC2  : origin = 0x082000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC3  : origin = 0x083000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC4  : origin = 0x084000, length = 0x001000		/* on-chip Flash */
       FLASH_BANK0_SEC5  : origin = 0x085008, length = 0x000FF8	/* on-chip Flash */
       FLASH_BANK0_SEC6  : origin = 0x086000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC7  : origin = 0x087000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC8  : origin = 0x088000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC9  : origin = 0x089000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000	/* on-chip Flash */
       FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000	/* on-chip Flash */
       //FLASH_BANK0_SEC5_6_7_8_9_10_11_12_13_14_15  : origin = 0x085008, length = 0x0AFF0 // origin = 0x085000
    // FLASH_BANK0_SEC15_RSVD     : origin = 0x08FFF0, length = 0x000010  /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
    #ifdef __TI_COMPILER_VERSION__
      #if __TI_COMPILER_VERSION__ >= 20012000
    }  crc(_table_name, algorithm=C28_CHECKSUM_16)
      #endif
    #endif
    
    }
    
    
    SECTIONS
    {
       codestart        : > BEGIN, ALIGN(8)
       // Executable code and constants.
       .text            : >> FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11 | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 | FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15,   ALIGN(8)
       // Tables for explicitly initialized  global and static variables.
       .cinit           : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Jump tables for large switch statements.
       .switch          : > FLASH_BANK0_SEC4,  ALIGN(8)
       .reset           : > RESET,                  TYPE = DSECT /* not used, */
    	// In stack memory
       .stack           : > RAMM1
    	// Table of constructors to be called at startup (EABI output format only), it is the case, see project options.
       .init_array      : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Global and static variables (EABI output format only)
       .bss             : > RAMLS4567
       .bss:output      : > RAMLS4567
       .bss:cio         : > RAMGS0
       // Global and static variables that are explicitly initialized and contain string literals.
       .const           : > FLASH_BANK0_SEC4,  ALIGN(8)
       // Global and static non-const variables that are explicitly initialized.
       .data            : > RAMLS4567
       // Memory for malloc functions (EABI output format only).
       .sysmem          : > RAMLS4567
    
        ramgs0 : > RAMGS0
    
        /*  Allocate IQ math areas: */
       IQmath           : > RAMLS4567
       IQmathTables     : > RAMLS4567
    
      .TI.ramfunc      : LOAD = FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6 | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11 | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 | FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15,
                      RUN = RAMGS0,
                      LOAD_START(RamfuncsLoadStart),
                      LOAD_SIZE(RamfuncsLoadSize),
                      LOAD_END(RamfuncsLoadEnd),
                      RUN_START(RamfuncsRunStart),
                      RUN_SIZE(RamfuncsRunSize),
                      RUN_END(RamfuncsRunEnd),
                      ALIGN(8)
    
       /* crc/checksum section configured as COPY section to avoid including in executable */
       .TI.memcrc          : type = COPY
    
    }
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
    

  • Hi Damien,

    Watchdog is barking up a tree, he must see a squirl - lol.

    Wonding if you change reading the reset cause register to only occur when WD has expired or even comment read, does anything change? Personally I would not try to read the CPU reset cause register via main.c and have NMI handler do functions coded below.

        // Read reset cause register to know which reset is the cause (external or software watchdog)
        if(CpuSysRegs.RESC.bit.WDRSn == true)
        {
            // Indicates reset cause : software
            reset_status = 1;
            // Reset flag in cause register
            CpuSysRegs.RESCCLR.bit.WDRSn = true;
        }
        else if(CpuSysRegs.RESC.bit.XRSn == true)
        {
            // Indicates reset cause : external watchdog
            reset_status = 2;
            // Reset flag in cause register
            CpuSysRegs.RESCCLR.bit.XRSn = true;
        }

  • Hi,

    After I jump to 0x080000 address but I haven't this one in my memory map so it's curious ? And after I jump to 0x08635f address, knowing that according to my mapping the begin is at address 0x085000 why don't I see this passage ? Next I continue and I break at address 0x00c057 with no information ?

    Well, your begin has to be at 0x80000 else it'll not work. This is why it is going to ITRAP. BOOTROM code has this (and some other address) hardcoded to jump to application. Please fix this and that should solve the issue.

    Vivek Singh

  • Hi Vivek,

    The reset now works correctly after linking my start code to address 0x080000. I'm now initializing the watchdog in my bootloader (I did it myself) without going into too much detail.

    Thanks

    Damien

  • The reset now works correctly after linking my start code to address 0x080000

    Why did you mess with the start address in the first place? Your watchdog code reset fails issue had nothing to do with your post. For the ARM Cortex MCU class we use flash bootloader, start address must exist on 4k boundary or it will not work. Have to set the application offset address directly above the bootloader. Uniflash firmware separately as two independent project builds. 

  • Hi Genatco,

    I didn't change the addresses, they were already configured as follows. I now perform the initialization in my program for my bootloader part, not my application part. I reset the watchdog counter in my main loop for the application part as well as for the bootloader part in order to detect a block in both parts. I don't know if I'm making myself clear, but I'm attaching a synoptic diagram of my system, whether mapping or integrating the bootloader and application parts. I don't know if there's anything better to do ?

    Thanks Damien

  • Glad to know issue is resolved.

  • I reset the watchdog counter in my main loop for the application part as well as for the bootloader part in order to detect a block in both parts.

    I simply do not know how you are modifying the embedded ROM bootloader, jumps to address 0x0080000 executes C_Init by default depending on the boot switch settings x25c launchpad. ROM embedded bootloader never jumps to 0x0085000 in any TI projects I am aware of.

    However a Flash written boot loader might vector 0x085000 if that is the boot project you modified. Vivek might be so kind as to clarify what a vector address might be for Flash boot loader project users can modify code to check WatchDog timer prior to executing C_Init jump to main.c. 

    Your start code meaning what exactly functions in (main.c) or you have a Flash boot loader running? 

    #endif
    BEGIN : origin = 0x085000, length = 0x000002 // origin = 0x080000

  • Hi,

    My bootloader begin at address 0x080000, the application program is loaded via CAN, then under certain conditions I make a jump to my application part via vector 0x085000. If I detect a watchdog error in my applicative part so I reset in bootloader part 0x080000 and jump to applicative part will be if conditions are ok. There is no problem because start boot is at 0x080000, every time I start up I begin at this address.

    Damien

  • Hi Damien,

    Ok you do have a custom bootloader and unique way to handle watchdog. So 0x085000 is application though Watchdog will likely cause POR on the second timeout unless feature is disabled. You might be able to disable simulated POR to better control his behavior. The application should in most cases call a function periodically to reload the timeout count register before it expires each cycle of the main application loop. That can get tricky with multiple interrupts running if the timeout is set short.

    Is there some reason you want to run the entire application from SRAM versus parts of Flash? You can use #pragma to load specific functions to dedicated LSRAM defined sections if the application has crashing issues. We have some application functions refuse to run properly from LSRAM 100Mhz clock.