nucleo446re and MPU6050 i2c problem
hi..
few days ago i bought a GYRO Sensor that name is MPU6050.It use I2C Comm.I was try to connect using I2C.why 'HAL_I2C_IsDeviceReady' is always 'BUSY'?using board : Nucleo-F446RE , MPU6050
Library : HAL
----------------------------------------------HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_TIM2_Init();
MX_TIM3_Init();
MX_USART2_UART_Init();
MX_I2C1_Init();
/* USER CODE BEGIN 2 */
while
(HAL_UART_Receive_IT(&huart2, Rx_Data2, 1)!=HAL_OK
);// Activate TIMER Interrupt
while
(HAL_TIM_Base_Start_IT(&htim2)!=HAL_OK
);while
(HAL_TIM_Base_Start_IT(&htim3)!=HAL_OK
);// i2c1 setting
uint8_t
whoAmI[2];// whoAmI[0] = RA_PWR_ADDR;
// whoAmI[1] = RA_PWR_MGMT_1;
uint8_t
pdata=0x00;while(HAL_I2C_IsDeviceReady(&hi2c1,MPU6050,10,1000)!=HAL_OK);
HAL_I2C_Master_Transmit_DMA(&hi2c1,MPU6050,&pdata,1);
HAL_I2C_Mem_Write_DMA(&hi2c1,MPU6050>>1,RA_PWR_ADDR,1,&pdata,1);
HAL_UART_Transmit(&huart2, (
uint8_t
*)''\r\n11111!!!!!\r\n''
, 14,1000); #i2c #dma #mpu6050