rcsim opened a new pull request, #11500:
URL: https://github.com/apache/nuttx/pull/11500
## Summary
- Add support to rs-485 on stm32f401rc-rs485 board.
- Change default USART for NSH to USART6 as RS-485 transciever is connected
to USART2.
- Disable SW6 as it conflicts with USART6 (PC6).
## Impact
Users will be able to use RS-485 feature.
## Testing
Run modbus application at NSH:
nsh> modbus -help
USAGE: modbus [-d|e|s|q|h]
Where:
-d : Disable protocol stack
-e : Enable the protocol stack
-s : Show current status
-q : Quit application
-h : Show this information
nsh> modbus -e
PC Configuration:
Download and install mbpoll aplication:
sudo apt install mbpoll
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 mbpoll as below:
mbpoll -a 10 -b 38400 -t 3 -r 1000 -c 4 /dev/ttyUSB1 -R
At PC terminal you will see the mbpoll application receiving the random
values generated by STM32F401RC-RS485 and transmitted over RS-485:
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.
Protocol configuration: Modbus RTU
Slave configuration...: address = [10]
start reference = 1000, count = 4
Communication.........: /dev/ttyUSB1, 38400-8E1
t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, input register table
-- Polling slave 10... Ctrl-C to stop)
[1000]: 58080 (-7456)
[1001]: 0
[1002]: 0
[1003]: 0
-- Polling slave 10... Ctrl-C to stop)
[1000]: 6100
[1001]: 0
[1002]: 0
[1003]: 0
-- Polling slave 10... Ctrl-C to stop)
[1000]: 51010 (-14526)
[1001]: 0
[1002]: 0
[1003]: 0
-- Polling slave 10... Ctrl-C to stop)
[1000]: 12528
[1001]: 0
[1002]: 0
[1003]: 0
PreviousNext
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]