MCUXpresso SDK Documentation

t-format_polling_transfer

t-format_polling_transfer#

Overview#

The t-format_polling example shows how to use flexio T-format driver in polling way:

In this example, a flexio simulated T-format connect to the encoder through RS-485, the board will send requests to and receive responses from the board.

Supported Boards#

i.MXRT1180-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT1180-EVK board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

  • RS-485 adapter board

Board settings

This example requires connecting between FlexIO2 pins and RS-485 adapter board which is connected to the encoder.

  • FLEXIO_T_FORMAT_TX_PIN(J41-2) -> RX pin of RS-485

  • FLEXIO_T_FORMAT_RX_PIN(J41-4) -> TX pin of RS-485

  • FLEXIO_T_FORMAT_DR_PIN(J41-6) -> D/R pin of RS-485

  • 3.3V pin(J45-8) -> 3.3V pin of RS-485

  • GND pin(J45-12) -> GND pin of RS-485

  • 5.0V pin(J45-16) -> 5.0V pin of encoder

  • GND pin(J45-14) -> GND pin of encoder

  • A pin of RS-485 -> SD+ pin of encoder

  • B pin of RS-485 -> SD- pin of encoder

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW1 to power on the board.

  2. Connect a micro USB cable between the host PC and the J53 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

When the example runs successfully, you can see the similar information from the terminal as below.

Encoder T-format example
Encoder ID: 5946590
Multi-turn data: 64474, single-turn data: 147617
[0.10s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 45.000000
[0.20s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 44.000000
FRDM-MIMXRT1186
Hardware requirements
  • USB Type-C cable

  • FRDM-IMXRT1186 board

  • 5V power supply

  • Personal Computer

  • FRDM-LVPMSM-FA board

  • 4-pin Mini DIN power supply

Board settings

This example requires connecting between FRDM-IMXRT1186 board and FRDM-LVPMSM-FA board.

  • Short J4-1 and J4-2 on the FRDM-IMXRT1186 board

  • Short J300-1 and J300-2 on the FRDM-LVPMSM-FA board

  • J72 and J73 jumpers are left unconnected on the FRDM-LVPMSM-FA board

  • FRDM-LVPMSM-FA SW90[1-4] = 0111

  • FRDM-LVPMSM-FA SW30[1-4] = 0100

  • FRDM-LVPMSM-FA J70-1 -> 5.0V pin of encoder

  • FRDM-LVPMSM-FA J70-6 -> GND pin of encoder

  • FRDM-LVPMSM-FA J70-4 -> SD+ pin of encoder

  • FRDM-LVPMSM-FA J70-9 -> SD- pin of encoder

Prepare the Demo
  1. Connect a USB Type-C cable between the PC host and the OpenSDA USB port on the FRDM-IMXRT1186 board.

  2. Connect 5V power supply, then switch SW5 to power on the FRDM-IMXRT1186 board.

  3. Connect 4-pin Mini DIN power supply to J10 on the FRDM-LVPMSM-FA board.

  4. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  5. Download the program to the target board.

  6. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

When the example runs successfully, you can see the similar information from the terminal as below.

Encoder T-format example
Encoder ID: 5946590
Multi-turn data: 64474, single-turn data: 147617
[0.10s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 45.000000
[0.20s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 44.000000
IMX943-EVK
Hardware requirements
  • Micro USB cable

  • IMX943-EVK board

  • J-Link Debug Probe

  • 12V~20V power supply

  • Personal Computer

  • RS-485 adapter board

Board settings

This example requires connecting between FlexIO1 pins and RS-485 adapter board which is connected to the encoder.

  • FLEXIO_T_FORMAT_DR_PIN(J48-10) -> D/R pin of RS-485

  • FLEXIO_T_FORMAT_TX_PIN(J48-9) -> RX pin of RS-485

  • FLEXIO_T_FORMAT_RX_PIN(J48-11) -> TX pin of RS-485

  • 3.3V pin(J49-8) -> 3.3V pin of RS-485

  • GND pin(J49-12) -> GND pin of RS-485

  • 5.0V pin(J49-10) -> 5.0V pin of encoder

  • GND pin(J49-14) -> GND pin of encoder

  • A pin of RS-485 -> SD+ pin of encoder

  • B pin of RS-485 -> SD- pin of encoder

Please note this application can’t support running with Linux BSP!
Note

Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict. Tips: After you insert the USB2COM, a new USBCOM will be found. The function output in new USBCOM.

Prepare the Demo
  1. Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.

  2. Connect a micro USB cable between the host PC and the J1401 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

When the example runs successfully, you can see the similar information from the terminal as below.

Encoder T-format example
Encoder ID: 5946590
Multi-turn data: 64474, single-turn data: 147617
[0.10s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 45.000000
[0.20s] Encoder ID: 0x5ABCDE
         Multi-turn data: 64474, single-turn data: 147617
         Temperature: 44.000000