MC13213: RTIisr and STOP2 wakeup

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

MC13213: RTIisr and STOP2 wakeup

1,194 Views
Brodek
Contributor II

Hi,

I'm writing here because I need some help with Stop mode 2 used on a MC13213 whit SMAC code.

I think that the problem occurs when the RTI wake up the MCU from the sleep mode. 

 

I've configured all the register needed to put the MCU in stop mode 2 in the SPMSC2 register and also configured RTI with 1,024s period using internal oscillator.  Before entering in stop mode using

__asm("STOP")  introduction (is the instruction correct?) I switch to the internal clock generator for the MCU and then I put the radio modem in hibernate mode (when MCU operate normally I use Modem clock generator). To wake and transmit data I use  RTI ISR to refresh a simple tick counter but after using stop instruction the module simply sleep forever.

 

Where I'm wrong??

 

Thank, Walter.

 

ps: sorry for my English!!

Labels (1)
0 Kudos
2 Replies

382 Views
Brodek
Contributor II

This is my startup code. I don't save any registe because I want only to wake up the MCU from stop2!! To see if the MCU exit from stop2 I use an amperometer ( if the code works right I expect fluctuation in the current value but now I only read a fixed 0,5mA current absorbed by the 13213-SRB board).

 

Where I'm wrong?

 

 

__EXTERN_C void _Startup(void){asm{  LDX #initSOPT;  STX SOPT;      LDX #initSPMSC1;  STX SPMSC1;    LDA IRQSC  ORA #$10   //IRQ ON  STA IRQSC       LDX #$17   //RTI CFG   STX SRTISC     LDA SPMSC2;  AND #$08; //check PPDF  BEQ Start_App;               INIT:           //if i'm coming from stop 2   LDA     initSPMSC2; //enable stop2   ORA     #$07;   STA     SPMSC2;   JMP main;     Start_App:   //Init stop mode ( first execution )   LDA     initSPMSC2; //enable stop2   ORA     #$03;   STA     SPMSC2;       end:       JMP main;     }/****************************************************************/#include "MC9S08GB60.h"void main(void){            for(;;){                                    SRTISC = 0x57;            asm{              stop            }                      }};

 

 

 

0 Kudos

382 Views
Brodek
Contributor II

News! now the MCU restart from stop2 mode,I control the SPMSC2 register to control if I'm coming from the stop2 mode in the __Startup procedure called by the .prm file but the MCU return in main procedure and the program lost itself in some memory location.

 

It's possible that the problem is related to the fact I don't save the system registers?? I'm not doing the reg save procedure because I first want to see if the MCU recover and then go in the right procedure called from __Startup procedure ( vector 0 ) but if when RTI produce a POR reset the MCU go in the main I'm think that the problem is another one.

 

help!

0 Kudos