TI中文支持网
TI专业的中文技术问题搜集分享网站

TM4C123GH6PM控制MPU9150,调试工具为CCS8.3.0,mpu9150.c 文件中无法增加断点

        用TM4C123GH6PM对MPU9150进行控制和数据读取,用官方给的例程和sensorlib库,所用软件为CCS 8.3.0 。程序运行正常,数据读取正常,数据输出结果正常。

        但在mpu9150.c文件中增加断点都是无效的。具体程序分两个部分贴出:

一、main.c中部分程序,对MPU9150进行设置
void MPU9150CFG(void) {// Initialize the MPU9150 Driver.MPU9150Init(&g_sMPU9150Inst, &g_sI2CInst, MPU9150_I2C_ADDRESS, I2C3Callback, &g_sMPU9150Inst);I2C3Wait(__FILE__, __LINE__);// Write application specifice sensor configuration such as filter settings// and sensor range settings.g_sMPU9150Inst.pui8Data[0] = MPU9150_CONFIG_DLPF_CFG_94_98;g_sMPU9150Inst.pui8Data[1] = MPU9150_GYRO_CONFIG_FS_SEL_250;g_sMPU9150Inst.pui8Data[2] = (MPU9150_ACCEL_CONFIG_ACCEL_HPF_5HZ | MPU9150_ACCEL_CONFIG_AFS_SEL_2G);MPU9150Write(&g_sMPU9150Inst, MPU9150_O_CONFIG, g_sMPU9150Inst.pui8Data, 3, I2C3Callback, &g_sMPU9150Inst);I2C3Wait(__FILE__, __LINE__);// Configure the data ready interrupt pin output of the MPU9150.g_sMPU9150Inst.pui8Data[0] = MPU9150_INT_PIN_CFG_INT_LEVEL | MPU9150_INT_PIN_CFG_INT_RD_CLEAR | MPU9150_INT_PIN_CFG_LATCH_INT_EN;g_sMPU9150Inst.pui8Data[1] = MPU9150_INT_ENABLE_DATA_RDY_EN;MPU9150Write(&g_sMPU9150Inst, MPU9150_O_INT_PIN_CFG, g_sMPU9150Inst.pui8Data, 2, I2C3Callback, &g_sMPU9150Inst);// Wait for transaction to completeI2C3Wait(__FILE__, __LINE__);// Initialize the DCM system. 50 hz sample rate.// accel weight = .2, gyro weight = .8, mag weight = .2 }


二、mpu9150.c中部分程序,主要对MPU9150进行初始化,MPU9150的初始化函数为 MPU9150Init()
//*****************************************************************************
//
//! Initializes the MPU9150 driver.
//!
//! \param psInst is a pointer to the MPU9150 instance data.
//! \param psI2CInst is a pointer to the I2C master driver instance data.
//! \param ui8I2CAddr is the I2C address of the MPU9150 device.
//! \param pfnCallback is the function to be called when the initialization has
//! completed (can be \b NULL if a callback is not required).
//! \param pvCallbackData is a pointer that is passed to the callback function.
//!
//! This function initializes the MPU9150 driver, preparing it for operation.
//!
//! \return Returns 1 if the MPU9150 driver was successfully initialized and 0
//! if it was not.
//
//*****************************************************************************
uint_fast8_t
MPU9150Init(tMPU9150 *psInst, tI2CMInstance *psI2CInst,uint_fast8_t ui8I2CAddr, tSensorCallback *pfnCallback,void *pvCallbackData)
{//// Initialize the MPU9150 instance structure.//psInst->psI2CInst = psI2CInst;psInst->ui8Addr = ui8I2CAddr;//// Save the callback information.//psInst->pfnCallback = pfnCallback;psInst->pvCallbackData = pvCallbackData;//// Default range setting is +/- 2 g//psInst->ui8AccelAfsSel = (MPU9150_ACCEL_CONFIG_AFS_SEL_2G >>MPU9150_ACCEL_CONFIG_AFS_SEL_S);psInst->ui8NewAccelAfsSel = (MPU9150_ACCEL_CONFIG_AFS_SEL_2G >>MPU9150_ACCEL_CONFIG_AFS_SEL_S);//// Default range setting is +/- 250 degrees/s//psInst->ui8GyroFsSel = (MPU9150_GYRO_CONFIG_FS_SEL_250 >>MPU9150_GYRO_CONFIG_FS_SEL_S);psInst->ui8NewGyroFsSel = (MPU9150_GYRO_CONFIG_FS_SEL_250 >>MPU9150_GYRO_CONFIG_FS_SEL_S);//// Set the state to show we are initiating a reset.//psInst->ui8State = MPU9150_STATE_INIT_RESET;//// Load the buffer with command to perform device reset//psInst->uCommand.pui8Buffer[0] = MPU9150_O_PWR_MGMT_1;psInst->uCommand.pui8Buffer[1] = MPU9150_PWR_MGMT_1_DEVICE_RESET;if(I2CMWrite(psInst->psI2CInst, psInst->ui8Addr,psInst->uCommand.pui8Buffer, 2, MPU9150Callback, psInst) == 0){psInst->ui8State = MPU9150_STATE_IDLE;return(0);}//// Success//return(1);
}

        程序在进入MPU9150CFG函数,首先对MPU9150进行初始化,因此程序会跳入mpu9150.c 文件中执行 MPU9150Init()。但我在 MPU9150Init()中设置断点的时候,断点都是无效的,断点显示为灰色,且有感叹号,并且会出现以下字符:“[ S/W  BP –  disabled ]”     请问这是为什么,这问题已经卡了一周了,请帮帮我。

Susan Yang:

回复 user5764665:

很高兴您能解决问题,谢谢您分享答案

xyz549040622:

回复 user5764665:

你这个情况,确实有可能。我不习惯用link的方式,这样不可控,而且在复制工程的时候容易遗漏文件。

赞(0)
未经允许不得转载:TI中文支持网 » TM4C123GH6PM控制MPU9150,调试工具为CCS8.3.0,mpu9150.c 文件中无法增加断点
分享到: 更多 (0)