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.

[参考译文] CCS/LAUNCHXL-CC2650:IMU MPU9250读取阻止蓝牙广播的命令。

Guru**** 2782445 points

Other Parts Discussed in Thread: CC2650, TMP102

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/654275/ccs-launchxl-cc2650-imu-mpu9250-reading-command-blocking-the-bluetooth-advertisement

器件型号:LAUNCHXL-CC2650
Thread 中讨论的其他器件:CC2650TMP102

工具/软件:Code Composer Studio

你(们)好

我有使用 Launchpad 的工作代码 MPU9250。 现在、我想添加通过蓝牙将 IMU MPU9250数据发送到 Android 设备的功能。  因此、我将 IMU MPU9250代码添加到 CC2650 Launchpad 的 Project_ZERO 中。 但现在我遇到了一个问题。 问题是,当我在 Projectzero_taskFxn()中添加用于读取 IMU 数据的代码时,它会阻止蓝牙。 它不是广告。 单独地说、我的 IMU 代码运行正常、但为什么我遇到这个问题。 我的 Task_function 代码如下所示。 谢谢你

静态空 ProjectZero_taskFxn (UARg a0、UARg A1)

 

//初始化应用程序

 ProjectZero_init();

 txBuffer[0]= TMP007_obj_TEMP;

  i2cTransaction。slaveAddress = Board_MPU9250_ADDR;//Board_TMP007_ADDR;

  i2cTransaction.writeBuf = txBuffer;

  i2cTransaction.writeCount = 1;

  i2cTransaction.readBuf = rxBuffer;

  i2cTransaction.ReadCount = 2;

 //应用程序主循环

 对于(;)

 {

   //等待与调用线程关联的信号量。

   //请注意、当发出信号时、与线程关联的信号量会发出信号

   //消息在线程的消息接收队列中排队,或在何时排队

   // iCall_signal ()函数被调用到信号量上。

   iCall_errno errno = iCall_Wait (ICALL_TIMEOUT_FOREVAL);

   if (errno =ICALL_errno_Success)

   {

     iCall_EntityID dest;

     iCall_ServiceEnum src;

     iCall_HciExtEvt *pMsg =空;

     //检查我们是否由于堆栈消息而获得信号

     if (iCall_fetchServiceMsg (&src、&dest、

                               (void **)&pMsg)=ICALL_errno_Success)

     {

       uint8 safeToDealloc = true;

       IF (((src =ICALL_SERVICE_CLASS_BLE)&&(dest =self Entity))

       {

         iCall_Stack_Event *pEvt =(iCall_Stack_Event *) pMsg;

         //检查接收到的事件标志(事件签名0xFFFF)

         if (pEvt->signature == 0xFFFF)

         {

           //完成连接事件时接收到的事件

           if (pEvt->EVENT_FLAG & PRZ_CONN_EVT_END_EVT)

           {

             //尝试重新发送待处理的 ATT 响应(如果有)

             ProjectZero_sendAttRsp();

           }

         }

         否则//它是来自堆栈的消息,而不是事件。

         {

           //处理任务间消息

           safeToDealloc = ProjectZero_processStackMsg ((iCall_HDR *) pMsg);

         }

       }

       if (pMsg && safeToDealloc)

       {

         iCall_freeMsg (pMsg);

       }

     }

     //处理从另一个任务或另一个上下文发送的消息。

     while (!Queue_empty (hApplicationMsgQ))

     {

       app_msg_t *pMsg = Queue_dequeue (hApplicationMsgQ);

       //处理可能从我们自己发送的应用层消息。

       USER_processApplicationMessage (pMsg);

       //释放收到的消息。

       iCall_free (pMsg);





       

       // IMU 读数

       if (I2C_transfer (i2c、&i2cTransaction)){

                   /*从接收到的数据中提取°C;请参阅 TMP102数据表*/

                   温度=(rxBuffer[0]<< 6)|(rxBuffer[1]>> 2);

                   mpuIntStatus = SensorMpu9250_irqStatus ();

                   IF (mpuIntStatus)

                          {

                     uint8_t 范围= SensorMpu9250_accReadRange ();

                       //   ("加速计范围:%u\n");

                            //读取陀螺仪数据

                            SensorMpu9250_gyroRead ((uint16_t*) sensorData);

                            //读取加速计数据

                            SensorMpu9250_accRead ((uint16_t*) sensorData[6]);

                            mpuDataRdy = false;

                                        if (appState == app_State_active)

                                        {

                                          uint8_t status;

                                          状态= SensorMpu9250_magRead ((int16_t*)&sensorData[12]);

                                          //始终测量磁力计(非中断驱动)

                                          如果(status =mag_bype_fail)

                                          {

                                            //出错时空闲

                                            nActivity = 0;

                                            appState = app_State_error;

                                          }

                                          否则(状态!= mag_status_OK)

                                          {

                                            SensorMpu9250_magReset ();

                                          }

                                        }

                                      //}

                             }

                   /*

                    *如果 MSB 设置为"1"、则我们有二进制补码

                    *需要符号扩展的负值

                    *

                   if (rxBuffer[0]& 0x80){

                       温度|= 0xF000;

                   }

                  /*

                   *为简单起见、将温度值除以32即可摆脱

                   *十进制精度;请参阅 TI 的 TMP007数据表

                   *

                   温度;///= 32;

                    destination[0]=((int16_t) sensorData[7]<< 8)| sensorData[6]; //将 MSB 和 LSB 转换为有符号16位值

                     目的[1]=((int16_t) sensorData[9]<< 8)| sensorData[8];

                     destination[2]=((int16_t) sensorData[11]<< 8)| sensorData[10];

                     int16_t accx = destination[0](16.0/32768.0);

                     int16_t accy = destination[1]*(16.0/32768.0);

                     int16_t accz = destination[2]*(16.0/32768.0);

                                 }

               否则{

                   LOG_info0 ("I2C 总线故障"n);

               }

               //Task_sleep (50000 / Clock_tickPeriod);









     }

   }

  

 }




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

    我建议使用调试器来确认初始化已成功进行、并且您不会遇到任何副作用、例如任务堆栈溢出或 HWI 中止。 如果您编码甚至成功启动了堆栈并配置了广播、也不清楚。

    祝你一切顺利