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.

MSPM0G1506: MSPM0G1506 System tick update variable issue

Part Number: MSPM0G1506
Other Parts Discussed in Thread: UNIFLASH, , SYSCONFIG

Hi Expert, I'm doing with mspm0g1506 and face issue with about 10% mcu can't run correctly with normal logic, the mcu can't step pass app.c:56 (AppDelayMs function). Use Uniflash dumped flash on mcu work and not work is completely identical.

Please take alook if i have some misstake on sysconfig or app code (90% of MCUs work correctly with this code) please download with the link bellow.

https://drive.google.com/file/d/14P2POg0J5JnXCO5Fa0lRo_vsb8LizPdx/view?usp=drive_link

Thanks for advance,

 

  • Hello Hai,

    Before dive deep into your code, could you please describe your problems with more details, and if you can narrow down your code into a simple demo which can reproduce your issue, it will be better.

    BR,

    Janz Bai

  • I can't access your source.

    But given the hints, are you using volatile to indicate that variables might change without the compiler's knowledge?

    are you locking out interrupts when accessing your systick variable?

    If you *are* locking out interrupts, are you accessing your variable so much that you lose systicks?

    These are some of the things that have bitten me in the past.

  • Hi Janz Bai, ,

    I'll describe the problem as follows:
    - The project uses sysconfig, the default clock is 32MHz, and the systick interrupt is configured at 1ms.
    - A variable named `volatile` is used for the interrupt variable.

    Definition:
    Typedef struct {
    Volatile uint32_t u32SysTick;
    uint32_t u32TestLedTick;
    uint8_t testLedMode;
    uint8_t testLedPass;
    uint8_t testLedIndex;
    uint8_t lastCoilState;
    uint8_t coilStateCnt;
    uint8_t currCoilState;
    uint8_t tmpState;

    }App_t;

    Usage:
    Void SysTick_Handler() {
    gApp.u32SysTick++;

    }

    uint32_t AppGetTick() {
    return gApp.u32SysTick;
    }
    - When I use the debugger in CCS, I see a systick interrupt (but I'm not sure about the exact 1ms interval), however, the gApp.u32SysTick variable doesn't increment steadily when I step in CCS; it increases to around 300 or 400 and then returns to around 100 or 200. Nowhere else in the code does the SysTick_Handler function write to this variable.
    - The error only appears randomly on about 10% of the boards.
    - Boards that are faulty always fail, while boards that are not faulty always run normally.
    - The flash dumps of faulty and non-faulty boards have completely identical content.
    - When I make minor edits to the code and rebuild, the error disappears on all boards.
    - When I review the entire source code, I find no logical issues.
    - When I make minor edits to the source code and reload the previously faulty board, the error no longer recurs.
    * The issue I want to investigate in this project is why it fails when built with this exact source code. Please show me how to send you the full source code so I can get a comprehensive review (sysconfig, compiler, project settings, etc.) to determine which component is causing the problem?

  • please see the reply bellow  

  • Other than possibly protecting the access by turning off the systick interrupt in AppGetTick, I would look to see if you aren't writing say 16 bit values to TestLedTick, corrupting u32SysTick.

  • I found the cause: I had set the WWDT to have a 500ms cycle, which caused the 500ms block delay to trigger a watchdog reset on some MCUs with faster watchdog timers than others. I resolved this by increasing the WWDT's timeout.

    Thank you.