Standalone flash mode causes reset when running after STOP only at 3.3V with MC9S08PA16

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

Standalone flash mode causes reset when running after STOP only at 3.3V with MC9S08PA16

Jump to solution
1,786 Views
jonascalifornia
Contributor II

Dear Freescale Community,

 

When I program my MC9S08PA16 using “standalone flash mode”, and then power up at 3.3V, the MCU will reset when waking from a STOP instruction. This does not happen above 3.4V or below 3.2V, nor does it happen at any voltage in debug mode.

 

In my design, the MCU wakes from a STOP instruction using either an IRQ interrupt, an RTC interrupt, or a Keyboard interrupt. All show the same issue. I've ensured that the STOPE is set, enabling the STOP functionality. And when I print the reset message I receive an “illegal address” message.

 

Any thoughts? Thank you for your help.

 

Jonas

Labels (1)
0 Kudos
Reply
1 Solution
1,460 Views
jonascalifornia
Contributor II

At last ... issue identified. It is a known bug in the Power Management Section of the MCU.

mask set 4N40C, issue e4592:

--> Unstable to wake up MCU from stop3 mode with LVD disabled when the MCU power supply VDD is in the low range.

Workaround ---> Low power stop3 mode cannot be used from 2.7V to 4.2V. High power stop3 mode (both LVDE bit and LVDSE bit set) can still be used in this voltage range.

This issue will be resolved in a future silicon revision.

http://cache.freescale.com/files/microcontrollers/doc/errata/S08PT60_4N40C.pdf?&Parent_nodeId=&Paren...

Thanks all for the help!

View solution in original post

0 Kudos
Reply
7 Replies
1,460 Views
Wlodek_D_
Senior Contributor II

Dear Jonas Ketterle,

Thank you for your post, however please consider moving it to the right community place for better visibility.

For details please see general advice https://community.freescale.com/docs/DOC-99909

Thank you for using Freescale Community.

Regards,

Wlodek_D.

0 Kudos
Reply
1,460 Views
jonascalifornia
Contributor II

Thank you, I've moved the discussion to the 8-bit Microcontrollers space.

0 Kudos
Reply
1,460 Views
deepakrana
NXP Employee
NXP Employee

hi Jonas

Need the following inputs:

1) Your configuration of the SYS_SOPT1 register

2) Your PMC_SPMSC1 / SPMSC2 registers

3) Also you mention that when you print the reset message, instead of printf statment(if you are using) can you use LED or GPIO toggel to understand the mode switching. Also will like to understand that when you mention how are you printing .

Your are facing problem at one particular level of voltage( above and below works fine) so this peciular.

Thanking you

0 Kudos
Reply
1,460 Views
jonascalifornia
Contributor II

Hi Deepak Rana,

SYS_SOPT1 = 0x09;   

PMC_SPMSC1 = 0x01;

PMC_SPMSC2 = 0x00;

I am printing using the Tx1 pin, and reading the output  on my computer using a USB-UART interface.

I confirmed that the reset message is both ILAD and ILOP using only GPIO toggle.

The width of the problematic voltage is from 3.25 - 3.45V. Above and below works fine.

Thanks,

Jonas

0 Kudos
Reply
1,460 Views
deepakrana
NXP Employee
NXP Employee

hi

this calls for replicaton

will it possible for you to share a test code on which replicated this behaviour

Don't see any errata on this so will replicate and then comment further

0 Kudos
Reply
1,460 Views
jonascalifornia
Contributor II

Hi,

Below is the test code. Please check if you can replicate this behavior. I have a 0.1uF capacitor and a 100k resistor connected in parallel from the IRQ pin to GND. Charging the capacitor and then allowing it to discharge upon entering STOP triggers the IRQ interrupt to wake the MCU at a regular interval.

#include "mc9s08pa16.h"

#include <hidef.h>       /* for EnableInterrupts macro */

#include "derivative.h" /* include peripheral declarations */


__interrupt VectorNumber_Virq_wdog void IRQ_isr(void) {

         IRQ_SC_IRQACK = 1;                           // clear interrupt flag

}

