diff --git a/Documentation/platforms/arm/stm32f4/boards/stm32f401rc-rs485/index.rst b/Documentation/platforms/arm/stm32f4/boards/stm32f401rc-rs485/index.rst index d7bf74899a..f9849e8277 100644 --- a/Documentation/platforms/arm/stm32f4/boards/stm32f401rc-rs485/index.rst +++ b/Documentation/platforms/arm/stm32f4/boards/stm32f401rc-rs485/index.rst @@ -155,7 +155,7 @@ Users can enable EERPOM support on STM32F4-RS485 by following below configuratio Temperature Sensor ================== -The STM32F4-RS485 development board has a temperature sensor TMP75 (TMP75AIDR) connected through I2C as below: +The STM32F4-RS485 development board has a temperature sensor TMP75 (compatible with LM75) connected through I2C as below: ====== ===== I2C PINS @@ -401,3 +401,18 @@ The application modbusmaster will send 100 requests, you can check on diagslave: Slave 10: readHoldingRegisters from 2, 1 references Slave 10: readHoldingRegisters from 2, 1 references Slave 10: readHoldingRegisters from 2, 1 references + +lm75 +---- + +Configures the NuttShell (nsh) over USB Serial (check usbserial configuration) and enables temperature sensor LM75. +NSH commands:: + + nsh> lm75 -help + Usage: temp [OPTIONS] + [-n count] selects the samples to collect. Default: 1 Current: 100 + [-h] shows this message and exits + nsh> lm75 -n 3 + 30.13 degrees Celsius + 30.13 degrees Celsius + 30.13 degrees Celsius diff --git a/boards/arm/stm32/stm32f401rc-rs485/configs/lm75/defconfig b/boards/arm/stm32/stm32f401rc-rs485/configs/lm75/defconfig new file mode 100644 index 0000000000..f65cc04dff --- /dev/null +++ b/boards/arm/stm32/stm32f401rc-rs485/configs/lm75/defconfig @@ -0,0 +1,73 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_FPU is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_PS is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32f401rc-rs485" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_STM32F401RC_RS485=y +CONFIG_ARCH_BUTTONS=y +CONFIG_ARCH_CHIP="stm32" +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32F401RC=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_IRQBUTTONS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_BOARD_LOOPSPERMSEC=8499 +CONFIG_BUILTIN=y +CONFIG_CDCACM=y +CONFIG_CDCACM_CONSOLE=y +CONFIG_EXAMPLES_BUTTONS=y +CONFIG_EXAMPLES_BUTTONS_NAME0="SW3" +CONFIG_EXAMPLES_BUTTONS_NAME1="SW4" +CONFIG_EXAMPLES_BUTTONS_NAME2="SW5" +CONFIG_EXAMPLES_BUTTONS_NAMES=y +CONFIG_EXAMPLES_BUTTONS_QTD=3 +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_I2CTOOL_MAXBUS=1 +CONFIG_I2CTOOL_MINBUS=1 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INPUT=y +CONFIG_INPUT_BUTTONS=y +CONFIG_INPUT_BUTTONS_LOWER=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=98304 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SENSORS=y +CONFIG_SENSORS_LM75=y +CONFIG_SPI=y +CONFIG_START_DAY=5 +CONFIG_START_MONTH=5 +CONFIG_START_YEAR=2014 +CONFIG_STM32_I2C1=y +CONFIG_STM32_JTAG_SW_ENABLE=y +CONFIG_STM32_OTGFS=y +CONFIG_STM32_PWR=y +CONFIG_STM32_USART6=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_LM75=y +CONFIG_SYSTEM_LM75_CELSIUS=y +CONFIG_SYSTEM_LM75_DEVNAME="/dev/temp0" +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_USBDEV=y diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_bringup.c b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_bringup.c index d9d138614c..78f9a6b5c8 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_bringup.c @@ -47,6 +47,10 @@ #include +#ifdef CONFIG_SENSORS_LM75 +#include "stm32_lm75.h" +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -145,6 +149,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_LM75_I2C + /* Configure and initialize the LM75 sensor */ + + ret = board_lm75_initialize(0, 1); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: board_lm75_initialize() failed: %d\n", ret); + } +#endif + #ifdef CONFIG_INPUT_BUTTONS /* Register the BUTTON driver */