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.

[参考译文] MSP430F5259:器件的调试接口已保护。

Guru**** 2387520 points
Other Parts Discussed in Thread: MSP430F5259, MSP-FET
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1263658/msp430f5259-the-debug-interface-to-the-device-has-been-secured

器件型号:MSP430F5259
主题中讨论的其他器件: MSP-FET

您好!

在 msp430F5259芯片组项目板上载代码时出现错误。

错误为("MSP430:连接到目标时出错:器件的调试接口已被保护")

我从事闪存读/写操作,而我在 BSL 3上写入数据,并打开和关闭我的项目板和 MSP-FET 闪存仿真工具,这种错误是连续发生的。

在这里、我提供了我在芯片组中转储的代码、之后我得到了这个错误、我无法再次访问我的器件。

#include <msp430.h>
#define Segment 1

char FW_ver = 2;
char fw;
char data[] = {0x07,0x01,0x00,0x02,0x74,0x00,0x42,0x43};
char value = 'B';
char pre_value;
_Bool FW_update_flag = 0;

void main(void)
{
    WDTCTL = WDTPW+WDTHOLD;
	//    write_seg1(data);
    read_segment();
    write_Seg2(value, fw, FW_ver);
    if(FW_update_flag == 1){
        update_fw(data);
    }
      __no_operation();                       // Loop forever, SET BREAKPOINT HERE
}


void read_segment()
{
  char *Flash_ptr1;                           // Flash pointer
  Flash_ptr1 = (char *)0x1801;               // Initialize flash pointer
  pre_value = *Flash_ptr1;
  fw = pre_value;
  __no_operation();
}

void write_seg1(char data[])
{
  unsigned int i;
  char * Flash_ptr2;                         // Initialize Flash pointer
  Flash_ptr2 = (char *) 0x1800;
  FCTL3 = FWKEY;                            // Clear Lock bit
  FCTL1 = FWKEY+ERASE;                      // Set Erase bit
  *Flash_ptr2 = 0;                          // Dummy write to erase Flash seg
  FCTL1 = FWKEY+WRT;                        // Set WRT bit for write operation

  for (i = 0; i < 8; i++)
  {
     char pkt = data[i] ;
    *Flash_ptr2++ = pkt;                    // Write value to flash
    __no_operation();
  }
  FCTL1 = FWKEY;                            // Clear WRT bit
  FCTL3 = FWKEY+LOCK;                       // Set LOCK bit
  __no_operation();
}

void write_Seg2(char value, char fw, char FW_ver)
{
  if(fw != FW_ver)
  {
      __no_operation();
      unsigned int i;
      char * Flash_ptr3;                         // Initialize Flash pointer
      Flash_ptr3 = (char *) 0x1600;
      SYSBSLC = FWKEY+SYSBSLPE;
      FCTL3 = FWKEY;                            // Clear Lock bit
      FCTL1 = FWKEY+ERASE;                      // Set Erase bit
      *Flash_ptr3 = 0;                           // Dummy write to erase Flash seg
      FCTL1 = FWKEY+WRT;                        // Set WRT bit for write operation
      for(i = 0; i < (Segment*512); i++)
          {
              *Flash_ptr3++ = value;                   // Write value to flash
              __no_operation();
          }
      FCTL1 = FWKEY;                            // Clear WRT bit
      FCTL3 = FWKEY+LOCK;                       // Set LOCK bit
      __no_operation();
      data[1] = FW_ver;
      FW_update_flag = 1;
  }
}

void update_fw(char data[])
{
      unsigned int i;
      char * Flash_ptr4;                         // Initialize Flash pointer
      Flash_ptr4 = (char *) 0x1800;
      FCTL3 = FWKEY;                            // Clear Lock bit
      FCTL1 = FWKEY+ERASE;                      // Set Erase bit
      *Flash_ptr4 = 0;                          // Dummy write to erase Flash seg
      FCTL1 = FWKEY+WRT;                        // Set WRT bit for write operation
      for (i = 0; i < 8; i++)
        {
           char pkt = data[i] ;
          *Flash_ptr4++ = pkt;                  // Write value to flash
        }
      FCTL1 = FWKEY;                            // Clear WRT bit
      FCTL3 = FWKEY+LOCK;                       // Set LOCK bit
      FW_update_flag = 0;
}

任何人可以帮助我解决我的问题吗?

他会感激我的。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我能看到的唯一直接的事情是

        __no_operation():
    不会永久循环。 我通常不会这样做
        while (1);
    、但我也看到有人将 MSP430置于低功耗状态。

    所以您的代码将运行到最后、不确定会发生什么、我想会生成一个故障、故障处理程序将对其进行处理、我想这是默认的故障处理程序-不确定会是什么、 但认为它可能只是一个循环永远-我需要检查...