你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【板卡测评】STEVAL-STWINKT1B 上电后任意工具读出 ACC/GYRO/MAG 实时数据并截图

[复制链接]
知识不仅闹 发布时间:2026-3-4 09:59

首先我们先下载官方固件和keil的包

我使用keil5来编程使用keil5还需要相关的包

这个是官方历程包

https://my.feishu.cn/docx/Z2Ped7pZXojJq0xX8Y5c0xHGnAd#share-FEl6dOUNcoemisxXSOqcv11wnDg

这个是keil5L4的pack包

https://my.feishu.cn/docx/Z2Ped7pZXojJq0xX8Y5c0xHGnAd#share-EHI2d0kTAozTZ5xAa14cvPkZnxd

选择例程修改

这里我们DataLog进行修改

1280X1280.PNG

这里我们关注其中的串口打印

static void WriteData_Thread(void const *argument)
{
  (void) argument;
  osEvent evt;
  T_SensorsData *rptr;
  int size;
  char data_s[256];

  for (;;)
  {
    evt = osMessageGet(dataQueue_id, osWaitForever);  // wait for message
    if (evt.status == osEventMessage)
    {
      if(evt.value.v == MSG_ENABLE_DISABLE)
      {
        if (SD_Log_Enabled) 
        {
          DATALOG_SD_Log_Disable();
          SD_Log_Enabled=0;
        }
        else
        {
          while(SD_Log_Enabled != 1)
          {
            if(DATALOG_SD_Log_Enable())
            {
              SD_Log_Enabled=1;
              osDelay(100);
              dataTimerStart();
            }
            else
            {
              DATALOG_SD_Log_Disable();
              DATALOG_SD_DeInit();
              DATALOG_SD_Init();
              osDelay(100);
            }
          }
        }
      }
      else
      {
      rptr = evt.value.p;

      if(LoggingInterface == USB_Datalog)
      {
//        size = sprintf(data_s, "TimeStamp: %ld\r\n Acc_X: %d, Acc_Y: %d, Acc_Z :%d\r\n Gyro_X:%d, Gyro_Y:%d, Gyro_Z:%d\r\n Magn_X:%d, Magn_Y:%d, Magn_Z:%d\r\n Press:%5.2f, Temp:%5.2f, Hum:%4.1f\r\n",
//                       rptr->ms_counter,
//                       (int)rptr->acc.x, (int)rptr->acc.y, (int)rptr->acc.z,
//                       (int)rptr->gyro.x, (int)rptr->gyro.y, (int)rptr->gyro.z,
//                       (int)rptr->mag.x, (int)rptr->mag.y, (int)rptr->mag.z,
//                       rptr->pressure, rptr->temperature, rptr->humidity);
                                size = sprintf(data_s,"test : %d, %d, %d \r\n",(int)rptr->gyro.x, (int)rptr->gyro.y, (int)rptr->gyro.z);
        osPoolFree(sensorPool_id, rptr);      // free memory allocated for message
        BSP_LED_Toggle(LED1);
        CDC_Transmit_FS(( uint8_t * )data_s, size);
      }
        else
        {
          size = sprintf(data_s, "%ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %5.2f, %5.2f, %4.1f\r\n",
                       rptr->ms_counter,
                       (int)rptr->acc.x, (int)rptr->acc.y, (int)rptr->acc.z,
                       (int)rptr->gyro.x, (int)rptr->gyro.y, (int)rptr->gyro.z,
                       (int)rptr->mag.x, (int)rptr->mag.y, (int)rptr->mag.z,
                                           rptr->pressure, rptr->temperature, rptr->humidity);
          osPoolFree(sensorPool_id, rptr);      // free memory allocated for message
          DATALOG_SD_writeBuf(data_s, size);
    }
  }
}
  }
}

这里主要将我们需要的信息通过打印出来

size = sprintf(data_s,"test : %d, %d, %d \r\n",(int)rptr->gyro.x, (int)rptr->gyro.y, (int)rptr->gyro.z);

这里需要使用任意工具,我们使用的vofa来将我们的传感器数据给打印出来。

这里我们选择FireWater,其中消息格式根据,才能被串口识别到

e8f533fe-09d6-47a1-9431-2ee7b7cc56d0.png

我们看到其中的数据在变化。

这里通过动图来展示一下,论坛好像不支持gif

这里的红色的柱形图是ACC绿色的是GYR蓝色的是MAGimage.png

收藏 评论0 发布时间:2026-3-4 09:59

举报

0个回答

所属标签

相似分享

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版