From 3bc938d45e44b9c77a5474563c86290bb5839cff Mon Sep 17 00:00:00 2001 From: FredericG Date: Mon, 21 Jun 2010 09:19:02 +0000 Subject: [PATCH] lowered I2C timoout whne using RTOS git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@842 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/AHRS/inc/pios_board.h | 4 ++-- flight/OpenPilot/System/inc/pios_board.h | 4 ++-- flight/PiOS/STM32F10x/pios_i2c.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flight/AHRS/inc/pios_board.h b/flight/AHRS/inc/pios_board.h index b05ca443d..2aac8f3dd 100644 --- a/flight/AHRS/inc/pios_board.h +++ b/flight/AHRS/inc/pios_board.h @@ -106,8 +106,8 @@ TIM8 | | | | #define PIOS_I2C_SCL_PIN GPIO_Pin_6 #define PIOS_I2C_SDA_PIN GPIO_Pin_7 #define PIOS_I2C_DUTY_CYCLE I2C_DutyCycle_2 -#define PIOS_I2C_BUS_FREQ 400000 -#define PIOS_I2C_TIMEOUT_VALUE 5000 +#define PIOS_I2C_BUS_FREQ 400000 // bit/s +#define PIOS_I2C_TIMEOUT_VALUE 50 // ms #define PIOS_I2C_IRQ_EV_HANDLER void I2C1_EV_IRQHandler(void) #define PIOS_I2C_IRQ_ER_HANDLER void I2C1_ER_IRQHandler(void) #define PIOS_I2C_IRQ_EV_CHANNEL I2C1_EV_IRQn diff --git a/flight/OpenPilot/System/inc/pios_board.h b/flight/OpenPilot/System/inc/pios_board.h index 744fb7f71..1c8acbc31 100644 --- a/flight/OpenPilot/System/inc/pios_board.h +++ b/flight/OpenPilot/System/inc/pios_board.h @@ -85,8 +85,8 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8 #define PIOS_I2C_SDA_PIN GPIO_Pin_11 #define PIOS_I2C_SCL_PIN GPIO_Pin_10 #define PIOS_I2C_DUTY_CYCLE I2C_DutyCycle_2 -#define PIOS_I2C_BUS_FREQ 400000 -#define PIOS_I2C_TIMEOUT_VALUE 5000 +#define PIOS_I2C_BUS_FREQ 400000 // bit/s +#define PIOS_I2C_TIMEOUT_VALUE 50 // ms #define PIOS_I2C_IRQ_EV_HANDLER void I2C2_EV_IRQHandler(void) #define PIOS_I2C_IRQ_ER_HANDLER void I2C2_ER_IRQHandler(void) #define PIOS_I2C_IRQ_EV_CHANNEL I2C2_EV_IRQn diff --git a/flight/PiOS/STM32F10x/pios_i2c.c b/flight/PiOS/STM32F10x/pios_i2c.c index 301017023..1b67f886c 100644 --- a/flight/PiOS/STM32F10x/pios_i2c.c +++ b/flight/PiOS/STM32F10x/pios_i2c.c @@ -327,7 +327,7 @@ int32_t PIOS_I2C_TransferWait(void) } #else - uint32_t repeat_ctr = PIOS_I2C_TIMEOUT_VALUE; + uint32_t repeat_ctr = PIOS_I2C_TIMEOUT_VALUE*100; // FIXME uint16_t last_buffer_ix = i2cx->buffer_ix; if (i2cx->transfer_state.BUSY)