MSP430 large array does not start when powered on

Publisher:幸福微风Latest update time:2018-04-28 Source: eefocusKeywords:MSP430 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Phenomenon: After the program is burned into the board, the MCU does not start and freezes. It can only run after commenting out some byte arrays.

analyze:

          This is the IAR compilation method, which causes the watchdog to overflow. The watchdog is activated as soon as the MSP430 microcontroller is powered on, but before entering the main() function, the software will initialize some data used, such as arrays. If the number is defined to be large and the initialization time is long, it may cause the watchdog to overflow, the microcontroller resets, then restarts, initializes again, overflows again, and resets again... The program will never enter the main function.

Solution:

          Use the low-level initialization function: int __low_level_init(void). This function will automatically place the low-level initialization function at the very beginning of the program, where the watchdog can be turned off. After the low-level initialization function is executed, data initialization will be performed, and finally the main() function will be entered.

void main()

{

}

int __low_level_init(void)  
{  
  WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT  
  /* Insert your low-level initializations here */ 

  /*  
   * Return value:  
   *  
   *  1 - Perform data segment initialization.  
   *  0 - Skip data segment initialization.  
   */ 

  return 1;  

There is no need to call this function, the compiler automatically puts it at the beginning.

Of course, you can also write in all the hardware initialization functions, so that the hardware is prepared before entering the main function, avoiding other bugs.

__no_init unsigned char  all_25665[] ={

//4K+ bytes

};


Keywords:MSP430 Reference address:MSP430 large array does not start when powered on

Previous article:MSP430 MCU Writing Info Memory
Next article:MSP430F5438A Memory Flash Read and Write Operations

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号