2024-05-20 07:50 PM
Hi all,
I’m reaching out for assistance with integrating an ST485ABDR transceiver with an STM32F723ZET6 microcontroller. I have encountered issues while trying to control an RS485 stepper motor driver using this setup; however, I am able to communicate successfully with the motor driver using a software called “ModbusView TCP” (program that monitors and simulates Modbus ASCII, RTU, and TCP/IP communications from a PC). The below screenshot summarises each of the test setups.
The below screenshot illustrates the test setup using our PCB, along with the packets received at various stages:
The below screenshot illustrates the test setup using the ModbusView TCP software and a USB to RS485 converter, along with the packets received at various stages:
Below are screenshots illustrating how we have implemented the ST485ABDR transceiver and its interface with the MCU, as well as snippets of relevant code from the STM43CubeIDE.
Net Label: | Where connected to on MCU: |
RECEIVER_OUTPUT_ENABLE_ACTUATOR | Port F GPIO 11 (Pin 49) |
DRIVER_OUTPUT_ENABLE_ACTUATOR | Port F GPIO 12 (Pin 50) |
ACTUATOR_1_RS422_TX | USART2_Tx (Pin 36) |
ACTUATOR_1_RS422_RX | USART2_Rx (Pin 37) |
Below are some screenshots of our code in STM32CubeIDE:
We have verified with a logic analyser that the correct packet and CRC is being sent out of the MCU, and the ST485ABDR. Additionally, we have verified using a USB to RS485 converter that the packet is correct and when sent through PuTTY from a PC directly to the stepper motor driver we receive the response from the device we were expecting. We suspect that our issues have arisen due to us incorrectly implementing the ST485ABDR into our circuit. Below are some additional screenshots of what we measured using an oscilloscope.
I have been stuck on this for weeks so any assistance would be greatly appreciated :D
2024-07-03 05:01 AM
For simplicity you can connect RE and DE together since they have complimentary logic, when RE is low you should put DE also low else there can be interference.
you seems to be using UART_Transmit as a blocking call, so immediately after the data is send out you can disable the DE and enable RE and wait for receive to complete. Not clear how interrupt is generated. It is beset to try without any interrupt till you are sure of the Hardware setup with stm32. Do you have terminating resistance for RS485?
STM32->rs485->rs485 to USB ->PC with Putty , you can verify TX and RX path independently.