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.

MSP430F5529: 使用MSP430和TDC7201-ZAX-EVM结合进行激光测距,运行MSP430自带的例子程序会报如下错误:

Part Number: MSP430F5529
Other Parts Discussed in Thread: TDC7201-ZAX-EVM, , TDC7201

使用MSP430和TDC7201-ZAX-EVM结合进行激光测距,运行MSP430自带的例子程序会报如下错误:

gmake[1]: *** [tof.out] Error 2
makefile:221: recipe for target 'tof.out' failed
makefile:217: recipe for target 'all' failed
gmake: *** [all] Error 2

已经按照网上说的方法检查了路径安装问题但还是无法解决

  • 您好

    根据您提供的信息,您在使用MSP430F5529和TDC7201-ZAX-EVM进行激光测距时遇到了编译错误。这个错误是在makefile的执行过程中出现的,具体是在生成目标文件'tof.out'和'all'时失败了。

    首先,让我们澄清一下,您检索到的错误信息中关于ESP32-C3 TRM的内容与您的MSP430F5529和TDC7201-ZAX-EVM问题不直接相关。这可能是因为知识库检索工具返回了一些不太相关的结果。

    针对您的MSP430F5529和TDC7201-ZAX-EVM问题,这里有几个可能的解决步骤:

    1. 检查Makefile‌:

      • 确保makefile中的路径设置正确,特别是与编译器、链接器和其他工具链相关的路径。
      • 检查makefile中是否有针对特定硬件或软件版本的特定设置,这些设置可能需要根据您的开发环境进行调整。
    2. 编译器和工具链‌:

      • 确保您安装了正确版本的编译器和工具链,这些通常与您的MSP430F5529开发板或评估板配套提供。
      • 如果可能,尝试更新或重新安装编译器和工具链。
    3. 依赖库和头文件‌:

      • 检查您的项目中是否包含了所有必要的依赖库和头文件。这些通常位于特定的文件夹中,并需要在makefile中正确引用。
      • 确保这些依赖库和头文件与您的开发环境和硬件兼容。
    4. 清理和重新构建‌:

      • 在尝试重新编译之前,清理您的构建目录。这通常涉及删除所有编译生成的文件(如.o文件和可执行文件)。
      • 使用make clean命令(如果makefile中定义了该命令)来清理构建目录。

    希望这些步骤能帮助您解决问题。如果问题仍然存在,请提供更多的错误信息和上下文,以便进行更深入的分析。

  • 您好,这边硬件代码错误修改已完毕。想问下如果实现MSP430和TDC7201结合实现激光测距,那采用的嵌入式程序是否为下面的示例代码?

    #include <stdint.h>
    #include <string.h>
    #include <stdio.h>
    #include "TI_TDC720x.h"  
    #include "TI_MSP430.h"
    #include "TI_MSP430_hardware_board.h"
    #include "TI_MSP430_spi.h"
    #include "timer_queue.h"
    #include "tdc720x_calculation.h"
    #include "uart_commn.h"
    
    //******************************************************************************
    extern uint8_t TDC720x_reg_local_copy[];
    // default onboard clk in ns
    float tdc_clk_period = 125.0;
    float start2stop[MAX_STOPS];
    uint8_t outString[128];
    int32_t meas_result_regrs[MEAS_RESULT_REG_NUM];
    float norm_lsb;
    float ccnt;
    float mreg[13];
    float Time1,Time2,Time3,Time4,Time5,Time6;
    float Clk_count1,Clk_count2,Clk_count3,Clk_count4,Clk_count5;
    float Calibration1,Calibration2;
    float st2sp[5];
    float nlsb;
    //------------------------------------------------------------------------------
    void TDC720x_calc(uint8_t *buf, uint8_t dev)
    {
      TDC720x_build_mreg(buf);
      TDC720x_start2stopn(dev);
      print_start2stopn();
    
    }
    //******************************************************************************
    void print_start2stopn(void)
    {
      uint8_t i;
    #if 0  
      float tmp;
      for(i=0; i < MEAS_RESULT_REG_NUM; i++)
      {
        tmp = (float) meas_result_regrs[i];
        sprintf((char *)outString, "mreg[%d]: %4.6f   ", i, tmp);    
        putsUART((unsigned char *)outString,strlen((char *)outString)); 
        if (((i+1) % 3) == 0) 
        {
          sprintf((char *)outString, " \r\n");
          putsUART((unsigned char *)outString,strlen((char *)outString));      
        }
          
      }
      sprintf((char *)outString, " \r\n");
      putsUART((unsigned char *)outString,strlen((char *)outString));  
      sprintf((char *)outString, "norm_lsb: %4.6f  ", norm_lsb);
      putsUART((unsigned char *)outString,strlen((char *)outString)); 
      sprintf((char *)outString, "cal_count: %4.6f \r\n", ccnt);
      putsUART((unsigned char *)outString,strlen((char *)outString));  
    #endif
      for (i=0;i<MAX_STOPS;i++)
      {
        sprintf((char *)outString, "Start_to_Stop[%d]: %4.6f    ", i+1, start2stop[i]);
        putsUART((unsigned char *)outString,strlen((char *)outString));    
      }
      sprintf((char *)outString, " \r\n");
      putsUART((unsigned char *)outString,strlen((char *)outString));  
    }
    //计算飞行时间
    void TDC720x_start2stopn(uint8_t dev)
    {
      uint8_t n;
      
      TDC720x_normlsb(dev);
      mreg[0]  = Time1;      mreg[1] = Clk_count1; mreg[2] = Time2;
      mreg[3]  = Clk_count2; mreg[4] = Time3;      mreg[5] = Clk_count3;
      mreg[6]  = Time4;      mreg[7] = Clk_count4; mreg[8] = Time5;
      mreg[9]  = Clk_count5; mreg[10] = Time6;     mreg[11] = Calibration1;
      mreg[12] = Calibration2;
      
      st2sp[0] = nlsb * (Time1 - Time2) + tdc_clk_period * Clk_count1;
      st2sp[1] = nlsb * (Time1 - Time3) + tdc_clk_period * Clk_count2;
      st2sp[2] = nlsb * (Time1 - Time4) + tdc_clk_period * Clk_count3;
      st2sp[3] = nlsb * (Time1 - Time5) + tdc_clk_period * Clk_count4;
      st2sp[4] = nlsb * (Time1 - Time6) + tdc_clk_period * Clk_count5;
      
      // 最多5个stop
      for(n=0; n < MAX_STOPS; n++)
        start2stop[n] = norm_lsb * (meas_result_regrs[0] - meas_result_regrs[2*(n+1)]) + 
                        tdc_clk_period * meas_result_regrs[2*(n+1)-1];
    
    }
    
    //校准得到的归一化LSB值
    void TDC720x_normlsb(uint8_t dev)
    {
      uint8_t tdcbyte, cal2cy;
      
    
      // read config2 register - use local saved data
      tdcbyte = (TI_TDC720x_SPIByteReadReg(TI_TDC720x_CONFIG2_REG, dev) & CAL2MASK)>>CAL2SHFT;
      switch (tdcbyte)
      {
        case 0: 
          cal2cy = 2;
          break;
        case 1:
          cal2cy = 10;
          break;
        case 2:
          cal2cy = 20;
          break;
        case 3:
          cal2cy = 40;
        default:
          cal2cy = 10;
      }
      ccnt = (float) (meas_result_regrs[12]-meas_result_regrs[11])/(cal2cy-1);
      norm_lsb = tdc_clk_period / ccnt;  
    }
    //******************************************************************************
    void TDC720x_build_mreg(uint8_t *buf)
    {
      uint8_t i;
      mreg[0]  = Time1;     mreg[1] = Clk_count1; mreg[2] = Time2;
      mreg[3]  = Clk_count2; mreg[4] = Time3;      mreg[5] = Clk_count3;
      mreg[6]  = Time4;      mreg[7] = Clk_count4; mreg[8] = Time5;
      mreg[9]  = Clk_count5; mreg[10] = Time6;     mreg[11] = Calibration1;
      mreg[12] = Calibration2;
      for(i=0; i < MEAS_RESULT_REG_NUM; i++)
      {
        meas_result_regrs[i] = (((uint32_t) buf[3*i]) << 16) + 
                                (((uint32_t) buf[(3*i)+1]) << 8) + 
                                 (((uint32_t) buf[(3*i)+2]));
      }
    }

  • 您好

    您可以参考这个代码的相关算法。

  • 示例代码中的Time1~Time6及等式右边的这些变量是在TDC7201收到激光发射信号和回波信号后就能直接得到吗?需要自己再修改代码定义并计算这些参数吗?

     mreg[0]  = Time1;     mreg[1] = Clk_count1; mreg[2] = Time2;
      mreg[3]  = Clk_count2; mreg[4] = Time3;      mreg[5] = Clk_count3;
      mreg[6]  = Time4;      mreg[7] = Clk_count4; mreg[8] = Time5;
      mreg[9]  = Clk_count5; mreg[10] = Time6;     mreg[11] = Calibration1;
      mreg[12] = Calibration2;

  • 您好

    https://www.ti.com/lit/ds/symlink/tdc7201.pdf

    根据TDC7201说明有相关数据。请您参考,您可以根据您的情况定义符合您的编程习惯的变量名。