Hello,
I am using an STM32F103RB MCU in a specific Hardware design with J-Link Base Compact and IAR or J-Link commander as tools to flash and debug.
The Hardware was always working fine (it is a final product of medical customer) until I flashed a software which implements the stop mode (deep sleep mode) management (by setting the SLEEPDEEP bit in the System control register (SCB_SCR) and configuring the PWR_CR register).
Here is the code:
Display All
In the Software after calling WFI instruction (wait for interrupt) to wait for an interrupt to wake-up the micro-controller, it still sleeping for ever.
In debug session by pressing next step in IAR, I can go out from deep sleep mode.
When I go out from debug session, I can't connect anymore to the micro-controller and I can't flash it anymore.
I guess that because always when I power on the Hardware, the CPU goes directly in deep sleep mode.
I have the issue as described in the screenshot below.
I tried to enable the low power handling mode in J-Link by using a script as following:
and call the J-Link commander by Windows cmd:
But I am not sure that it's working fine because I didn't have the print of
Report("STM32F103RB (ARM M3 core) J-Link script");
Please any help!
Kind regards,
I am using an STM32F103RB MCU in a specific Hardware design with J-Link Base Compact and IAR or J-Link commander as tools to flash and debug.
The Hardware was always working fine (it is a final product of medical customer) until I flashed a software which implements the stop mode (deep sleep mode) management (by setting the SLEEPDEEP bit in the System control register (SCB_SCR) and configuring the PWR_CR register).
Here is the code:
C Source Code
- void PWR_EnterStopMode (uint8_t stopEntry)
- {
- // Disable Systick Interrupt
- SysTick->CTRL &= ~SYSTICK_CTRL_TICKINT_MSK;
- // clear Power down deepsleep
- PWR->CR &= ~PWR_CR_PDDS_MSK;
- // Select stop mode
- PWR->CR |= PWR_CR_LPDS_MSK;
- // Clear wake up flag
- PWR->CR |= PWR_CR_CWUF_MSK;
- // Set sleep deep in ARM Cortex System control register
- SCB->SCR |= SCB_SCR_SLEEPDEEP_MSK;
- if(stopEntry == PWR_LOWPOWER_ENTRY_WFI)
- {
- // Request wait for wakeup interrupt
- __WFI();
- }
- else
- {
- // Request wait for wakeup event
- __WFE();
- }
- /* Reset SLEEPDEEP bit of Cortex System Control Register */
- SCB->SCR &= ~SCB_SCR_SLEEPDEEP_MSK;
- // Enable SysTick Timer & activate Systick IRQ, set SysTick Clock Source to Core Clock
- SysTick->CTRL |= SYSTICK_CTRL_TICKINT_MSK | SYSTICK_CTRL_ENABLE_MSK;
- }
In the Software after calling WFI instruction (wait for interrupt) to wait for an interrupt to wake-up the micro-controller, it still sleeping for ever.
In debug session by pressing next step in IAR, I can go out from deep sleep mode.
When I go out from debug session, I can't connect anymore to the micro-controller and I can't flash it anymore.
I guess that because always when I power on the Hardware, the CPU goes directly in deep sleep mode.
I have the issue as described in the screenshot below.
I tried to enable the low power handling mode in J-Link by using a script as following:
But I am not sure that it's working fine because I didn't have the print of
Report("STM32F103RB (ARM M3 core) J-Link script");
Please any help!
Kind regards,