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 (1)
 
Question
4. Development of applications (1)
4.1 How to modify if we want to use another serial port?
4.2 How to debug I2C?
4.3 How to debug SPI?
4.4 How to debug RS485?
4.5 How to debug ADC?
4.6 How to debug GPIO?
Answer

4. Development of applications (1)

4.1 How to modify if we want to use another serial port?

A: The driver is ready on the MYD-Y6UL/6ULL development board. We only need to modify dts file. The specific pin depends on practical case.

  • Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”

UART: take the example of adding UART3. Please note to delete the 2 lines about UART3 in original dts file “pincrl_uart2” because there is only 1 usage mode for 1 pin.

  • In “myb-y6ull-14x14.dts”, add UART3 referring to existing UART.

    pinctrl_uart3: uart3grp {                 fsl,pins = <

                          MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX  0x1b0b1

                          MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX  0x1b0b1

                   >;

            };

    ……..

    &uart3 { pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_uart3>;

    status = "okay";

    };


4.2 How to debug I2C?

A: Determine which pin to use according to the hardware design. Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”.

The codes for I2C1 and I2C2 are provided in “myb-y6ull-14x14.dts”. So here we take the example of I2C3. Disable fec2 because I2C3 uses fec2.

&i2c3 {        clock-frequency = <100000>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_i2c3>;

        status = "okay";

};

……….

    pinctrl_i2c3: i2c3grp {                        fsl,pins = <                          MX6UL_PAD_ENET2_RX_DATA0__I2C3_SCL 0x4001b8b0                           MX6UL_PAD_ENET2_RX_DATA1__I2C3_SDA 0x4001b8b0

}

4.3 How to debug SPI?

A: Determine which pin to use according to the hardware design. Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”.

Modify dts file and the following example codes. Which SPI to use and pin configuration depends on practical demand.

Enable spi_dev in “make menuconfig”.

Directory: SPI SUPPORT/User mode SPI device driver support

                pinctrl_ecspi1: ecspi1grp {

               fsl,pins = <

                      MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x100b1

                      MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x100b1

                      MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x100b1

               >;

        };

       

        pinctrl_ecspi1_cs: ecspi1cs {

               fsl,pins = <

                      MX6UL_PAD_CSI_DATA05__GPIO4_IO26  0x80000000

               >;

        };

……..

&ecspi1 {

compatible = "fsl,imx6ul-ecspi";

fsl,spi-num-chipselects = <1>;

cs-gpios = <&gpio4 26 0>;

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;

status = "okay";

spidev@0x00{

        #address-cellss=<1>;

        #size-cells=<1>;

        compatible = "spidev";

        spi-max-frequency = <8000000>;

        reg = <0>;

};

};

4.4 How to debug RS485?

A: Determine which pin to use according to the hardware design. Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”.

Example code:

        pinctrl_uart3: uart3grp {

               fsl,pins = <

                      MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX    0x1b0b1

                      MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX     0x1b0b1

               /*    MX6UL_PAD_UART1_CTS_B__GPIO1_IO18       0x1b0b1 RS485 RE/DE */

               >;

        };

……………………

&uart3 {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_uart3>;

fsl, rs485-gpio-txen = <&gpio1 18 GPIO_ACTIVE_HIGH>;

linux,rs485-enable-at-boot-time;

status = "okay";

};

4.5 How to debug ADC?

A: Determine which pin to use according to the hardware design. Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”.

regulators {

        compatible = "simple-bus";

        #address-cells = <1>;

        #size-cells = <0>;

        reg_can_3v3: regulator@0 {

               compatible = "regulator-fixed";

               reg = <0>;

               regulator-name = "can-3v3";

               regulator-min-microvolt = <3300000>;

               regulator-max-microvolt = <3300000>;

        };

        reg_vref_3v3: regulator@3 {

                         compatible = "regulator-fixed";

                         regulator-name = "vref-3v3";

                         regulator-min-microvolt = <3300000>;

                         regulator-max-microvolt = <3300000>;

       }

}

pinctrl_adc1: adc1grp {

                   fsl,pins = <

                                MX6UL_PAD_GPIO1_IO01__GPIO1_IO01        0xb0

                   >;

             };

…..

&adc1 {  

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_adc1>;

num-channels = <1>;

vref-supply = <&reg_vref_3v3>;

status = "okay";  

};

Enable iio and vf610_adc through “make menuconfig”, then compile to generate new kernel and dtb file.


4-5-1 Enable VF610_ADC in kernel


4-5-2 Enable IIO in kernel

Then read value and set parameters from directories including “/sys/bus/iio/devices/iio\:device0/”

4.6 How to debug GPIO?

A: Determine which pin to use according to the hardware design. Open the kernel source code file “/arch/arm/boot/dts/myb-y6ull-14x14.dts”.

GPIO: set LCD_DATA0 as GPIO.

&iomuxc {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_hog_1>;

imx6ul-evk {

        pinctrl_hog_1: hoggrp-1 {

               fsl,pins = <

                      MX6UL_PAD_UART1_RTS_B__GPIO1_IO19 0x17059 /* SD1 CD */

                      MX6UL_PAD_JTAG_MOD__GPIO1_IO10            0x17059 /* WiFi module power */

                      MX6UL_PAD_NAND_CE1_B__GPIO4_IO14  0x17059 /* LTE Reset */

                      MX6UL_PAD_GPIO1_IO00__ANATOP_OTG1_ID    0x17059 /* USB OTG1 ID */

                      MX6UL_PAD_GPIO1_IO09__GPIO1_IO09    0x1b0b0 /* LCD_DISP */

                      MX6UL_PAD_GPIO1_IO02__GPIO1_IO02        0x10b1

                      MX6UL_PAD_LCD_DATA00__GPIO3_IO05      0x1b0b0  (Set LCD_DATA0 as GPIO)

……

&lcdif {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_lcdif_dat_16bits

             &pinctrl_lcdif_ctrl

             &pinctrl_lcdif_reset>;

display = <&display0>;

status = "disabled";  (Disable previous usage of LCD_DATA0)

After above modification to dts file, load the tool chain to compile.