Deep Sleep mode preventing transmitting message | Zigbee 3.0 | jn5168-001-M00

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

Deep Sleep mode preventing transmitting message | Zigbee 3.0 | jn5168-001-M00

Jump to solution
4,881 Views
davidashraf
Contributor V

Hello , 

I am trying to simple code to transmit a message from a SED ( jn5168-001-M00) to a coordinator of the same type, 
The SED should wake up on external event on a certain DIO , Transmit message , then enter deep sleep.

But the module fails to Transmit and enter deep sleep without sending the message.

Note: I try the same code with changing sleep mode to  PWRM_vInit(E_AHI_SLEEP_OSCON_RAMON);
and it succeeds, so I think the problem is related to deepsleep.

Also I notice that during deepsleep , the connected serial-to-uart module keeps receiving on RX pin 
I don't know if this is related 


Any Help ?

https://community.nxp.com/community/wireless-connectivity?sr=search&searchId=91cfcc81-ee50-40ee-9b4c...

1 Solution
3,928 Views
davidashraf
Contributor V

I solved this finally using PWRM_eStartActivity() and PWRM_eFinishActivity() pairs.
And apparently "Presleep function " doesn't allow transmitting .

View solution in original post

0 Kudos
Reply
18 Replies
3,929 Views
davidashraf
Contributor V

I solved this finally using PWRM_eStartActivity() and PWRM_eFinishActivity() pairs.
And apparently "Presleep function " doesn't allow transmitting .

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Wireless Connectivity‌ 
IoT Wireless Connectivity
mario_castaneda
I still need help in solving this problem ASAP 

Any opinions ?

3,928 Views
davidashraf
Contributor V

Anyone had this problem and could solve it ? 
I'm still having it 
Thanks

0 Kudos
Reply
3,928 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi David,

I'm sorry for the late response. I am working on it.

Best Regards,

Mario

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Please let me know if this problem requires me to switch to other stack version or do major changes if it doesn't have a solution , As My app relies on deepsleep.

Thanks and Best Regards

0 Kudos
Reply
3,930 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi David,

I'm sorry I was confused.

But you can take as reference the JN-AN-1189.

As you can see, the common switch is handling the  Deep Sleep:

Previously you have to set up the time that you will load to the deep sleep.

For example you the PWRM_vInit(E_AHI_SLEEP_OSCON_RAMON);

Then the PWRM_Callback,Disables the UART and set the wake up conditions, (DIO),

PWRM_CALLBACK(PreSleep)
{
    #ifdef SLEEP_ENABLE
        #ifdef DEEP_SLEEP_ENABLE
            DBG_vPrintf(TRACE_START,"Sleeping...bGoingDeepSleep = %d\n",bGoingDeepSleep());
        #endif
    #endif

    /* If the power mode is with RAM held do the following
     * else not required as the entry point will init everything*/
    if(u8PowerMode == RAM_HELD)
    {
       vAppApiSaveMacSettings();
    }
    /* Disable UART */
    vAHI_UartDisable(E_AHI_UART_0);
    /* Set up wake up input */
    #ifdef SLEEP_ENABLE
        #ifdef DEEP_SLEEP_ENABLE
            if(bGoingDeepSleep())
            {
                vSetUpWakeUpConditionsForDeepSleep();
            }
            else
        #endif
            {
                vSetUpWakeUpConditions(FALSE);
            }
    #endif
}

Sleep mode cannot be entered while there are software timers active (in running or expired states). You must therefore de-activate any such timers to allow the Power Manager to put the JN51xx device into sleep mode.

You can obtain the current value of the activity counter using the function PWRM_u16GetActivityCount.

Please let me know your findings.

Regards,

Mario

0 Kudos
Reply
3,930 Views
davidashraf
Contributor V

Hi Mario ,
Thanks for your reply , but I think my question is still not answered .
Is deep sleep mode is entered automatically using power manager once I initialized it using PWRM_vInit(E_AHI_SLEEP_DEEP);?
or there's an equivalent to PWRM_eScheduleActivity() that I should use to enter deepsleep ? 

When I tried initializing power manager with E_AHI_SLEEP_DEEP ,I noticed that trying to transmit data always fails unlike what happens when trying any other sleep mode! 

So My questions would be is there a function to enter deep sleep or power manager enters it automatically ? 
And if there isn't , How to solve transmitting data problem ? 
I tried putting the code of transmitting data in wake callback, pre sleep call back and even in main function before calling the main loop. 
Where else should I try ? where the problem might be? 
Noting again that the code succeed with any other sleep mode 

I am looking forward to your reply
Regards 

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V
0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

mario_castaneda
Is there a possibility that I can find a solution to this ? 

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Hi Mario, 
It's okay I'm waiting for it.

Thanks
David

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

mario_castaneda‌ 
limcb
Any idea how to solve this problem ? 

0 Kudos
Reply
3,927 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi David,

As you know, the JN5168 needs time for crystal to stabilize, ready for radio activity 1 ms. Also you can take a look the JN516x Wake-up timings following the next link.