void main(void) {

         SYS_SOPT1 = 0x09;                   // 00001001       BKGDPE = 1, RSTPE = 0, STOPE = 1;   // this register can only be written once, on reset

         SYS_SOPT2 = 0xB0;                   // 10110000       TXDME = 1, RXDFE = 1, RXDCE = 1     // this register can only be written once, on reset

         DisableInterrupts;

         PMC_SPMSC1 = 0x01;                  // this is supposed to be written on startup, even if all zero - enable band gap buffer

         PMC_SPMSC2 = 0x00;                  // this is supposed to be written on startup, even if all zero

         NVM_FCLKDIV_FDIV = 0x04;            // divide 5MHz down to 1MHz, datasheet setting required to read/write NVM

        

//  Disable Watchdog      

         WDOG_CNT = 0xC520;                  // write the 1st unlock word

         WDOG_CNT = 0xD928;                  // write the 2nd unlock word

         WDOG_TOVAL = 1000;                  // setting timeout value

         WDOG_CS2 = WDOG_CS2_CLK_MASK;       // setting 1-kHz clock source

         WDOG_CS1 = WDOG_CS1_EN_MASK;        // enable counter running

         WDOG_CS1_STOP = 0;                  // disable Watchdog in stop

         WDOG_CS1_UPDATE = 1;                // allow sw to disable the watchdog

         WDOG_CS1_EN = 0;                    // disable the Watchdog

        

//  Configure System Clock

         ICS_C1 = 0x04;                      // 00000100 - default settings

         ICS_C2_BDIV = 2;                    // divide bus clock by 4 --> 20MHz/4 = 5Mhz

         ICS_C3 = 0x4C;                      // trim internal reference clock here ... using oscilloscope

//  configure output ports

         PORT_PTCOE_PTCOE7 = 1;              // enable port C7 as output - TxD  

         PORT_PTAOE_PTAOE5 = 1;              // enable port A5 as output - RTI  

         PORT_PTAD_PTAD5 = 1;                // output high on A5 to charge - RTI

        

//  configure UART

         SCI1_BDH_SBNS = 0;                                    // 1 stop bit

         SCI1_C1_LOOPS = 0;                                    // separate RxD and TxD pins

         SCI1_C1_M = 0;                                        // 8 data bits

         SCI1_C1_PE = 0;                                       // data parity check enable

         SCI1_BD = 8;                                          // baud rate is 5000000/(8*16) = 39062.5, use 40000 in Docklight, 38400 in Bootloader

         SCI1_C2_TIE = 1;                                      // transmit interrupt when buffer is empty

         SCI1_C2_RIE = 1;                                      // receive interrupt when data is received

         SCI1_C2_TE = 1;                                       // enable transmitter

         SCI1_C2_RE = 1;                                       // enable receiver

         SCI1_C2_TIE = 0;                                      // will get turned on by a message

         EnableInterrupts;

         for(;;) {

                  PORT_PTAOE_PTAOE5 = 0;              // disable port A5 as output - RTI          

                  RTC_SC1_RTIE = 0;                   // disable RTC interrupt

                  IRQ_SC = 0x52;                      // 01010010, disable pullup, falling edge, enable IRQ pin, clear flag, interrupt enable, edges only

                  _Stop;

           IRQ_SC = 0x00;                      // disable IRQ

                  PORT_PTAOE_PTAOE5 = 1;              // enable port A5 as output - RTI           

                  PORT_PTAD_PTAD5 = 1;                // set port high to charge RTI

}

}

Thanks! Jonas

0 Kudos
Reply
1,461 Views
jonascalifornia
Contributor II

At last ... issue identified. It is a known bug in the Power Management Section of the MCU.

mask set 4N40C, issue e4592:

--> Unstable to wake up MCU from stop3 mode with LVD disabled when the MCU power supply VDD is in the low range.

Workaround ---> Low power stop3 mode cannot be used from 2.7V to 4.2V. High power stop3 mode (both LVDE bit and LVDSE bit set) can still be used in this voltage range.

This issue will be resolved in a future silicon revision.

http://cache.freescale.com/files/microcontrollers/doc/errata/S08PT60_4N40C.pdf?&Parent_nodeId=&Paren...

Thanks all for the help!

0 Kudos
Reply