CreedODI
Posts: 4
Joined: Mon Dec 18, 2017 12:51 am

Sending Bytes to a Control box via UART

Wed Dec 27, 2017 3:15 am

I need a little help with something. I have a RPI 3 and a Control Box which controls linear actuators. I have the Hexadecimal code (I believe its hexadecimal :?) which I believe communicates with the control box (Ex: fff292929303adad). How can I send that code via the UART GPIO Pins to the Control Box. I have cable which converts the UART GPIO pins into RJ45 for communication with the control box)

Thanks

hippy
Posts: 7730
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Sending Bytes to a Control box via UART

Wed Dec 27, 2017 12:51 pm

Maybe something like ...

Code: Select all

import serial
ser = serial.Serial(....)
ser.write(chr(0xff)+chr(0xf2)+chr(0x92)+chr(0x92)+chr(0x93)+chr(0x03)+chr(0xad)+chr(0xad))

CreedODI
Posts: 4
Joined: Mon Dec 18, 2017 12:51 am

Re: Sending Bytes to a Control box via UART

Wed Dec 27, 2017 5:43 pm

No errors, but the control box did nothing. I am trying to send a reset signal to it, and according to documentation, theses 'bytes' are sent to the control box for resetting it:

ffff020303021c010128fafa


I sent it over the serial port /dev/ttyAMA0 which should be the UART Pins on the RPI 3 correct? I have a 3pin (Ground, UART Tx, UART Rx) cable which gets "translated" into an RJ45 connector which then connects to the control box.

hippy
Posts: 7730
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Sending Bytes to a Control box via UART

Wed Dec 27, 2017 7:03 pm

CreedODI wrote:
Wed Dec 27, 2017 5:43 pm
No errors, but the control box did nothing.
Perhaps post a link to the control box and its documentation, the Python settings used when opening the serial port, and a circuit of your hardware interface.

Lack of communications could be incorrect wiring, lines crossed-over or not crossed over, handshake lines not connected, wrong voltages, wrong baud rate, wrong parity or something else wrong about the protocol being used.

Return to “Python”