cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling multi RS422 interfaced slave devices independently using stm32 series mcu?

aybala5
Associate II
Posted on November 16, 2014 at 19:34

Hello Friends,

I have a stm32f4 discv. board and need to drive 6 motor drivers independently that have RS422 interface (just send command, no pwm calc.) How can i do that with discv board or in new designing ? Is 1 usart, 1 rs422 tranceiver is enough, if so is there any example for this scenario or can someone share a small code block for just controlling specific slave device among many slaves?

A simple topology i want to design is like that:

http://www.datasheetdir.com/Rs-485-And-Rs-422-Physical-Topologies+Application-Notes

Many Thanks,
8 REPLIES 8
Posted on November 16, 2014 at 22:09

Electrically that would appear to be sufficient, you'd want to ponder the addressing and protocol for the data expected by the motors.

Such an interface could be attached to an STM32 board, the STM32F4 DISCO can't use USART1 on PA9/PA10
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aybala5
Associate II
Posted on November 17, 2014 at 19:19

Hello Mr Clive,

First thanks for your prompt response. You mean one usart will be enough as working Master in the bus right ? if so is there any example for sending a specific command  to the specific device (slave) using rs422 comm bus.

Thanks.

Posted on November 18, 2014 at 18:59

You'd send data to the USART in the same fashion you would if it where connected to RS232 transceivers. What baud rate, and what data bytes, would depend on the expectations of the receiving devices (motors).

You have to pay attention to ensure only one slave at a time responds, their protocol documentation presumably covers this, and other details, which I'm not privy too.

One USART should be sufficient provided each device can be uniquely addressed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aybala5
Associate II
Posted on November 18, 2014 at 21:54

Mr clive hi again,

''One USART should be sufficient provided each device can be uniquely addressed.'' İf rs422 is not a protocol and just an electrical layer defination so how can we adress the data ? I mean

we send like that:

 USART_SendData(USART1, 0x49); // Send 'I'

So when it is rs422 transfer, how we will send data to specific device (slave) and according to which standart it is defined like: adress (x byte)/data (y byte)/checksum (1 byte)/ ... etc. Thanks.
Posted on November 19, 2014 at 01:38

The manual for the motors would be the controlling document here. You haven't specified what they are, so I'm at a loss at this point....

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aybala5
Associate II
Posted on November 19, 2014 at 22:32

Clive, for now i dont have motor. Generally want to fıgure out rs422, You mean there is no strict rule:

USART_SendData(USART1,X)

Here X byte array can be built in many ways like start, address, data. .. or address, size, data... or somethınk else. Developers build custumized byte array and a not written protocol rules work am i right?
frankmeyer9
Associate II
Posted on November 20, 2014 at 10:10

>Clive, for now i dont have motor.

But you can surely download the specification/manual for that motor, and see what protocol it requires for driving it (I guess CAN or Modbus ...). >Generally want to fıgure out rs422, Again, as said, the difference to ''normal'' RS232 is mostly hardware, except for the direction control (transceiver enable). >You mean there is no strict rule:

USART_SendData(USART1,X)

And again, this is defined by the protocol your motors require. You need to implement a (SW) driver for that, but first, you need to find out wich one.
aybala5
Associate II
Posted on November 22, 2014 at 09:52

Thanks fm.