Andromeda Interfaces
  • đŸ–Ĩī¸Advanced Telematics Display Module
    • â„šī¸Overview
    • 📋Specifications
    • 📐Dimensions
    • 🔌Wiring and Interfaces
    • đŸŗī¸Getting Started
    • Hardware Verification
    • 👩‍đŸ’ģSoftware Development
      • 🚙CAN Interface Sample App
    • 🛜Over The Air Updates
      • đŸ“ļSIM Cards
    • 🔃Repositories
  • đŸ–Ĩī¸Electric Vehicle Interface Controller (legacy)
Powered by GitBook
On this page
  • Where to begin guide for ATDM
  • Introduction
  • Equipment
  • Hardware Setup
  • Ethernet
  • LTE Modem
  • GPS
  • USB Ports
  • Audio Out
  • Digital I/O
  • Analog Inputs
  • RS485
  • CAN Channels
  1. Advanced Telematics Display Module

Getting Started

Where to begin guide for ATDM

Welcome to the ATDM Getting Started Guide. This guide will help you set up your hardware and software so that you can begin using the ATDM product effectively.

Introduction

This guide will cover the following topics:

  • Required equipment

  • Hardware setup

  • How to utilize the following interfaces:

    • Ethernet

    • LTE Modem

    • GPS

    • USB Ports

    • Audio Out

    • Digital I/O

    • Analog Inputs

    • RS485

    • CAN Channels

Equipment

To get started, ensure you have the following equipment:

  • Serial port interface: 1.8V logic level (e.g., TTL-232RG-VREG1V8-WE or similar)

  • Harnesses: Main 35-pin and secondary 14-pin cables

  • Antennas: 3-in-one cable for LTE, WiFi and GPS

  • Ethernet: Industrial-grade cables

  • SIM card: Activated (if purchased through Andromeda it is activated)

Hardware Setup

Connecting Serial Terminal

  1. Connect the ATDM to the serial port interface

  2. Configure a serial terminal application to 115200 baud (e.g., TeraTerm)

  3. Power on the ATDM

  4. Verify there is output on the terminal on the terminal screen.

Linux Terminal

  • The ATDM should boot into Linux.

  • The default username/password is torizon/atdmatdm. You will be prompted to change the password on boot.

Ethernet

  1. Connect the Ethernet Cable:

    • Connect an Ethernet cable to the Ethernet port of your ATDM device.

    • Ensure the other end of the cable is connected to your network (e.g., a router or switch).

    • The top Ethernet connector is the primary (ethernet_1) port.

  2. Automatic IP Assignment:

    • TorizonOS is configured to use DHCP (Dynamic Host Configuration Protocol) by default, which means it will automatically request and receive an IP address from the network’s DHCP server.

Retrieving the IP Address

  1. Accessing the Terminal:

    • You can access the terminal on the ATDM device either through a connected display and keyboard or via a serial console.

    • Alternatively, you can establish a serial connection using a USB-to-serial adapter and a terminal emulator like Putty.

  2. Using ifconfig to Get the IP Address:

    • Open the terminal on the ATDM device.

    • Execute the following command to display the network interfaces and their configurations:

      ifconfig ethernet1
    • Look for the inet addr field under the ethernet1 interface, which will show the assigned IP address.

Establishing an SSH Connection

  1. Install Putty (if not already installed):

  2. Configuring Putty for SSH:

    • Open Putty.

    • In the "Host Name (or IP address)" field, enter the IP address obtained from the ifconfig command.

    • Ensure the "Connection type" is set to SSH.

    • Click "Open" to initiate the SSH connection.

  3. Logging In:

    • When prompted, enter the username and password for your TorizonOS account. By default, the username is usually torizon, and you can set a password during the initial setup or use the default if it is provided.

