First Steps With TC310

In this article will detail how to configure the OS and make a sample request to the module to get module status information in order to validate the system setup

The demo we we use Python to send a serial request string to the TCM310 module, please ensure there are no active TCM outstations transmitting else the demo code will not run correctly.

Start by installing the necessary python serial module

root@raspberrypi:~# sudo apt install python3-serial
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  python3-wxgtk3.0 | python3-wxgtk
The following NEW packages will be installed:
  python3-serial
0 upgraded, 1 newly installed, 0 to remove and 44 not upgraded.
Need to get 88.8 kB of archives.
After this operation, 469 kB of additional disk space will be used.
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf python3-serial all 3.5~b0-1 [88.8 kB]
Fetched 88.8 kB in 0s (205 kB/s)
Selecting previously unselected package python3-serial.
(Reading database ... 46400 files and directories currently installed.)
Preparing to unpack .../python3-serial_3.5~b0-1_all.deb ...
Unpacking python3-serial (3.5~b0-1) ...
Setting up python3-serial (3.5~b0-1) ...

We can test the module is installed correctly by running the below:

root@raspberrypi:~# python3 -m serial.tools.list_ports
/dev/ttyAMA0
/dev/ttyAMA1
/dev/ttyS2
/dev/ttyUSB0
4 ports found

Next download the tcm.py file from the link below, and run it against the attached serial port

root@raspberrypi:~# chmod +x ./tcm.py
root@raspberrypi:~# ./tcm.py ttyUSB0
Received response: 55002100022600020f00000206090005a2d9f2454f0103474154455741594354524c00000000004c
Decoded Response:
Sync. Byte: 55
Data Length: 33
Packet Type: 02
CRC8H: 26
Return Code: 00
App Version: 020f0000
API Version: 02060900
Chip ID: 05a2d9f2
Chip Version: 454f0103
App Description: GATEWAYCTRL
CRC8D: 76
root@raspberrypi:~#

 

Ref Links :

TCM310 Python Program

TCM310 Serial Protocol Guide

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us