Jump to content

marcaz

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by marcaz

  1. Thanks for ideas. Will check after work and give feedback
  2. Hi, Short intro: Base - STM32F746G-Discovery MEMS - BMP085 Baro sensor, BMA180 Accelerometer, ITG3205 Gyro Purpose is to monitor and display motorcycle lean angles and braking, accelaration. In future contact less IR temperature sensor (TMP007 propably) will be integrated to measure tire temperature. Here is short video and a problem I would like to discuss. Problem: during I2C read routine display is flickering and gets distorted. Seems like uGFX task does not get processing time. I2C reading is done every 10 miliseconds via interrupts. maybe some thoughts? Also giving access to this repo: https://marcaz@bitbucket.org/marcaz/motomoni_cm7.git p.s. seems like that make impact to that flockering while (HAL_I2C_GetState(i2c_handler) != HAL_I2C_STATE_READY) Read and write routines: HAL_StatusTypeDef I2Cx_ReadMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length) { uint32_t err_cnt = 0; uint32_t rd_cnt = 0; HAL_StatusTypeDef status = HAL_OK; uint32_t err; while( HAL_I2C_Mem_Read_IT(i2c_handler,(uint16_t)Addr, Reg, I2C_MEMADD_SIZE_8BIT,Buffer, Length)!= HAL_OK){ err_cnt++; // osDelay(10); } while (HAL_I2C_GetState(i2c_handler) != HAL_I2C_STATE_READY) { rd_cnt++; osDelay(1); } if( err_cnt > 2 || rd_cnt > 2){ db("[RD] er:%u, rd:%u\r\n",err_cnt,rd_cnt); } /* Return OK */ return HAL_OK; } HAL_StatusTypeDef I2Cx_WriteMultiple(I2C_HandleTypeDef *i2c_handler, uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length) { uint32_t err_cnt = 0; uint32_t rd_cnt = 0; HAL_StatusTypeDef status = HAL_OK; uint32_t err; uint8_t d[2]; d[0] = Reg; d[1] = *Buffer; while (HAL_I2C_Mem_Write_IT(i2c_handler, Addr, Reg, Reg > 0xFF ? I2C_MEMADD_SIZE_16BIT : I2C_MEMADD_SIZE_8BIT, Buffer, Length) != HAL_OK) { /* Check error */ err = HAL_I2C_GetError(i2c_handler); if (err != HAL_I2C_ERROR_NONE) { db("erroras i2c a:%X\r\n",err); break; } err_cnt++; } while (HAL_I2C_GetState(i2c_handler) != HAL_I2C_STATE_READY) { rd_cnt++; osDelay(1); } if( err_cnt > 2 || rd_cnt > 2){ db("er:%u, rd:%u\r\n",err_cnt,rd_cnt); } return status; } VIDEO0075.mp4
×
×
  • Create New...