Example Commands and Usage

  • Checking Network Status:

    ifconfig

    This command displays all network interfaces and their statuses.

  • Pinging a Network Device:

    ping <IP_ADDRESS>

    Replace <IP_ADDRESS> with the IP address of another device on the network to test connectivity.

  • Transferring Files via SCP: From your local machine:

    scp localfile.txt torizon@<IP_ADDRESS>:/path/to/remote/directory

    Replace <IP_ADDRESS> with the IP address of the ATDM device and /path/to/remote/directory with the desired directory on the ATDM.

Troubleshooting

  • No IP Address Assigned:

    • Ensure the Ethernet cable is securely connected.

    • Check the DHCP server on your network to ensure it is functioning correctly.

    • Restart the ATDM device and reconnect the Ethernet cable.

  • Cannot SSH into Device:

    • Verify the IP address using ifconfig.

    • Ensure SSH is enabled on the ATDM device.

    • Check network firewall settings that might be blocking the SSH port (default is 22).

Conclusion

Using and interfacing with Ethernet on TorizonOS for your ATDM product is straightforward, with automatic IP assignment and easy access to network configurations through standard tools like ifconfig. Establishing an SSH connection with Putty or similar tools allows for remote management and operation, enhancing the device’s functionality and ease of use.

LTE Modem

  1. List of modems on ATDM

To verify modem detection, use either subsystem utilities (like lsusb) or mmcli.

# mmcli -L
    /org/freedesktop/ModemManager1/Modem/0 [Sierra Wireless, Incorporated] MC7455

This shows one modem. The index (0) is used in subsequent commands to interact with the modem.

  1. Enable Modem

To enable the modem, run:

# mmcli -m 0 -e
successfully enabled the modem
  1. Detailed Modem Information

To retrieve detailed information about your modem, use the following command:

# mmcli -m 0

This command will provide detailed information divided into several sections. Here's an example output:

plaintext  --------------------------------
  General  |            dbus path: /org/freedesktop/ModemManager1/Modem/0
           |            device id: d8a0301f39c8f3b959660cef109e3db4b41546a9
  --------------------------------
  Hardware |         manufacturer: Sierra Wireless, Incorporated
           |                model: MC7455
           |    firmware revision: SWI9X30C_02.24.05.06 r7040 CARMD-EV-FRMWR2 2017/05/19 06:23:09
           |         h/w revision: 1.0
           |            supported: gsm-umts, lte
           |              current: gsm-umts, lte
           |         equipment id: 123456789987654
  --------------------------------
  System   |               device: /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.1
           |              drivers: qmi_wwan, qcserial
           |               plugin: Sierra
           |         primary port: cdc-wdm1
           |                ports: wwan1 (net), ttyUSB0 (qcdm), ttyUSB2 (at), wwan0 (net), 
           |                       cdc-wdm1 (qmi), ttyUSB1 (gps), cdc-wdm0 (qmi)
  --------------------------------
  Numbers  |                  own: 12345678910
  --------------------------------
  Status   |                 lock: sim-pin2
           |       unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (10), sim-puk2 (10)
           |                state: registered
           |          power state: on
           |          access tech: lte
           |       signal quality: 96% (recent)
  --------------------------------
  Modes    |            supported: allowed: 3g; preferred: none
           |                       allowed: 4g; preferred: none
           |                       allowed: 3g, 4g; preferred: 3g
           |                       allowed: 3g, 4g; preferred: 4g
           |              current: allowed: 3g, 4g; preferred: 4g
  --------------------------------
  Bands    |            supported: utran-1, utran-3, utran-4, utran-5, utran-8, utran-2, 
           |                       eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, eutran-8, 
           |                       eutran-12, eutran-13, eutran-20, eutran-25, eutran-41
           |              current: utran-1, utran-3, utran-4, utran-5, utran-8, utran-2, 
           |                       eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, eutran-8, 
           |                       eutran-12, eutran-13, eutran-20, eutran-25, eutran-41
  --------------------------------
  IP       |            supported: ipv4, ipv6, ipv4v6
  --------------------------------
  3GPP     |                 imei: 123456789987654
           |          operator id: 123456
           |        operator name: HOME
           |         registration: home
  --------------------------------
  3GPP EPS | ue mode of operation: csps-2
  --------------------------------
  SIM      |            dbus path: /org/freedesktop/ModemManager1/SIM/0

