Overview
Online Support
FAQ
  Atmel Series  (29) TOP10
  MYS-SAM9X5 (3)
  MYS-SAM9G45 (1)
  MYD-SAM9X5 (7)
  MYD-SAM9X5-V2 (2)
  MYD-JA5D2X (0)
  MYD-SAMA5D3X (11)
  MYD-SAMA5D3X-C (0)
  MYD-JA5D4X (0)
  MYC-SAM9X5 (4)
  MYC-SAM9X5-V2 (1)
  MYC-JA5D2X (0)
  MYC-SAMA5D3X (0)
  MCC-SAMA5D3X-C (0)
  MYC-JA5D4X (0)
  NXP Series  (23) TOP10
  MYS-6ULX (4)
  MYD-Y6ULX (3)
  MYD-Y6ULX-HMI (1)
  MYD-IMX28X (2)
  MYD-LPC435X (2)
  MYD-LPC185X (1)
  MYD-LPC1788 (0)
  MYC-Y6ULX (4)
  MYC-IMX28X (0)
  i.MX 6UL/6ULL (6)
  TI Series  (24) TOP10
  MYD-AM335X (12)
  MYD-AM335X-Y (0)
  MYD-AM335X-J (0)
  MYD-C437X (0)
  MYD-C437X-PRU (5)
  Rico Board (6)
  MYC-AM335X (1)
  MCC-AM335X-Y (0)
  MCC-AM335X-J (0)
  MYC-C437X (0)
  Xilinx Series  (20) TOP10
  Z-turn Board (9)
  Z-turn Lite (2)
  MYD-C7Z010/20 (0)
  MYD-C7Z015 (7)
  MYD-Y7Z010/007S (0)
  MYC-C7Z010/20 (0)
  MYC-C7Z015 (0)
  MYC-Y7Z010/007S (0)
  HMI Solutions  (0) TOP10
  MYD-Y6ULX-CHMI (0)
  MY-EVC5100S-HMI (0)
  Others  (1) TOP10
  MY-WF003U (1)
 
  Home >  Support > NXP Series > i.MX 6UL/6ULL
 
Part Four: Development of applications (2)
 
Question
4. Development of applications (2)
4.7 The corresponding relationship between ttymxc and uart
4.8 How to calculate GPIO number, how to use the GPIO?
4.9 How to enable/disable the Ethernet ports?
4.10 How to add other baud rate for serial port?
4.11 PWM control program
4.12 What are the LED1 & LED2 of Ethernet port for?
4.13 How to make MYD-6ULX support LVDS?
Answer

4. Development of applications (2)

4.7 The corresponding relationship between ttymxc and uart

A: UART1 corresponds to ttymxc0

UART2 corresponds to ttymxc1

UART3 corresponds to ttymxc2

4.8 How to calculate GPIO numbers, how to use the GPIO?   

A: Make sure the GPIO in dts is not used before using the GPIO. Define the GPIO in dts, generate new dtb, program it to the board, then the board is able to input and output via the GPIO.

Calculation formula for GPIO number: (n-1)*32 +m

Examples:

LCD_DATA14 is gpio3.io19.

(M-1)*32+n = (3-1)*32+19=83

Set GPIO to output, set high/low voltage of GPIO:

echo 83 > /sys/class/gpio/export             (Set the GPIO number)

echo out > /sys/class/gpio/gpio83/direction     (Set GPIO to output)

cat /sys/class/gpio/gpio10/value             (Check the high/low voltage of GPIO)

echo 0 > /sys/class/gpio/gpio10/value         (Set high/low voltage of GPIO)

4.9 How to enable/disable the Ethernet ports?   

A: The eth0 is brought out from MYC-Y6ULX CPU module directly. If only one Ethernet port is needed, we may disable other Ethernet ports in dts. Meanwhile, you need to move the configuration for mdio in dts to the ethernet port which you want to use.

Two RJ45 connectors on MYD-6ULX board: CN2 is eth0, CN1 is eth1.

Example code for modifying one Ethernet port:

&fec1 {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_enet1>;

phy-mode = "rmii";

phy-handle = <&ethphy0>;

phy-reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;

phy-reset-duration = <26>;

status = "okay";

    mdio {

        #address-cells = <1>;

        #size-cells = <0>;

        ethphy0: ethernet-phy@0 {

               compatible = "ethernet-phy-ieee802.3-c22";

               smsc,disable-energy-detect;

               reg = <0>;

        };

};

4.10 How to add other baud rate for serial port?  

A: Add kernel source code in “/driver/tty/serial/serial_core.c”. Example code:

static const struct baud_rates baud_rates[] = {

{ 921600, B921600 },

{ 460800, B460800 },

{ 230400, B230400 },

{ 115200, B115200 },

{  57600, B57600  },

{  38400, B38400  },

{  19200, B19200  },

{   9600, B9600   },

{   4800, B4800   },

{   2400, B2400   },

{   1200, B1200   },

{      0, B38400  }

4.11 PWM control program

A: We only provide the output configuration of PWM below, this is not enough, you need to add PWM node according to the pin you used by modifying dts.

echo 100000 > /sys/class/pwm/pwmchip0/pwm0/period

echo 50000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle

echo 0 > /sys/class/pwm/pwmchip1/export

echo 100000 > /sys/class/pwm/pwmchip1/pwm0/period

echo 50000 > /sys/class/pwm/pwmchip1/pwm0/duty_cycle

echo 0 > /sys/class/pwm/pwmchip2/export

echo 100000 > /sys/class/pwm/pwmchip2/pwm0/period

echo 50000 > /sys/class/pwm/pwmchip2/pwm0/duty_cycle

echo 0 > /sys/class/pwm/pwmchip3/export

echo 100000 > /sys/class/pwm/pwmchip3/pwm0/period

echo 50000 > /sys/class/pwm/pwmchip3/pwm0/duty_cycle

4.12 What are the LED1 & LED2 of Ethernet port for?

A: LED1: data transmission indicator (green). LED2: connection indicator (orange).

4.13 How to make MYD-6ULX support LVDS?

A: Convert RGB to LVDS. Below circuit designs are for your reference.


4-13-1 Example circuit 1


4-13-2 Example circuit 2


4-13-3 Example circuit 3