You can probe this measuring the current, or you can toggle a pin and be sure about the wake up time.

http://www.nxp.com/docs/en/application-note/JN-AN-1001.pdf?fsrch=1&sr=1&pageNum=1 

Are you seeing the TX data with a sniffer?

What is the AN that you are taking as a reference?

Please take a look the JN-AN-1229 and look up the ZBP_SleepingEndDevice example.

Please let me know your findings.

Best Regards,

Mario

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Hi Mario , 

 

I'm using JN-AN-1229 ,yet , the example doesn't show deepsleep operation 
Knowing about wakeup time , where exactly in the code should I enter deepsleep ? and how to do it with code ? 

Currently I'm using 

PWRM_vInit(E_AHI_SLEEP_DEEP);

 inside

 vInitialiseApp(void) 


then 

PWRM_vManagePower()

inside

app_vMainloop(void)



Where ( with reference to AN1229 ) I should put the code to transmit data and where to enter deep sleep ? 
Am I doing something wrong ? 

Thanks for your reply 

Best Regards
David 

0 Kudos
Reply
3,928 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi David,

If you take a look the JN-AN-1229,  the app_sleeping_enddevice.c file, you will find:

PUBLIC void vAppMain(void)
{
  .
  .
  .     
  .
  .
  .
  .
    /* initialise application */
    APP_vInitResources();
    APP_vSetUpHardware();
    vInitialiseApp();
    app_vMainloop();

}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So, as you can see, inside this funtion, we have the vInitialiseApp(); and after that configuration you will call the app_vMainLoop and stay forever in this function while(1);

PRIVATE void vInitialiseApp(void)
{
    /* Initialise JenOS modules. Initialise Power Manager even on non-sleeping nodes
     * as it allows the device to doze when in the idle task
     */
    PWRM_vInit(E_AHI_SLEEP_OSCON_RAMON);

    /*
     *  Initialise the PDM, use an application supplied key (g_sKey),
     *  The key value can be set to the desired value here, or the key in eFuse can be used.
     *  To use the key stored in eFuse set the pointer to the key to Null, and remove the
     *  key structure here.
     */
#ifdef PDM_EEPROM
     PDM_eInitialise(63);
     PDM_vRegisterSystemCallback(vPdmEventHandlerCallback);
#else
     PDM_vInit(7, 1, 64 * 1024 , NULL, NULL, NULL, &g_sKey);
#endif
    /* Initialise Protocol Data Unit Manager */
    PDUM_vInit();

    /* Register callback that provides information about stack errors */
    ZPS_vExtendedStatusSetCallback(vfExtendedStatusCallBack);

    /* Initialize application */
    APP_vInitialiseSleepingEndDevice();
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

You can set the sleep mode that you want, PWRM_vInit(E_AHI_SLEEP_DEEP);

Note: Remember that you have to define the next functions, also you can take as reference the example:

-PWRM_vRegisterPreSleepCallback

-PWRM_vRegisterWakeupCallback

/* set device to go to sleep */
PWRM_eScheduleActivity(&sWake, SLEEP_TIME, vWakeCallBack);

For a better reference 7. PWRM API

http://www.nxp.com/docs/en/user-guide/JN-UG-3116.pdf?fsrch=1&sr=1&pageNum=1 

The Deep Sleep Mode is waiting on chip RESET or I/O event.

Hope it helps. I am working in an example for the different sleep modes, but It will take some time.

Best Regards

Mario

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

mario_castaneda
Isn't there a way using Power manager to enter deepsleep ? 

Should I use AHI function instead ? 

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Isn't there a way using Power manager to enter deepsleep ? 
Should I use AHI function instead ? 

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

Hi mario_castaneda
Thanks for your reply 

I don't think this is valid 

/* set device to go to sleep */
PWRM_eScheduleActivity(&sWake, SLEEP_TIME, vWakeCallBack);


Because According to the JN51xx Core Utilities User Guide and I quote 

To use this function, the Power Manager must be configured through PWRM_vInit() to implement a low-power mode in which the 32-kHz oscillator is running and memory is held (otherwise, the list of scheduled wake points will be lost when the device enters sleep mode). The function will return an error (see below) if the 32-kHz oscillator has not been configured to run during sleep or the software wake timer is already running for another wake point.


So this function is not valid to use here and that's my problem 

Also this doesn't solve the problem of failing to Transmit data before going to deep sleep 


Regards 
David 

0 Kudos
Reply
3,928 Views
davidashraf
Contributor V

mario_castaneda

Hi Mario 

I'm using JN-AN-1229 ,yet , the example doesn't show deepsleep operation 
Knowing about wakeup time , where exactly in the code should I enter deepsleep ? and how to do it with code ? 

Currently I'm using 

PWRM_vInit(E_AHI_SLEEP_DEEP);

 inside

 vInitialiseApp(void) 


then 

PWRM_vManagePower()

inside

app_vMainloop(void)



Where ( with reference to AN1229 ) I should put the code to transmit data and where to enter deep sleep ? 
Am I doing something wrong ? 

Thanks for your reply 

Best Regards
David 

0 Kudos
Reply