Key Sections:

  • General: Displays the DBus path and device ID.

  • Hardware: Provides details about the modem's manufacturer, model, firmware revision, hardware revision, supported technologies, and equipment ID.

  • System: Shows the device path, drivers, plugin used, primary port, and all associated ports.

  • Numbers: Lists the modem's own number.

  • Status: Indicates the SIM lock status, unlock retries, modem state, power state, access technology, and signal quality.

  • Modes: Details the supported and current modes.

  • Bands: Displays the supported and current frequency bands.

  • IP: Shows the supported IP types.

  • 3GPP: Lists the IMEI, operator ID, operator name, and registration status.

  • 3GPP EPS: Shows the user equipment mode of operation.

  • SIM: Provides the DBus path to the SIM.

Use this detailed information to manage and troubleshoot your modem effectively.

4. Handle SIM Lock

If the SIM is locked, you can unlock it using the SIM index found in the detailed information (/org/freedesktop/ModemManager1/SIM/0). Replace 1234 with your SIM's PIN:

# mmcli -i 0 --pin=1234
successfully sent PIN code to the SIM

You can find more PIN-related commands in the mmcli man page.

5. Connect to the Modem

After enabling the modem, you can connect to the cellular network using the APN for Hologram.

# mmcli -m 0 --simple-connect="apn=hologram"
successfully connected the modem

A bearer object is created and can be seen at the bottom of the output from mmcli -m 0:

plaintext Bearer   |            dbus path: /org/freedesktop/ModemManager1/Bearer/0

You can get information related to this bearer by executing:

# mmcli -b 0
  --------------------------------
  General            |  dbus path: /org/freedesktop/ModemManager1/Bearer/0
                     |       type: default
  --------------------------------
  Status             |  connected: yes
                     |  suspended: no
                     |  interface: wwan1
                     | ip timeout: 20
  --------------------------------
  Properties         |        apn: hologram
                     |    roaming: allowed
                     |    ip type: ipv4v6
  --------------------------------
  IPv4 configuration |     method: static
                     |    address: 33.214.211.245
                     |     prefix: 30
                     |    gateway: 33.214.211.246
                     |        dns: 10.177.0.34, 10.177.0.210
                     |        mtu: 1500
  --------------------------------
  IPv6 configuration |     method: static
                     |    address: 2607:fb90:1c36:692c:c915:a30b:a0ec:18bb
                     |     prefix: 64
                     |    gateway: 2607:fb90:1c36:692c:d899:5368:2142:b474
                     |        dns: fd00:976a::9, fd00:976a::10
                     |        mtu: 1500
  --------------------------------
  Statistics         |   duration: 29
                     |   bytes rx: 584
                     |   bytes tx: 804

As shown, the cellular connection has been established. NetworkManager is already configured to create routes for the new network interface.

You can verify the connection by looking at the output of ifconfig (NetworkManager will auto-connect on the next modem registration):

# ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:0d:00:2d:d1  
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ethernet0 Link encap:Ethernet  HWaddr 00:14:2d:a0:d5:9f  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6128 (5.9 KiB)  TX bytes:6128 (5.9 KiB)

wwan1     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:33.214.211.245  P-t-P:33.214.211.245  Mask:255.255.255.252
          inet6 addr: 2607:fb90:1778:8ea3:f8a3:e514:87f5:5971/64 Scope:Global
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1826 (1.7 KiB)  TX bytes:3494 (3.4 KiB)

Set Cellular Connection Retries

To handle intermittent connectivity, configure ModemManager to retry connections indefinitely. The default is four retries. Set it to zero for infinite retries:

# nmcli connection modify <connection-name> connection.autoconnect-retries 0

GPS

  1. ModemManager supports location discovery using Global Positioning System (GPS) or mobile network infrastructure.

To check GPS-specific location capabilities:

