NHS3100 Flash driver "EraseSector" timeout (5000 ms) PC:FFFFFFFE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NHS3100 Flash driver "EraseSector" timeout (5000 ms) PC:FFFFFFFE

961 Views
tillostermann
Contributor II

Hi,

I'm stuck with the following Error message of the LPCXpresso program. Target is a NHS3100 chip. The error appears when trying to flash or debugg the NHS3100 chip.

error_screenshot_2.png

Right now I'm trying to figure out how to use the low power mode and altered the blinky program:

#include "board.h"

int main(void)
{
    Board_Init();
    Chip_Clock_System_SetClockFreq(8000000);

    // Initialize RTC
    Chip_RTC_Init(NSS_RTC);
    Chip_RTC_Wakeup_SetControl(NSS_RTC, (RTC_WAKEUPCTRL_T)(RTC_WAKEUPCTRL_ENABLE | RTC_WAKEUPCTRL_AUTO));
    Chip_RTC_Int_SetEnabledMask(NSS_RTC, RTC_INT_WAKEUP);
    NVIC_EnableIRQ(RTC_IRQn);
    Chip_RTC_Wakeup_SetReload(NSS_RTC, 1);

    while (1) {
        // Toggle led
        LED_Toggle(LED_RED);

        // Go to sleep
        Chip_PMU_PowerMode_EnterSleep();
    }

    return 0;
}

// RTC interrupt
void RTC_IRQHandler(void)
{
    if (Chip_RTC_Int_GetRawStatus(NSS_RTC) & RTC_INT_WAKEUP) {
        Chip_RTC_Int_ClearRawStatus(NSS_RTC, RTC_INT_WAKEUP);
    }
    Chip_RTC_Wakeup_SetReload(NSS_RTC, 1);
}

I would like to be able to flash the NHS3100 again. Help on possible flaws in the code are also appreciated. Thank you for your help.

BR

Till

0 Kudos
4 Replies

735 Views
driesmoors
NXP Employee
NXP Employee

Hello Till,

I suspect this line is causing you problems:

Chip_Clock_System_SetClockFreq(8000000);

To operate at 8 Mhz, the low power mode of the FLASH can not be used. You must prior to that call this line of code:

Chip_Flash_SetHighPowerMode(true);

See also the documentation at <SDK>/docs/firmware.html, "SW Clock Restrictions", and the documentation of the API:

pastedImage_1.png 

If you have flashed a debug version, it should still be easy to recover from this. You best try to use Flash Magic to flash it with some other firmware. If you have flashed a release version, then I fear the IC may have been bricked: the SWD lines are inaccessible before main gets control, and main causes a hard fault almost immediately. The only way out is then to replace the IC, I'm sorry to say.

Kind regards,
Dries.

735 Views
tillostermann
Contributor II

Hi Dries,

thank you for your answer. Indeed it seems like I've locked myself out of the NHS3100. Can you give some minimal code for a blinky low power mode solution? The program above, without the

Chip_Clock_System_SetClockFreq(8000000);

line worked but never really entered a low power mode (The current drawn from the chip was constant 500µA). Do I manually need to shut down peripherals? What would be a reasonable current after

Chip_PMU_PowerMode_EnterSleep();

or

Chip_PMU_PowerMode_EnterDeepSleep();

Again, thank you for your help!

BR

Till

0 Kudos

735 Views
driesmoors
NXP Employee
NXP Employee

Hi,

What is the goal of this exercise? The lowest power consumption possible is attained when using the Deep Power Down mode. Implementing a low-power 'blinky' app is a bit self-defeating, as the LED alone consumes more power than the rest of the IC.

The difference in current consumption between Sleep and Deep Sleep in such a simple application will not be noticed. Check also the documentation in the SDK:

  • the datasheet: Figure 12. Active current consumption
  • PowerModes.pdf

KR,
Dries

0 Kudos

735 Views
tillostermann
Contributor II

Hi,

the goal is to get familiar with the lpm functionalities of the NHS chip. When the sleep time is long enough, in the LED off time, I can measure the Icc in sleep or deep sleep. The code below shows 5 seconds off time, which is enough to read the low power Icc.

In debugging mode, for the low power mode (LED off) I measure ~300µA, which is too high for the IC, basically doing nothing.

#include "board.h"

int main(void)
{
    Board_Init();
 

    // Initialize RTC
    Chip_RTC_Init(NSS_RTC);
    Chip_RTC_Wakeup_SetControl(NSS_RTC, (RTC_WAKEUPCTRL_T)(RTC_WAKEUPCTRL_ENABLE | RTC_WAKEUPCTRL_AUTO));
    Chip_RTC_Int_SetEnabledMask(NSS_RTC, RTC_INT_WAKEUP);
    NVIC_EnableIRQ(RTC_IRQn);
    Chip_RTC_Wakeup_SetReload(NSS_RTC, 5);

 

    while (1) {
        // Toggle led
        LED_Toggle(LED_RED);

 

        // Go to sleep
        Chip_PMU_PowerMode_EnterSleep();
    }

 

    return 0;
}

// RTC interrupt
void RTC_IRQHandler(void)
{
    if (Chip_RTC_Int_GetRawStatus(NSS_RTC) & RTC_INT_WAKEUP) {
        Chip_RTC_Int_ClearRawStatus(NSS_RTC, RTC_INT_WAKEUP);
    }
    Chip_RTC_Wakeup_SetReload(NSS_RTC, 5);
}

1. Does Icc in debbuging mode equal Icc in regular mode (release flashed)?

2. What peripherals could use up the 300µA and how do I disable them?

Again, thank you for all of your help!

BR

Till

0 Kudos