stm32f401rc-rs485: Add rs-485 master mode configuration
This commit is contained in:
parent
5c118967bb
commit
f4d500f436
@ -314,3 +314,69 @@ generated by STM32F401RC-RS485 and transmitted over RS-485::
|
||||
[1002]: 0
|
||||
[1003]: 0
|
||||
|
||||
modbus_master
|
||||
-------------
|
||||
|
||||
Configures the NuttShell (nsh) and enables modbus in msater mode. This
|
||||
configuration enables a serial console on USART6. The RS-485 is connected
|
||||
to USART2. Follow below precedure to use modbusmaster test aplication, you will
|
||||
need a USB to RS-485 converter to connect the board to a PC via RS-485.
|
||||
|
||||
PC Configuration:
|
||||
|
||||
Download and install diagslave aplication from https://www.modbusdriver.com/diagslave.html.
|
||||
|
||||
Check which TTY USB port is being used by you USB to RS-485 converter::
|
||||
|
||||
sudo dmesg
|
||||
[99846.668209] usb 1-1.3: Product: USB Serial
|
||||
[99846.676313] ch341 1-1.3:1.0: ch341-uart converter detected
|
||||
[99846.677454] usb 1-1.3: ch341-uart converter now attached to ttyUSB1
|
||||
|
||||
Run the diagslave as below::
|
||||
|
||||
sudo diagslave -a 10 -b 38400 /dev/ttyUSB1
|
||||
|
||||
At PC terminal you will see the diagslave application listening to address 10,
|
||||
notice that this address is configurable via MODBUSMASTER_SLAVEADDR::
|
||||
|
||||
diagslave 3.4 - FieldTalk(tm) Modbus(R) Diagnostic Slave Simulator
|
||||
Copyright (c) 2002-2021 proconX Pty Ltd
|
||||
Visit https://www.modbusdriver.com for Modbus libraries and tools.
|
||||
|
||||
Protocol configuration: Modbus RTU, frame tolerance = 0ms
|
||||
Slave configuration: address = 10, master activity t/o = 3.00s
|
||||
Serial port configuration: /dev/ttyUSB1, 38400, 8, 1, even
|
||||
|
||||
Server started up successfully.
|
||||
Listening to network (Ctrl-C to stop)
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
.......
|
||||
|
||||
NuttShell configuration:
|
||||
|
||||
Run modbusmaster application at NSH::
|
||||
|
||||
NuttShell (NSH) NuttX-12.4.0
|
||||
nsh> modbusmaster
|
||||
Initializing modbus master...
|
||||
Creating poll thread.
|
||||
Sending 100 requests to slave 10
|
||||
mbmaster_main: Exiting poll thread.
|
||||
Modbus master statistics:
|
||||
Requests count: 100
|
||||
Responses count: 100
|
||||
Errors count: 0
|
||||
Deinitializing modbus master...
|
||||
|
||||
The application modbusmaster will send 100 requests, you can check on diagslave::
|
||||
|
||||
Server started up successfully.
|
||||
Listening to network (Ctrl-C to stop)
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
Slave 10: readHoldingRegisters from 2, 1 references
|
||||
|
@ -0,0 +1,77 @@
|
||||
#
|
||||
# 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_MB_MASTER_FUNC_READWRITE_HOLDING_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_READ_COILS_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_READ_DISCRETE_INPUTS_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_READ_INPUT_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_WRITE_COIL_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_WRITE_HOLDING_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_WRITE_MULTIPLE_COILS_ENABLED is not set
|
||||
# CONFIG_MB_MASTER_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED 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_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_BOARD_LOOPSPERMSEC=8499
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME0="SW3"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME1="SW4"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME2="SW5"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAME3="SW6"
|
||||
CONFIG_EXAMPLES_BUTTONS_NAMES=y
|
||||
CONFIG_EXAMPLES_BUTTONS_QTD=4
|
||||
CONFIG_EXAMPLES_MODBUSMASTER=y
|
||||
CONFIG_EXAMPLES_MODBUSMASTER_SLAVEADDR=10
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_BUTTONS=y
|
||||
CONFIG_INPUT_BUTTONS_LOWER=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MB_RTU_MASTER=y
|
||||
CONFIG_MODBUS=y
|
||||
CONFIG_MODBUS_MASTER=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_SPI=y
|
||||
CONFIG_START_DAY=5
|
||||
CONFIG_START_MONTH=5
|
||||
CONFIG_START_YEAR=2014
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_OTGFS=y
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_USART2=y
|
||||
CONFIG_STM32_USART6=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART2_BAUD=38400
|
||||
CONFIG_USART2_PARITY=2
|
||||
CONFIG_USART2_RS485=y
|
||||
CONFIG_USART6_SERIAL_CONSOLE=y
|
Loading…
Reference in New Issue
Block a user