# mmcli -m 0 --location-status
  --------------------------------
  Location |         capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps
           |              enabled: 3gpp-lac-ci
           |              signals: no
  --------------------------------
  GPS      |         refresh rate: 30 seconds
           | supported assistance: xtra
           |   assistance servers: http://xtrapath1.izatcloud.net/xtra3grc.bin
           |                       http://xtrapath2.izatcloud.net/xtra3grc.bin
           |                       http://xtrapath3.izatcloud.net/xtra3grc.bin 
  1. The capabilities determine which location sources the modem supports and can be enabled. To enable any of the listed capabilities, use the following command:

# mmcli -m 0 \
   --location-enable-gps-raw \
   --location-enable-gps-nmea
Password: 
successfully setup location gathering
  1. To get the current location (dummy data shown):

# mmcli -m 0 --location-get
  --------------------------
  3GPP |      operator code: 111
       |      operator name: 222
       | location area code: FFFF
       | tracking area code: A1F9
       |            cell id: 005B2E0C
  --------------------------
  GPS  |               nmea: $GPGSA,A,2,,,,,,,,,,,,,,,*1E
       |                     $GPRMC,,V,,,,,,,,,,N*55
       |                     $GPGSV,4,1,16,03,00,288,,04,07,319,,05,,,,08,20,274,*4C
       |                     $GPGSV,4,2,16,11,04,333,,12,,,,13,26,056,,13,13,234,*42
       |                     $GPGSV,4,3,16,15,65,260,,16,,,,17,,,,18,63,067,*72
       |                     $GPGSV,4,4,16,20,18,100,,21,49,296,,22,32,200,,24,50,078,*7B
       |                     $GPVTG,,T,,M,,N,,K,N*2C
       |                     $GPGGA,,,,,,0,,,,,,,,*66

USB Ports

Existing USB Ports on ATDM

  1. Type-C OTG Port: This can be used for USB On-The-Go, allowing the device to function as either a host or a peripheral.

  2. Debug Port: Typically used for development and debugging purposes.

Expansion Options

To expand the USB ports, you can use external USB hubs or leverage the internal capabilities of the ATDM. Here are some approaches:

  1. External USB Hub:

    • Self-Powered USB Hub: Use a self-powered USB hub to add multiple USB ports. This hub is powered by an external power supply and can support multiple USB devices without overloading the Verdin SOM.

    • Bus-Powered USB Hub: Alternatively, use a bus-powered USB hub that draws power from the Type-C OTG port. However, this might be limited by the power available from the port.

Audio Out

ATDM provides robust audio output capabilities, making it suitable for various applications requiring high-quality sound. Here’s an in-depth look at the audio output features and how to utilize them effectively.

Audio Hardware Features

  • High-Fidelity Audio Output: The ATDM is equipped with high-quality DACs to ensure clear and crisp audio output, suitable for both voice and music playback.

  • Standard Audio Connectors: The device includes standard 3.5mm audio jacks and may also support digital audio outputs like HDMI or SPDIF, providing flexible options for connecting to external speakers or audio systems.

Software Tools for Audio Management

  • aplay: A simple command-line audio player for ALSA (Advanced Linux Sound Architecture). It can play various sound file formats, including WAV.

  • Audio Tools and Libraries: The ATDM can support various audio tools and libraries such as PulseAudio or ALSA utilities, providing comprehensive control over audio settings and playback.

Using aplay to Play a Sound File

The aplay command is a straightforward way to test and play audio files on the ATDM. Here’s how to use it:

  1. Install ALSA Utilities: Ensure that the ALSA utilities are installed on your system. If not, you can install them using the package manager:

    apt-get install alsa-utils
  2. Playing a Sound File: Use the aplay command to play a WAV file:

    aplay /path/to/your/soundfile.wav

    This command will play the specified sound file through the default audio output device.

