SMAC & low power : bugs?

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

SMAC & low power : bugs?

3,407 Views
stevasway
Contributor III
Hi all,
I tried to use SMAC with low power.
I started from an example appeared on SMAC4.1a release called SimpleNetwork. The example disappeared from release 4.1b and no example was published with low power features.
The problem is that all run ok until there is a crash of the fw and the Query remote doesn't respond anymore. Do you have any idea?

void main(void)
{

gsTxPacket.u8DataLength = 0;
gsTxPacket.pu8Data = &gau8TxDataBuffer[0];
gsRxPacket.u8DataLength = 0;
gsRxPacket.pu8Data = &gau8RxDataBuffer[0];
gsRxPacket.u8MaxDataLength = 10;
gsRxPacket.u8Status = 0;

/* Begin init */
MCUInit();
MCUPortInit(); //Set up unused ports for low power
MC13192Init();
MLMESetMC13192ClockRate(0); /* 16 MHz MC13192 CLKo */
UseExternalClock(); /* Now at 8 Mhz CPU bus */
LEDInit();
TPM1SC = 0x0F; /* Timer prescale by 128. (16uS timebase for 8MHz bus clock). */

/* Set up Real Time Interrupt for STOP3 very low power operation */
SRTISC = 0x17; //Enable RTI timer, internal clock, 1 sec wakeup
SPMSC1 = 0; //Disable all LVD functions
SPMSC2=SPMSC2&~0x03; /* Enable deep sleep mode stop3 (PDC & PPDC =0) */
SOPT_STOPE = 1; //Enable STOP mode(s)

/* Enable all IRQ sources. */
MC13192_IRQ_IE_BIT = 1;
EnableInterrupts;

MLMESetChannelRequest(Channel_Num); /* Choose your channel here */
MLMESetMC13192TmrPrescale(3); // Set 250 kHz timer rate
MLMEMC13192PAOutputAdjust(MAX_POWER);

/**************************************************************
* Main Loop
**************************************************************/

gu8AppStatus = LOOK_AROUND; //start by looking for request

for(;:smileywink: {

switch (gu8AppStatus)
{

case LOOK_AROUND:
UseMcuClock();
MLMEHibernateRequest(); //MC13192 now consuming 3 uA
DEAD_STOP3(); // Enter STOP3, MCU now consuming 1uA
MLMEWakeRequest();
UseExternalClock();
MLMERXEnableRequest(&gsRxPacket, 750); // 250 = 1mS timeout
LOW_POWER_WHILE(); //Stay until Interrupted for TO or data.
break;

case TX_IDnDATA:
gu8LinkQuality = MLMELinkQuality()/2;
gau8TxDataBuffer[0] = Net_ID; //Send our net #
gau8TxDataBuffer[1] = Remote_ID; //Send board ID #
gau8TxDataBuffer[2] = gu8LinkQuality; //Send link quality as data
gsTxPacket.u8DataLength = 3;
MCPSDataRequest(&gsTxPacket); // transmit data
WinkLED2x(); //Double-wink LED for good packet
gu8AppStatus = LOOK_AROUND; //return to await query mode
break;

case NO_DATA:
WinkLED1x(); //Show no packet for us
gu8AppStatus = LOOK_AROUND;
break;
}
}
}

void MCPSDataIndication(tRxPacket *gsRxPacket)
{
switch (gsRxPacket->u8Status)
{
case SUCCESS:
// Check for Host and ID match.
if ((gsRxPacket->pu8Data[0] == Net_ID) &&
(gsRxPacket->pu8Data[1] == Remote_ID))
{
gu8AppStatus = TX_IDnDATA; //enable response to host
}
else
{
gu8AppStatus = NO_DATA;
}
break;

case TIMEOUT:
gu8AppStatus = NO_DATA;
break;

case OVERFLOW:
break;
}
}
Labels (1)
0 Kudos
5 Replies

563 Views
kbu
Contributor I
I'm not sure why your firmware crashes, but I have a similar program and I can't get the device to go into STOP2.
I've noticed however that I am never able to update the SPMSC2 register, even if I try to force SPMSC2 = 0x03; (to set the PDC and PPDC bits) the value remains 0x00 (viewed in the Inspect window of Hiwave- also in the location 0x180A)

Can you see in your code if the value of SPMSC2 changes?
0 Kudos

563 Views
stevasway
Contributor III
No problem I'll check in my code if the value of SPMSC2 changes, but if I remember, in this case I can't go in stop mode 2, but only in stop mode 3, because the rti interrupt occours. Did you try with stop3?

I'm not sure but, looking for 802.15.4 Star Network Demo code, I found the settings for low power about SPMSC and IGC, and I saw that there is a interrupt to manage:

file : igc.c

__interrupt void FLL_Lost_Lock_ISR(void)
{
// Setup ICG module again to prevent that system hangs forever.
ICGS1 |= 0x01; // Clear FLL lost lock interrupt

// Ensure MCU clk is stable
PowerManager_WaitForPowerUp();
}

Look at SPMSC2 settings in PWRLIB.C and PWR.C, maybe you find something.
0 Kudos

563 Views
kbu
Contributor I
my SPMSC2 problem was that I hadn't set it correctly at start up and since some bits are write-once they should have been setup earlier.

So far I've only been able to get the micro into Stop3, it just doesn't get into Stop2.

I'm still getting a very high current of 1.2 mA when it goes to stop3. (only have the radio and baluns on board, direct VCC from bench supply)
the setup before going to sleep :
- KBI Off
- LVD off
- using internal MCU clock (SCM mode down to 60kHz)
- Radio off

what current consumption are you seeing?
0 Kudos

563 Views
rocco
Senior Contributor II
Hi, kbu:

It may be an obvious question, but did use set all of your unused I/O pins as outputs?

The I/O pins will power-up configured as inputs, and will suck current if not pulled to Vcc or ground. My understanding is that, as an input, the pin's current will be relative to how far its input voltage is from either rail, and they could drift toward the midpoint if ignored.
0 Kudos

563 Views
kbu
Contributor I
Yep all i/o pins set to output. I can measure a slightly higher voltage if I configure them as inputs while sleeping. but only 100uA's or so.
Right now my board is all the way up at 1mA.
0 Kudos