FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
298 views 1 comments
by anonymous

Hi,

I have TRB142 with FW TRB1_R_00.07.02.4

I have python script implementation in TRB142 to communicate with m-bus master device over rs232. M-bus master device has own communication protocol to communicate.

M-Bus master device CPU wakes up when RS232 pin-1 (CD signal RS232 pin assignment specs ) is asserted (around +5-6V). Communication requires that CPU is a wake (= CD signal is asserted). As default TRB142 rs232 cd signal is deasserted (-5.6V) even the serial port is open.

My question is how I can control RS232 pin-1 state programmatically or by configuration?

I Found that there is possible to switch RS232 interface serial type to "Over IP". Then there appears true/false parameters for "CD pin indication" and "CD pin invert". When I Enable RS232 to Over IP with both parameters to be true then CD signal pin will be asserted (and m-bus master device cpu wakes up). Conclusion is that it is possible to control cd signal (pin-1) state somehow. BUT python script serial communication over RS232 is not working correctly when TRB142 serial type is set to "over ip" mode. So enabling rs232 with serial type Over IP is not the solution for this case. I only want to control CD signal state.

Thanks,

Jarkko

1 Answer

+1 vote
by anonymous

Hello,

You can control RS232 CD pin only as GPIO. It can be read/changed at any time over sysfs.

To start with, you can use "ls /sys/class/gpio" SSH command to get a list of available GPIOs for your device.

Then, before proceeding, I would recommend reading some online information about what actions can be done with GPIO's and how. Example articles:

by anonymous

Sorry for not providing a complete answer right away.

In order to change the value of RS232's CD flag (pin 1), you would need to control GPIO 948. To do that:

  • First use "echo 948 > /sys/class/gpio/export" SSH command. It will be enough to use this command once at the beginning of your script. The default state of this GPIO is "out", so there is no need to change the direction.
  • Afterward, you will be able to use "echo 0 > /sys/class/gpio/gpio948/value" and "echo 1 > /sys/class/gpio/gpio948/value" SSH commands to control the CD Flag.

Hope that now you will be able to proceed with your idea/solution.