Digital I/O

  • The Digital I/O can be accessed on the command line using the gpiolib commands.

  • gpiodetect reports the available GPIO interfaces, including the i.MX8 GPIO and external GPIO. The results are:

    • gpiochip0 [30200000.gpio] (32 lines)

    • gpiochip1 [30210000.gpio] (32 lines)

    • gpiochip2 [30220000.gpio] (32 lines)

    • gpiochip3 [30230000.gpio] (32 lines)

    • gpiochip4 [30240000.gpio] (32 lines)

    • gpiochip5 [3-0020] (16 lines)

    • gpiochip6 [max31911] (16 lines)

Digital Outputs Overview

The ATDM provides several digital outputs that can be controlled programmatically using the gpioset command. These outputs are managed through gpiochip5. Here’s how you can control the digital outputs:

  • GPIO Chip: The digital outputs are on gpiochip5.

  • Control Command: Use the gpioset command to set an output high or low.

  • Mapping Table: The physical outputs map to specific bits in gpiochip5.

Mapping Between Physical Outputs and Bits

Physical Output
GPIO Bit

Digital Output 1

0

Digital Output 2

1

Digital Output 3

2

Digital Output 4

3

Digital Output 5

4

Digital Output 6

5

Digital Output 7

10

Digital Output 8

11

Using gpioset Command

  • Set Output High: To turn on a digital output.

    gpioset 5 <bit>=1

    Example: To turn on Digital Output 1, use:

    gpioset 5 0=1
  • Set Output Low: To turn off a digital output.

    gpioset 5 <bit>=0

    Example: To turn off Digital Output 1, use:

    gpioset 5 0=0

C++ Example

Here is a C++ program that uses the system() function to call the gpioset command.

#include <iostream>
#include <cstdlib>
#include <unordered_map>

void set_output(int output, int value) {
    // Mapping physical output to GPIO bit
    std::unordered_map<int, int> output_map = {
        {1, 0},
        {2, 1},
        {3, 2},
        {4, 3},
        {5, 4},
        {6, 5},
        {7, 10},
        {8, 11}
    };

    // Check if the output number is valid
    if (output_map.find(output) == output_map.end()) {
        std::cerr << "Invalid output number: " << output << std::endl;
        return;
    }

    // Construct the command string
    std::string command = "gpioset 5 " + std::to_string(output_map[output]) + "=" + std::to_string(value);
    
    // Execute the command
    int result = system(command.c_str());
    if (result != 0) {
        std::cerr << "Failed to set output: " << output << std::endl;
    }
}

int main() {
    // Example usage
    set_output(1, 1);  // Turn on Digital Output 1
    set_output(1, 0);  // Turn off Digital Output 1
    set_output(7, 1);  // Turn on Digital Output 7
    set_output(7, 0);  // Turn off Digital Output 7

    return 0;
}

By following these guidelines and using the provided code example, you can effectively control the ATDM's digital outputs, allowing for versatile and programmable output management.

Digital Inputs Overview

The ATDM provides several digital inputs that can be monitored programmatically using the gpioget command. These inputs are managed through gpiochip6. Here’s how you can monitor the digital inputs:

  • GPIO Chip: The digital inputs are on gpiochip6.

  • Control Command: Use the gpioget command to read the state of an input.

  • Mapping Table: The physical inputs map to specific bits in gpiochip6.

Mapping Between Physical Inputs and Bits

Physical Input
GPIO Bit

Digital Input 1

0

Digital Input 2

1

Digital Input 3

2

Digital Input 4

3

Digital Input 5

4

Digital Input 6

5

Digital Input 7

10

Digital Input 8

11

Using gpioget Command

  • Read Input State: To read the state of a digital input.

    gpioget 6 <bit>

    Example: To read the state of Digital Input 1, use:

    gpioget 6 0

C++ Example

Here is a C++ program that uses the system() function to call the gpioget command and reads the state of the digital inputs.

#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <cstdio>
#include <memory>
#include <array>

std::string exec(const char* cmd) {
    std::array<char, 128> buffer;
    std::string result;
    std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
    if (!pipe) {
        throw std::runtime_error("popen() failed!");
    }
    while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
        result += buffer.data();
    }
    return result;
}

