在测试过程中发现在while(1)循环里面延时200ms就会出现数据无法读取的情况,延时100ms就可以正常读取,很奇怪,但是不知道为什么,这边先记下来,如果后面知道为什么再补充上来。
PS:有大佬知道的话可以再直接在评论区里面帮忙回答一下,非常感谢!
main.c
/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>
/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* Hardware Includes */
#include "systick.h"
#include "adc.h"
#include "beep.h"
#include "capture.h"
#include "exti.h"
#include "key.h"
#include "led.h"
#include "pwm.h"
#include "timer32.h"
#include "timera.h"
#include "usart.h"
#include "bluetooth_uart.h"
#include "inv_mpu.h"
#include "dmpctl.h"
#include "mpuI2C.h"
#include "draw_api.h"
#include "test.h"
#include "track.h"
#include "cJSON.h"
/* Variables defined elsewhere */
/* Variables defined elsewhere */
/* global variable */
uint8_t Init_Over = 0; //系统初始化完成标志 1-完成 0-未完成
extern char UART2_RX_BUF[UART2_RECEIVE_LEN_MAX]; //接收缓冲,最大UART1_RECEIVE_LEN_MAX字节
extern uint8_t overflag;
/* global variable */
int main(void) { //以下是各功能的测试
/* local variable */
long time=0;
cJSON *Position;
cJSON *_Roll,*_Pitch;
/* Start of system initialization */
LED_Init(); //LED初始化,用来验证某个模块是否工作
systick_config(); //滴答定时器初始化
uart0_init(); //串口0初始化
Bluetooth_Init(115200);
IIC_Init();
TIM32_1_Int_Init(3000,TIMER32_PRESCALER_16); //每1ms秒进入一次Timer32中断
/* End of system initializatioan */
/* Start to set some initial parameters */
/* End setting some initial parameters */
delay_ms(500);
mpu6050_dmp_init();
char buffer[20];
while (1) {
DMP_update();
printf("%d,%d,%d\r\n",(int)Roll,(int)Pitch,(int)Yaw);
delay_ms(20);
}
}