琳子 发表于 2020-12-17 16:14

连载-iMX6ULL 软件定制应用笔记 -3个常见问题解决思路

本帖最后由 琳子 于 2020-12-17 16:17 编辑

本文以飞凌OKMX6ULL-S开发板为基础讲解,系统为Linux,一共总结了14个iMX6ULL小知识点,分三期完成。iMX6ULL应用笔记目录
1.1 管脚复用的参数配置方法(PINMUX)
1.2 Windows下转换开机**图片格式
1.38189es SDIO WIFI使用及测试
1.4USB转串口芯片的支持(PL2303)
1.5增加串口
1.6串口配置DMA
1.7LCD转LVDS模块
1.8LCD转VGA模块
1.9硬浮点运算
1.10OTG修改模式
1.11使用EC20模块实现4G-AP功能
1.12SPI转CAN接口
1.13ADC接口
1.14LCD的屏幕参数调整
注意: 本应用笔记只是举例说明,如果飞凌iMX6ULL提供的软件版本更新之后,有些位置名称等内容可能会及时更新,修改方法参考下面修改。注意: 本应用笔记参照imx6ull-S-emmc-1024x600c7.dts 设备树基础上修改,其他屏幕设备树方法类似。
设备树说明(参考用户资料v1.0):
菜单选项eMMC版本对应设备树名称NAND版本对应设备树名称
800x480cr7imx6ull-S-emmc-800x480cr7.dtsimx6ull-S-gpmi-800x480cr7.dts
1280x800c10dot1imx6ull-S-emmc-1280x800c10dot1.dtsimx6ull-S-gpmi-1280x800c10dot1.dts
1024x600c7imx6ull-S-emmc-1024x600c7.dtsimx6ull-S-gpmi-1024x600c7.dts
800x600r8imx6ull-S-emmc-800x600r8.dtsimx6ull-S-gpmi-800x600r8.dts
800x600r10dot4imx6ull-S-emmc-800x600r10dot4.dtsimx6ull-S-gpmi-800x600r10dot4.dts
640x480r5dot6imx6ull-S-emmc-640x480r5dot6.dtsimx6ull-S-gpmi-640x480r5dot6.dts
480x272r4dot3imx6ull-S-emmc-480x272r4dot3.dtsimx6ull-S-gpmi-480x272r4dot3.dts
320x240r3dot5imx6ull-S-emmc-320x240r3dot5.dtsimx6ull-S-gpmi-320x240r3dot5.dts

nand设备树包含与其对应的emmc设备树,大部分配置在emmc设备树中。1.1 管脚复用的参数配置方法(PINMUX)管脚复用所需要修改的文件位置:arch/arm/boot/dts/imx6ull-pinfunc.h#define MX6UL_PAD_LCD_DATA16__UART7_DCE_TX                        0x0158 0x03E4 0x0000 0x1 0x0#define MX6UL_PAD_LCD_DATA17__UART7_DCE_RX                        0x015C 0x03E8 0x0654 0x1 0x3
arch/arm/boot/dts/imx6ull-S-emmc-1024x600c7.dtspinctrl_uart7: uart7_grp {    fsl,pins = <      MX6UL_PAD_LCD_DATA17__UART7_DCE_RX0x1B0B1      MX6UL_PAD_LCD_DATA16__UART7_DCE_TX0x1B0B1    >;};
配置说明:
mux_ctrl_ofspad_ctrl_ofssel_input_ofsmux_modesel_inputpad_ctrl
0x0158   0x03E40x00000x10x00x1B0B1