void read_input(int input) {
    // Mapping physical input to GPIO bit
    std::unordered_map<int, int> input_map = {
        {1, 0},
        {2, 1},
        {3, 2},
        {4, 3},
        {5, 4},
        {6, 5},
        {7, 10},
        {8, 11}
    };

    // Check if the input number is valid
    if (input_map.find(input) == input_map.end()) {
        std::cerr << "Invalid input number: " << input << std::endl;
        return;
    }

    // Construct the command string
    std::string command = "gpioget 6 " + std::to_string(input_map[input]);
    
    // Execute the command and get the output
    std::string state = exec(command.c_str());
    
    // Output the state
    std::cout << "Digital Input " << input << " state: " << state << std::endl;
}

int main() {
    // Example usage
    read_input(1);  // Read the state of Digital Input 1
    read_input(7);  // Read the state of Digital Input 7

    return 0;
}

By following these guidelines and using the provided code examples, you can effectively monitor the digital inputs on the ATDM, enabling responsive and real-time input management for your application.

Analog Inputs

Analog Inputs Overview

The ATDM provides several analog inputs that can be read programmatically via the file system. These inputs are managed through the Industrial I/O (IIO) subsystem. Here’s how you can monitor the analog inputs:

  • File System Path: The analog inputs are read from files in the /sys/bus/iio/devices/iio:device1 directory.

  • Reading Command: Use the cat command to read the raw value of an analog input.

  • Channel Mapping: The analog inputs map to specific channels (0-5).

Mapping Between Physical Inputs and Channels

Physical Input
Channel

Analog Input 1

0

Analog Input 2

1

Analog Input 3

2

Analog Input 4

3

Analog Input 5

4

Analog Input 6

5

Using cat Command

  • Read Input Value: To read the value of an analog input.

    cat /sys/bus/iio/devices/iio:device1/in_voltage<channel>_raw

    Example: To read the value of Analog Input 1 (channel 0), use:

    cat /sys/bus/iio/devices/iio:device1/in_voltage0_raw

C++ Example

Here is a C++ program that reads the raw value of the analog inputs from the file system.

#include <iostream>
#include <fstream>
#include <unordered_map>
#include <string>

int read_analog_input(int channel) {
    // Check if the channel number is valid
    if (channel < 0 || channel > 5) {
        std::cerr << "Invalid channel number: " << channel << std::endl;
        return -1;
    }

    // Construct the file path
    std::string file_path = "/sys/bus/iio/devices/iio:device1/in_voltage" + std::to_string(channel) + "_raw";
    
    // Read the analog input value from the file
    std::ifstream file(file_path);
    if (!file.is_open()) {
        std::cerr << "Unable to open file: " << file_path << std::endl;
        return -1;
    }

    int value;
    file >> value;
    file.close();

    return value;
}

int main() {
    // Example usage
    int value1 = read_analog_input(0);  // Read the value of Analog Input 1
    if (value1 != -1) {
        std::cout << "Analog Input 1 value: " << value1 << std::endl;
    }

    int value5 = read_analog_input(4);  // Read the value of Analog Input 5
    if (value5 != -1) {
        std::cout << "Analog Input 5 value: " << value5 << std::endl;
    }

    return 0;
}

By following these guidelines and using the provided code examples, you can effectively monitor the analog inputs on the ATDM, enabling precise and real-time input management for your application.

