diff options
author | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-09-22 16:01:28 +0000 |
---|---|---|
committer | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-09-22 16:01:28 +0000 |
commit | dd525d05dbf985837da4616ee52ffb1b732df607 (patch) | |
tree | 6e05b97b7c9dde43655f382ecc096ce5abcdb4a5 | |
parent | 43972ad3c82a8f2b0c78b1997d81da162d958ce5 (diff) | |
download | ChibiOS-dd525d05dbf985837da4616ee52ffb1b732df607.tar.gz ChibiOS-dd525d05dbf985837da4616ee52ffb1b732df607.tar.bz2 ChibiOS-dd525d05dbf985837da4616ee52ffb1b732df607.zip |
Updated LSM6DS0 driver and related STM32 Nucleo F401RE demo
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9770 35acf78f-673a-0410-8e92-d51de3d6d3f4
9 files changed, 15 insertions, 69 deletions
diff --git a/demos/STM32/RT-STM32F401RE-NUCLEO64/debug/RT-STM32F401RE-NUCLEO64 (OpenOCD, Flash and Run).launch b/demos/STM32/RT-STM32F401RE-NUCLEO64/debug/RT-STM32F401RE-NUCLEO64 (OpenOCD, Flash and Run).launch index 627f849f2..5adb1bdfe 100644 --- a/demos/STM32/RT-STM32F401RE-NUCLEO64/debug/RT-STM32F401RE-NUCLEO64 (OpenOCD, Flash and Run).launch +++ b/demos/STM32/RT-STM32F401RE-NUCLEO64/debug/RT-STM32F401RE-NUCLEO64 (OpenOCD, Flash and Run).launch @@ -39,7 +39,7 @@ <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RT-STM32F401RE-NUCLEO64"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.114656749"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.603687198"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/RT-STM32F401RE-NUCLEO64"/>
</listAttribute>
diff --git a/os/ex/ST/lsm6ds0.c b/os/ex/ST/lsm6ds0.c index 707c7b90c..17f02b52f 100644 --- a/os/ex/ST/lsm6ds0.c +++ b/os/ex/ST/lsm6ds0.c @@ -75,6 +75,7 @@ typedef enum { uint8_t lsm6ds0I2CReadRegister(I2CDriver *i2cp, lsm6ds0_sad_t sad, uint8_t reg,
msg_t* msgp) {
msg_t msg;
+ uint8_t txbuf = reg;
#if defined(STM32F103_MCUCONF)
uint8_t rxbuf[2];
msg = i2cMasterTransmitTimeout(i2cp, sad, &txbuf, 1, rxbuf, 2,
@@ -84,8 +85,7 @@ uint8_t lsm6ds0I2CReadRegister(I2CDriver *i2cp, lsm6ds0_sad_t sad, uint8_t reg, }
return rxbuf[0];
#else
- uint8_t txbuf, rxbuf;
- txbuf = reg;
+ uint8_t rxbuf;
msg = i2cMasterTransmitTimeout(i2cp, sad, &txbuf, 1, &rxbuf, 1,
TIME_INFINITE);
if(msgp != NULL){
diff --git a/os/ex/ST/lsm6ds0.h b/os/ex/ST/lsm6ds0.h index 34efdcec3..20bef3134 100644 --- a/os/ex/ST/lsm6ds0.h +++ b/os/ex/ST/lsm6ds0.h @@ -41,7 +41,7 @@ /**
* @brief LSM6DS0 driver version string.
*/
-#define EX_LSM6DS0_VERSION "1.0.0"
+#define EX_LSM6DS0_VERSION "1.0.1"
/**
* @brief LSM6DS0 driver version major number.
@@ -56,7 +56,7 @@ /**
* @brief LSM6DS0 driver version patch number.
*/
-#define EX_LSM6DS0_PATCH 0
+#define EX_LSM6DS0_PATCH 1
/** @} */
/**
diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile index 9882b4a32..31b3ede4c 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile @@ -203,7 +203,7 @@ CPPWARN = -Wall -Wextra -Wundef UDEFS = -DCHPRINTF_USE_FLOAT=1 -DSHELL_CMD_TEST_ENABLED=0 \
-DLSM6DS0_USE_ADVANCED=0 -DLSM6DS0_GYRO_USE_ADVANCED=0 \
-DLSM6DS0_ACC_USE_ADVANCED=0
-
+
# Define ASM defines here
UADEFS =
diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch deleted file mode 100644 index 21c597ad1..000000000 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
-<stringAttribute key="bad_container_name" value="\STM32F4xx-SPI-L3GD20\debug"/>
-<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="1"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="true"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="set remotetimeout 20 monitor reset init monitor sleep 50 "/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
-<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
-<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
-<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="arm-none-eabi-gdb"/>
-<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard"/>
-<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
-<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
-<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
-<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
-<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="null-read_raw-(format)" val="1"/></contentList>"/>
-<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
-<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList/> "/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="STM32F4xx-SPI-L3GD20"/>
-<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.603687198"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/STM32F4xx-SPI-L3GD20"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h index 82602b403..07b0143bd 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h @@ -76,7 +76,7 @@ * @brief Enables the I2C subsystem.
*/
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
-#define HAL_USE_I2C FALSE
+#define HAL_USE_I2C TRUE
#endif
/**
diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c index fdf0199f4..196e2d8d7 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c @@ -38,11 +38,9 @@ static char axisID[LSM6DS0_ACC_NUMBER_OF_AXES] = {'X', 'Y', 'Z'}; static uint32_t i;
static const I2CConfig i2ccfg = {
- STM32_TIMINGR_PRESC(15U) |
- STM32_TIMINGR_SCLDEL(4U) | STM32_TIMINGR_SDADEL(2U) |
- STM32_TIMINGR_SCLH(15U) | STM32_TIMINGR_SCLL(21U),
- 0,
- 0
+ OPMODE_I2C,
+ 400000,
+ FAST_DUTY_CYCLE_2,
};
static const LSM6DS0AccConfig lsm6ds0acccfg = {
@@ -301,8 +299,8 @@ int main(void) { halInit();
chSysInit();
- palSetLineMode(LINE_ARD_D14, PAL_MODE_ALTERNATE(4) | PAL_STM32_OSPEED_HIGH);
- palSetLineMode(LINE_ARD_D15, PAL_MODE_ALTERNATE(4) | PAL_STM32_OSPEED_HIGH);
+ palSetLineMode(LINE_ARD_D14, PAL_MODE_ALTERNATE(4));
+ palSetLineMode(LINE_ARD_D15, PAL_MODE_ALTERNATE(4));
/*
* Activates the serial driver 2 using the driver default configuration.
diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h index 2c62a87f2..166f04112 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h @@ -111,7 +111,7 @@ /*
* I2C driver system settings.
*/
-#define STM32_I2C_USE_I2C1 FALSE
+#define STM32_I2C_USE_I2C1 TRUE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_USE_I2C3 FALSE
#define STM32_I2C_BUSY_TIMEOUT 50
diff --git a/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile b/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile index bdfbb5c70..0a74c53b4 100644 --- a/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile +++ b/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile @@ -5,7 +5,7 @@ # Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
@@ -203,7 +203,7 @@ CPPWARN = -Wall -Wextra -Wundef UDEFS = -DCHPRINTF_USE_FLOAT=1 -DSHELL_CMD_TEST_ENABLED=0 \
-DLSM6DS0_USE_ADVANCED=0 -DLSM6DS0_GYRO_USE_ADVANCED=0 \
-DLSM6DS0_ACC_USE_ADVANCED=0
-
+
# Define ASM defines here
UADEFS =
|