This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 program automatically running after dumping without me pressing the run button

Other Parts Discussed in Thread: MSP430F5528

Hello

I tried to dump the program in MSP430F5528. The program gets compiled and linked successfully but after dumping it is not running into main. It is stuck into infinite loop in data memory when I put break. I am sending the C code. Please check and help me resolve the issue.

Thanks

SPI_AFE_registers.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <msp430.h>
#include "math.h"
#include "driverlib.h"
void AFE44xx_PowerOn_Init(void);
void Init_AFE44xx_DRDY_Interrupt(void);
void Init_AFE44xx_Resource(void);
void AFE44xx_Default_Reg_Init(void);
void Enable_AFE44xx_DRDY_Interrupt(void);
void Disable_AFE44xx_DRDY_Interrupt (void);
void AFE44xx_Reg_Write (unsigned char reg_address, unsigned long data);
unsigned long AFE44xx_Reg_Read(unsigned char Reg_address);
void Init_Clock(void);
void Set_GPIO(void);
void Set_UCB1_SPI(void);
void TI_AFE_SPIWriteReg(char addr, unsigned long value) ;
void hyperterminal_trans(signed long);
void convert_hex_ascii(signed long);
unsigned char MST_Data,SLV_Data;
unsigned char temp;
//double x;
unsigned int read_index=0;
unsigned int i;
double AFE44xx_Data_buf;
double output[700];
double AFE44xx_Data[700];
double x1=0,x2=0,x3=0,x4=0,y1=0,y2=0,y3=0,y4=0,mean=0;
double a[5]={1,-3.937196864436783,5.814107469382095,-3.816605103351482,0.939694595124756};
double b[4]={0.00468952844350029,0,-0.00937905688700058,0};
/*int low_level_init(void){
WDTCTL=WDTPW+WDTHOLD;
return 1;
}*/
#define AFE_RESETZ BIT3
#define AFE_PDNZ BIT4
#define AFE_ADC_DRDY BIT5
#define AFE_PD_ALM BIT6
#define AFE_LED_ALM BIT7
#define AFE_DIAG_END BIT2
#define DELAY_COUNT 2
//#define AFE_READ_BIT 0x80
//#define AFE_WRITE_BIT 0x7F
//#define AFE_ADC_RDY 0x1C
unsigned char readDataFlag=0;
unsigned long AFE44xx_Default_Register_Settings[49] =
{
//Reg0: CONTROL0: CONTROL REGISTER 0
0x00000,
//Reg1:REDSTARTCOUNT: SAMPLE RED START COUNT
6000,
//Reg2:REDENDCOUNT: SAMPLE RED END COUNT
7599,
//Reg3:REDLEDSTARTCOUNT: RED LED START COUNT
6000,
//Reg4:REDLEDENDCOUNT: RED LED END COUNT
7999,
//Reg5:AMBREDSTARTCOUNT: SAMPLE AMBIENT RED START COUNT
0,
//Reg6:AMBREDENDCOUNT: SAMPLE AMBIENT RED END COUNT
1599,
//Reg7:IRSTARTCOUNT: SAMPLE IR START COUNT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Does it behave the same way when you uncomment low level init function which disables watchdog timer early?
    /*int low_level_init(void){
    WDTCTL=WDTPW+WDTHOLD;
    return 1;
    }*/
  • Hi

    Ya with those lines uncommented also the program is behaving the same way.Can you please check it on your side and rectify the issue?

    Thanks

    Arnab

  • >Can you please check it on your side and rectify the issue?
    No. Why should I?
    One more thing you shall check: debugger options. "Run into main()" shall be enabled. Also check that CPU type is set properly, check stack size and it's usage. Also check where exactly debugger program is stuck in the infinite loop, what part of your or library/startup code it is, try to think of reasons why it is stuck there.

  • Hi

    I have checked that my program is everytime stuck at __data20_memzero: section but couldn't figure out whats the reason. I checked the stack also but there is no overflow there. I checked the debugger options also and there Run to main() is enabled.I am sending the screenshot. Please let me know if you can figure out the same.

    Thanks

    Arnab

  • Your debugger screen shows "Fet Connection Lost". It means that for some reason your chip/program is reset, most probably stuck in continuous reset/crash loop - that's why you think it is looping in the init part of the code. Typical reason is Watchdog kicking in before C init is done due to huge size of variable memory. In your case I see two double arrays of 700 elements. This is huge for msp430 at default 1MHz.

    Your problem most probably is improper name of low level init function. It shall look like this:

    int __low_level_init(void) {
    WDTCTL = WDTPW + WDTHOLD;
    return 1;
    }
    

  • Hi

    Actually I had taken the screenshot in my PC after disconnecting the debugger from my board. Thats why you see the message FET connection lost. I will change the low_level_init syntax and see if it works.

    Thanks

    Arnab

  • Hi

    The problem got resolved. Thanks for your prompt response.

    Thanks

    Arnab

**Attention** This is a public forum