RS485

  1. Install Necessary Tools: Ensure minicom is installed for testing serial communication.

    apt-get update
    apt-get install minicom
  2. Check Serial Port: Verify the RS485 serial port is available (typically /dev/ttyUSB0 or similar).

    ls /dev/ttyUSB*
  3. Set Serial Port Parameters: Configure the serial port with the correct settings (adjust parameters as needed).

    stty -F /dev/ttyUSB0 9600 cs8 -cstopb -parenb
  4. Enable RS485 Mode: Create and compile a C program to enable RS485 mode.

    code#include <stdio.h>
    #include <stdlib.h>
    #include <fcntl.h>
    #include <unistd.h>
    #include <linux/serial.h>
    #include <sys/ioctl.h>
    #include <string.h>
    
    int main() {
        int fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
        if (fd < 0) {
            perror("open");
            return -1;
        }
    
        struct serial_rs485 rs485conf;
        memset(&rs485conf, 0, sizeof(rs485conf));
        rs485conf.flags |= SER_RS485_ENABLED;
        rs485conf.flags &= ~(SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND);
        rs485conf.delay_rts_before_send = 0;
        rs485conf.delay_rts_after_send = 0;
    
        if (ioctl(fd, TIOCSRS485, &rs485conf) < 0) {
            perror("ioctl TIOCSRS485");
            close(fd);
            return -1;
        }
    
        close(fd);
        return 0;
    }

    Compile and run the program:

    gcc -o enable_rs485 enable_rs485.c
    ./enable_rs485
  5. Connect Devices: Connect the RS485 lines between two devices (e.g., two Verdin modules or a Verdin module and another RS485-enabled device).

  6. Open Minicom: Start minicom on the Verdin module.

    minicom -D /dev/ttyUSB0 -b 9600
  7. Send and Receive Data: Type and send data in the terminal to verify communication. Use another terminal or device to receive and verify the data.

    echo "Test message" > /dev/ttyUSB0

    To read from the other device:

    cat /dev/ttyUSB0
  8. Check Data Transmission: Ensure the data sent from one device is correctly received by the other.

  9. Troubleshoot if Necessary: If communication fails, verify wiring, termination, serial port settings, and RS485 mode configuration.

CAN Channels

Setup and Use CAN and CAN FD on TorizonOS

1. Install CAN Utilities

Ensure CAN utilities are installed. TorizonCore usually comes with these tools, but you might need to install them in your container environment if not present.

apt-get update
apt-get install can-utils

2. Load Kernel Modules

Load the necessary kernel modules for CAN and CAN FD.

modprobe can
modprobe can_raw
modprobe mttcan  # Specific for many Toradex boards

3. Configure CAN Interface

Configure the CAN interface. Replace can0 with your actual interface name.

ip link set can0 down
ip link set can0 type can bitrate 500000
ip link set can0 up

4. Configure CAN FD Interface

Configure the CAN FD interface similarly.

ip link set can0 down
ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on
ip link set can0 up

5. Testing CAN Communication

  1. Send a CAN Message: Use cansend to send a CAN message.

    # cansend can0 123#atdm
  2. Listen for CAN Messages: Use candump to listen for incoming CAN messages.

    # candump can0
    can0  123   [2]  AT DM

6. Testing CAN FD Communication

  1. Send a CAN FD Message: Use cansend to send a CAN FD message.

    # cansend can0 123##1F112233445566778899AABBCCDDEEFF
  2. Listen for CAN FD Messages: Use candump to listen for incoming CAN FD messages.

    # candump -L can0

7. Using CAN and CAN FD in a Torizon Container

  1. Create and Configure a Torizon Container: Create a Docker container with CAN utilities installed.

    dockerfile FROM torizon/base:latest
    apt-get update && apt-get install -y can-utils
  2. Run the Container with CAN Support: When starting the container, pass the necessary device files and network settings to access the CAN interface.

    docker run -it --rm --network host --privileged \
       -v /dev:/dev torizon-canfd
  3. Inside the Container: Use cansend and candump utilities inside the container as you would on the host.

    # Send a CAN message
    cansend can0 123#atdm
    
    # Listen for CAN messages
    candump can0
    
    # Send a CAN FD message
    cansend can0 123##1F112233445566778899AABBCCDDEEFF
    
    # Listen for CAN FD messages
    candump -L can0

Now you can start using applications that may connect to the CAN Network, or simply use the can-utils for testing.

PreviousWiring and InterfacesNextHardware Verification

Last updated 1 year ago

Download and install Putty from .

For programming a Linux application in C/C++, you can use the API. There is also a wrapper for it in .

đŸ–Ĩī¸
đŸŗī¸
Putty's official website
Toradex page on playing audio using a C++ application
SocketCAN
Python