相应参数的含义参考官方手册《IMX6ULLRM.pdf》,此处以LCD_DATA16为例:1. 确定mux_ctrl寄存器地址和mux_mod值。(p1631) 其中mux_ctrl_ofs 为0x0158,mux_mode为ATL1。(注意:此处配置的是MUX_CTL,请区别于PAD_CTL)2. 确定pad_ctrl寄存器地址和pad_ctl值。 其中pad_ctrl_ofs为0x03E4,pad_ctrl 为0x1b0b1。(注意:此处配置的是PAD_CTL,请区别于MUX_CTL,pad_ctrl值根据使用需要配置)   3. 确定sel_input寄存器的地址和sel_input的值。 由于没有与LCD_DATA16对应的sel_input_ofs和sel_input值,只需要填0即可,sel_input_ofs为0x000,sel_input为0。(注意:上图只是UART7_RTS参考,相应数据位置参考箭头指向即可)1.2Windows下转换开机**图片格式参考屏幕对应的分辨率:(默认7寸1024x600)
屏幕分辨率
7寸800x480
7寸1024x600
8寸800x600
注意前提已经得到相应尺寸的**.jpg图片,之后使用以下软件转换**的位深及格式。Windows更改方法:(工具提供软件FSResizer43.zip)1. 运行箭头指向的软件。 2. 按照步骤配置前5步: 3. 接着选择位深为8bit: 最后配置导出位置及格式: 按照烧写过程,可将图片重新命名为**.bmp替换烧录工具中的**.bmp文件,即可替换出厂**图片。 1.38189es SDIO WIFI使用及测试SDIO WIFI无线局域模组是选配模块。如若有需求,请联系飞凌嵌入式销售人员。i.MX6ULL支持飞凌提供的8189es模块。连接方法如图: 使用之前需要修改替换设备树。采用的是arch/arm/boot/dts/imx6ull-14x14-evk.dts由:&usdhc1 {cd-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;};修改为:&usdhc1 {/*cd-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>; */nonremovable;};编译并替换为此设备树。SDIO WIFI功能测试步骤:步骤1:开发板断电,连接好飞凌的SDIO WIFI到飞凌开发板的SDIO 接口,正确安装如上图。步骤2:开发板上电,启动Linux系统,默认插入之后,模块会自动加载,如果模块没自动加载,请确保已经卸载之后,手动加载。root@fl-imx6ull:~# insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/realtek/rtl8189ES/8189es.ko查看加载驱动:root@fl-imx6ull:~# lsmod出现如下信息,表示模块和驱动匹配成功Module                  SizeUsed by8189es                8850530步骤3:执行下面的命令,检测开发板wifi网卡状况,路由器使用wpa加密。root@fl-imx6ull:~# ifconfig wlan0wlan0   Link encap:EthernetHWaddr A0:F4:59:73:22:C6          BROADCAST MULTICASTMTU:1500Metric: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)步骤4:关闭以太网卡,命令如下。root@fl-imx6ull:~# ifconfig eth0 downroot@fl-imx6ull:~# ifconfig eth1 down步骤5:启动SDIO WIFI,命令如下。root@fl-imx6ull:~# ifconfig wlan0 up步骤6:使用SDIOWIFI扫描无线网络设备,命令如下。root@fl-imx6ull:~# iwlist wlan0 scanwlan0   Scan completed :          Cell 01 - Address: 4C:E9:E4:B8:65:6A                  ESSID:"forlinx"                  Protocol:IEEE 802.11bgn                  Mode:Master                  Frequency:2.412 GHz (Channel 1)                  Encryption key:on                  Bit Rates:300 Mb/s                  Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202                  IE: WPA Version 1                        Group Cipher : CCMP                        Pairwise Ciphers (1) : CCMP                        Authentication Suites (1) : PSK                  Extra:                  IE: IEEE 802.11i/WPA2 Version 1                        Group Cipher : CCMP                        Pairwise Ciphers (1) : CCMP                        Authentication Suites (1) : PSK                  Quality=68/100Signal level=42/100                  Extra:fm=0001步骤7:设置SDIO WIFI的ESSID。(此步骤可以省略)root@fl-imx6ull:~# iwconfig wlan0 essid frolinxRTL871X: set ssid fw_state=0x00000008步骤8:生成wpa密码,wpa_passphrase命令从标准输入读取明文,执行命令后占用终端等待明文输入。 root@fl-imx6ull:~# wpa_passphrase "forlinx"> wpa.confxxxxxx为输入明文密码,回车结束后自动保存到wpa.conf。步骤9:连接路由器,命令如下。 root@fl-imx6ull:~# wpa_supplicant -Dwext -cwpa.conf -iwlan0 & 599root@fl-imx6ull:~# Successfully initialized wpa_suppRTL871X: set bssid:00:00:00:00:00:00licantrfkill: Cannot open RFKILRTL871X: set ssid fw_state=0x00000008L control deviceioctl: Operation not permittedioctl: Resource temporarily unavailableioctl: Resource temporarily unavailableRTL871X: indicate disassocwlan0: Trying to associate with 04:d7:a5:84:fa:40 (SSID='forlinx'RTL871X: set ssid fw_state=0x00000008 freq=2437 MHz)RTL871X: set bssid:04:d7:a5:84:fa:40RTL871X: start authRTL871X: auth success, start assocRTL871X: assoc successRTL871X: recv eapol packetIPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes readywlan0: Associated with 04:d7:a5:84:fa:40RTL871X: send eapol packetRTL871X: recv eapol packetRTL871X: send eapol packetRTL871X: set pairwise key camid:4, addr:04:d7:a5:84:fa:40, kid:0, type:AESwlan0: WPA: Key negotiation complRTL871X: set group key camid:5, addr:04:d7:a5:84:fa:40, kid:2, type:AESeted with 04:d7:a5:84:fa:40 wlan0: CTRL-EVENT-CONNECTED - Connection to 04:d7:a5:84:fa:40 completed 如果出现wifi模块连接失败,重连路由器前,需要采用ps查看是否存在wpa_supplicant -Dwext -cwpa.conf -iwlan0进程。如果存在,将此进程kill掉之后,再连接路由器。步骤10:自动ip地址分配dhcp,命令如下。 root@fl-imx6ull:~# udhcpc -iwlan0udhcpc (v1.24.1) startedSending discover...Sending select for 192.168.5.94...Lease of 192.168.5.94 obtained, lease time 36000/etc/udhcpc.d/50default: Adding DNS 222.222.202.202/etc/udhcpc.d/50default: Adding DNS 222.222.222.222步骤11:ping ip或者域名,命令如下。root@fl-imx6ull:~# ping www.forlinx.comPING www.forlinx.com (211.149.226.120): 56 data bytes64 bytes from 211.149.226.120: seq=0 ttl=51 time=63.650 ms64 bytes from 211.149.226.120: seq=1 ttl=51 time=59.575 ms64 bytes from 211.149.226.120: seq=2 ttl=51 time=54.193 ms64 bytes from 211.149.226.120: seq=3 ttl=51 time=114.156 ms64 bytes from 211.149.226.120: seq=4 ttl=51 time=206.920 ms^C--- www.forlinx.com ping statistics ---5 packets transmitted, 5 packets received, 0% packet lossround-trip min/avg/max = 54.193/99.698/206.920 ms步骤12:卸载已经加入内核的模块。 root@fl-imx6ull:~# rmmod 8189esRTL871X: module exit startRTL871X: indicate disassocwlan0: CTRL-EVENT-DISCONNECTED bssid=04:d7:a5:84:fa:40 reason=3 locally_generated=1RTL871X: rtw_ndev_uninit(wlan0) if1RTL871X: rtw_cmd_thread: DriverStopped(True) SurpriseRemoved(False) break at line 564RTL871X: rtw_dev_unload: driver not in IPSRTL871X: module exit success如果采用wep加密方式路由器连接时,采用如下命令:设置essid: root@fl-imx6ull:~# iwconfig wlan0 essid “devnet”设置路由器访问密码:root@fl-imx6ull:~# iwconfig wlan0 key “1234567890”之后动态分配IP或静态设置IP与网关均可。注意:1. 本小节中是一个SDIO WIFI连接路由的示例。由于网络环境的不同,所以在您做本实验时,请根据实际情况进行设置。原文链接:https://www.forlinx.com/article_view_602.html

琳子 发表于 2020-12-17 16:17

还有下期喔
页: [1]
查看完整版本: 连载-iMX6ULL 软件定制应用笔记 -3个常见问题解决思路