AN-073: Using the MAX22190PMB with TMCM-0960-MotionPy

Abstract

This document introduces the usage of MAX22190PMB with the TMCM-0960-MotionPy. The MAX22190 peripheral module provides the hardware to evaluate the MAX22190 Octal Industrial Digital Input. The functionality and the implementation in the MicroPython environment are introduced.

Introduction

The MAX22190PMB[1] provides the hardware to evaluate the MAX22190[2] octal digital input driver. It translates eight, 24V current-sinking, industrial inputs to a serialized SPI compatible output and can be powered from a single low voltage logic supply. For more information please refer to the MAX22190[2] product page. The MAX22190PMB can be evaluated together with the TMCM-0960-MotionPy V2.X[4]. Therefore, some basic functions have been implemented in Python to use this setup in a MicroPython environment. This document will give a brief introduction on how to start up the example and use the basic functions of the module.

Figure 1. MAX22190PMB.

Requirements

  • Set up TMCM-0960-MotionPy[4] as shown in AN-061[3].
  • Terminal connection to TMCM-0960-MotionPy.
  • Wire up MAX22190PMB.[1]

Connecting the PMOD board

There are multiple options to connect the MAX22190PMB to the TMCM-0960-MotionPy[4]. In the default configuration, the MAX22190PMB is connected to PMOD-0 connector on the TMCM-0960-MotionPy V2.X. This setup is shown in Figure 2. The corresponding pins can be found in Table 1.

Figure 2. MAX22190PMB connected to TMCM-0960-MotionPy V2.X.

Table 1. Standard connection configuration
MAX22190PMB Pin Description
SCLK SCLK(1) Serial Clock
MISO MISO(1))/SDI(1) Serial data in
MOSI MOSI(1))/SDO(1) Serial data out
CS A4 Chip Select
FAULT C6 Active-Low Fault Indicator.
READY B0 Goes low indicating readiness.
LATCH C12 Control the data latch

Structure and functions

In this implementation, the script addresses the chip using SPI Mode 1. This mode is the default for the MAX22190PMB and can be changed via the configuration resistors. In this mode the frame length is 16-bits, CRC mode is disabled and Daisy Chain is not enabled. For a full list of the registers and the corresponding functions have a look at the MAX22190 datasheet[7]. The communication, as well as some useful functions, have been implemented in the max22190.py[5] script. In max22190.py you will find the class MAX22190. This class handles the communication with the ic and provides some convenience functions. The functions get_digital_input_states() and get_wire_break_states() will return the corresponding states as a list. If you want to get the wire break states do not forget to turn on the the feature in corresponding registers. Have a look in the max22190pmb.py[6] example for reference. To get and set the states of the pins use the functions get_fault_pin(), get_ready_pin(), get_latch_pin() and set_latch_pin(value) can be used.

Running the example

To start you can use the example script max22190pmb.py[6]. Start by connecting the MAX22190PMB to the TMCM-0960-MotionPy. Connect the MotionPy to your PC and start a terminal connection. If you connected the MAX22190PMB to PMOD-0 on TMCM-0960-MotionPy you can simply run the script. Otherwise, open the example script and edit the configuration. You can start the example script with the command:

exec ( open (" PyTrinamicMicro / platforms / motionpy2 / examples / modules / max /
,→ max22190pmb .py"). read () )


This script first activates the wire break features in the channels and will then read out the states and the pins. The script should now display the readout in the terminal in the following structure.

Channel nr .: 12345678; Channel nr .: 12345678
IO states : xxxxxxxx ; Wire Break states : xxxxxxxx }


The readout updates regularly. Play around with the MAX22190PMB, feel free to modify the example, and have fun exploring the features.

References

[1] MAX22190PMB product page: www.maximintegrated.com/en/products/interface/sensor-interface/MAX22190PMB.html

[2] MAX22190 product page: www.maximintegrated.com/en/products/interface/sensor-interface/MAX22190.html

[3] Application Note AN061-TMCM_0960_Module: www.trinamic.com/products/modules/details/tmcm-0960-motionpy/

[4] TMCM-0960-MotionPy product page: www.trinamic.com/products/modules/details/tmcm-0960-motionpy/

[5] Path to max14912pmb.py: PyTrinamicMicro/platforms/motionpy2/modules/max/max22190.py

[6] Path to max14912pmb.py: PyTrinamicMicro/platforms/motionpy2/examples/modules/max22190pmb.py

[7] MAX22190 Datasheet: datasheets.maximintegrated.com/en/ds/MAX22190.pdf