aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-06 13:38:47 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-06 13:38:47 +0000
commit60e97e1c62c615c9e07042ec20fc8d354245aba9 (patch)
tree1265dac1f6b780375fde0321a10a96d6e74d3af2
parent6777c09f08b8c20f67879a59aaefc588bb6e7371 (diff)
downloadChibiOS-60e97e1c62c615c9e07042ec20fc8d354245aba9.tar.gz
ChibiOS-60e97e1c62c615c9e07042ec20fc8d354245aba9.tar.bz2
ChibiOS-60e97e1c62c615c9e07042ec20fc8d354245aba9.zip
I2C. Haltest for stm32f1x updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3560 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--testhal/STM32F1xx/I2C/Makefile4
-rw-r--r--testhal/STM32F1xx/I2C/halconf.h6
-rw-r--r--testhal/STM32F1xx/I2C/i2c_pns.c4
-rw-r--r--testhal/STM32F1xx/I2C/lis3.c2
-rw-r--r--testhal/STM32F1xx/I2C/main.c1
-rw-r--r--testhal/STM32F1xx/I2C/mcuconf.h18
6 files changed, 19 insertions, 16 deletions
diff --git a/testhal/STM32F1xx/I2C/Makefile b/testhal/STM32F1xx/I2C/Makefile
index f40f6f775..37db54251 100644
--- a/testhal/STM32F1xx/I2C/Makefile
+++ b/testhal/STM32F1xx/I2C/Makefile
@@ -31,7 +31,7 @@ endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
- USE_VERBOSE_COMPILE = no
+ USE_VERBOSE_COMPILE = yes
endif
#
@@ -63,7 +63,7 @@ LDSCRIPT= $(PORTLD)/STM32F103xB.ld
# Imported source files
CHIBIOS = ../../..
-include $(CHIBIOS)/boards/OLIMEX_STM32_P103/board.mk
+include $(CHIBIOS)/boards/OLIMEX_STM32_103STK/board.mk
include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk
diff --git a/testhal/STM32F1xx/I2C/halconf.h b/testhal/STM32F1xx/I2C/halconf.h
index 3960a927c..54a69c2f7 100644
--- a/testhal/STM32F1xx/I2C/halconf.h
+++ b/testhal/STM32F1xx/I2C/halconf.h
@@ -44,7 +44,7 @@
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC TRUE
+#define HAL_USE_ADC FALSE
#endif
/**
@@ -100,7 +100,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
-#define HAL_USE_PWM TRUE
+#define HAL_USE_PWM FALSE
#endif
/**
@@ -121,7 +121,7 @@
* @brief Enables the SERIAL subsystem.
*/
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL TRUE
+#define HAL_USE_SERIAL FALSE
#endif
/**
diff --git a/testhal/STM32F1xx/I2C/i2c_pns.c b/testhal/STM32F1xx/I2C/i2c_pns.c
index fac6dc965..95218b583 100644
--- a/testhal/STM32F1xx/I2C/i2c_pns.c
+++ b/testhal/STM32F1xx/I2C/i2c_pns.c
@@ -8,8 +8,8 @@
/* I2C1 */
static const I2CConfig i2cfg1 = {
OPMODE_I2C,
- 100000,
- STD_DUTY_CYCLE,
+ 400000,
+ FAST_DUTY_CYCLE_16_9,
};
diff --git a/testhal/STM32F1xx/I2C/lis3.c b/testhal/STM32F1xx/I2C/lis3.c
index 2300ea5cb..0cd42a02f 100644
--- a/testhal/STM32F1xx/I2C/lis3.c
+++ b/testhal/STM32F1xx/I2C/lis3.c
@@ -58,7 +58,9 @@ int init_lis3(void){
accel_tx_data[3] = 0b00000000;
/* sending */
+ i2cAcquireBus(&I2CD1);
i2cMasterTransmit(&I2CD1, &lis3, lis3_addr, accel_tx_data, 4, accel_rx_data, 0);
+ i2cReleaseBus(&I2CD1);
return 0;
}
diff --git a/testhal/STM32F1xx/I2C/main.c b/testhal/STM32F1xx/I2C/main.c
index bc241e180..3179c488a 100644
--- a/testhal/STM32F1xx/I2C/main.c
+++ b/testhal/STM32F1xx/I2C/main.c
@@ -68,6 +68,7 @@ int main(void) {
halInit();
chSysInit();
+ chThdSleepMilliseconds(1000);
I2CInit_pns();
/* Create accelerometer thread */
diff --git a/testhal/STM32F1xx/I2C/mcuconf.h b/testhal/STM32F1xx/I2C/mcuconf.h
index b333e2ce6..dc4d3960c 100644
--- a/testhal/STM32F1xx/I2C/mcuconf.h
+++ b/testhal/STM32F1xx/I2C/mcuconf.h
@@ -47,7 +47,7 @@
/*
* ADC driver system settings.
*/
-#define STM32_ADC_USE_ADC1 TRUE
+#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_ADC1_DMA_PRIORITY 3
#define STM32_ADC_ADC1_IRQ_PRIORITY 5
#define STM32_ADC_ADC1_DMA_ERROR_HOOK() chSysHalt()
@@ -122,8 +122,8 @@
/*
* SERIAL driver system settings.
*/
-#define STM32_SERIAL_USE_USART1 TRUE
-#define STM32_SERIAL_USE_USART2 TRUE
+#define STM32_SERIAL_USE_USART1 FALSE
+#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
@@ -138,8 +138,8 @@
/*
* SPI driver system settings.
*/
-#define STM32_SPI_USE_SPI1 TRUE
-#define STM32_SPI_USE_SPI2 TRUE
+#define STM32_SPI_USE_SPI1 FALSE
+#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
@@ -167,18 +167,18 @@
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 TRUE
-#define STM32_I2C_USE_I2C2 TRUE
+#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_I2C1_IRQ_PRIORITY 10
#define STM32_I2C_I2C2_IRQ_PRIORITY 10
-#define STM32_I2C_I2C1_DMA_PRIORITY 4
-#define STM32_I2C_I2C2_DMA_PRIORITY 4
+#define STM32_I2C_I2C1_DMA_PRIORITY 1
+#define STM32_I2C_I2C2_DMA_PRIORITY 1
#define STM32_I2C_I2C1_DMA_ERROR_HOOK() chSysHalt()
#define STM32_I2C_I2C2_DMA_ERROR_HOOK() chSysHalt()
/*
* USB driver system settings.
*/
-#define STM32_USB_USE_USB1 TRUE
+#define STM32_USB_USE_USB1 FALSE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY 6
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14