From 577d5456db4d4e5a740208f01362521aeda22aae Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 8 Sep 2011 17:56:08 +0000 Subject: Fix I2C/FSMC conflict for STM32; Fix STM32 clock setup git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3942 42af7a65-404d-4744-a932-0658087f49c3 --- apps/system/i2c/README.txt | 35 +++++++++++++++++++++++++++++++++-- apps/system/i2c/i2c_main.c | 2 +- apps/system/i2c/i2ctool.h | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) (limited to 'apps/system/i2c') diff --git a/apps/system/i2c/README.txt b/apps/system/i2c/README.txt index 0c004fa34..0435be148 100755 --- a/apps/system/i2c/README.txt +++ b/apps/system/i2c/README.txt @@ -7,6 +7,9 @@ will provide usage information for the I2C tools. CONTENTS ======== + o System Requirements + - I2C Driver + - Configuration Options o Help o Common Line Form o Common Command Options @@ -22,6 +25,34 @@ CONTENTS - NuttX Configuration Requirements - I2C Tool Configuration Options +System Requirements +=================== + +I2C Driver +---------- +In order to use the I2C driver, you system -- in particular, your I2C driver -- +must meet certain requirements: + +1. It support calling up_i2cinitialize() numerous times, resetting the I2C + hardware on each (initial) time. up_i2cuninitialize() will be called after + each call to up_i2cinitialize() to free any resources and disable the I2C. +2. up_i2cinitialize must accept any interface number without crashing. It + must simply return NULL if the device is not supported. +3. The I2C driver must support the transfer method (CONFIG_I2C_TRANSFER=y). + +The I2C tool is designed to be implemented as a NuttShell (NSH) add-on. Read +the apps/nshlib/README.txt file for information about add-ons. + +Configuration Options +--------------------- +CONFIG_I2CTOOL_BUILTIN - Build the tools as an NSH built-in command +CONFIG_I2CTOOL_MINBUS - Smallest bus index supported by the hardware (default 0). +CONFIG_I2CTOOL_MAXBUS - Largest bus index supported by the hardware (default 3) +CONFIG_I2CTOOL_MINADDR - Minium device address (default: 0x03) +CONFIG_I2CTOOL_MAXADDR - Largest device address (default: 0x77) +CONFIG_I2CTOOL_MAXREGADDR - Largest register address (default: 0xff) +CONFIG_I2CTOOL_DEFFREQ - Default frequency (default: 4000000) + HELP ==== @@ -44,7 +75,7 @@ options. Where is one of: Show help: ? - List buses: bus [OPTIONS] + List buses: bus List devices: dev [OPTIONS] Read register: get [OPTIONS] Show help: help @@ -56,7 +87,7 @@ options. [-r regaddr] is the I2C device register address (hex). Default: 00 Current: 00 [-w width] is the data width (8 or 16 decimal). Default: 8 Current: 8 [-s|n], send/don't send start between command and data. Default: -n Current: -n - [-f freq] I2C frequency. Default: 400000 Current: 400000 + [-f freq] I2C frequency. Default: 100000 Current: 100000 NOTES: o An environment variable like $PATH may be used for any argument. diff --git a/apps/system/i2c/i2c_main.c b/apps/system/i2c/i2c_main.c index 7e4a0c91b..cb4889c54 100644 --- a/apps/system/i2c/i2c_main.c +++ b/apps/system/i2c/i2c_main.c @@ -76,7 +76,7 @@ struct i2ctool_s g_i2ctool; static const struct cmdmap_s g_i2ccmds[] = { { "?", cmd_help, "Show help", NULL }, - { "bus", cmd_bus, "List busses", "[OPTIONS]" }, + { "bus", cmd_bus, "List busses", NULL }, { "dev", cmd_dev, "List devices", "[OPTIONS] " }, { "get", cmd_get, "Read register", "[OPTIONS]" }, { "help", cmd_help, "Show help", NULL }, diff --git a/apps/system/i2c/i2ctool.h b/apps/system/i2c/i2ctool.h index 81b7c0682..56802ffb2 100644 --- a/apps/system/i2c/i2ctool.h +++ b/apps/system/i2c/i2ctool.h @@ -87,7 +87,7 @@ #endif #ifndef CONFIG_I2CTOOL_DEFFREQ -# define CONFIG_I2CTOOL_DEFFREQ 400000 +# define CONFIG_I2CTOOL_DEFFREQ 100000 #endif /* This is the maximum number of arguments that will be accepted for a -- cgit v1.2.3