Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    通过USB共享使D1s上的tina联网(RNDIS Gadget)

    MR Series
    6
    12
    6577
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SdtEE
      SdtEE LV 4 last edited by

      之前设计这块D1s的PCB的时候,出于复杂度的考虑,板子上没有预留WiFi 模块的焊盘,当然更没有做GMAC。那么当初我就没有打算让这块板子联网吗?当然不是。除了WiFi和插网线以外,支持USB peripheral的设备还有一种简单的联网方式,也就是配置设备为RNDIS Gadget。通过这种方式,只需一根USB线,就可以达到供电、联网、调试(ssh)、文件传输(smb/nfs/scp)的目的,并且配置操作也不复杂。下面就简介一下如何配置D1s为RNDIS Gadget。
      ItwmlV.png

      M 1 Reply Last reply Reply Quote Share 1
      • SdtEE
        SdtEE LV 4 last edited by

        首先是配置内核以支持RNDIS Gadget。首先用晕哥的这贴 简单修改 哪吒d1 tina sdk 的 sys_config.fex 和 board.dts,让D1s先把Linux跑起来 来使D1的tina SDK支持D1s。然后参考这篇文档,make kernel_menuconfig之后勾选USB Gadget Support下的RNDIS一项。之后make和pack产生新的镜像并烧写到卡。现在这个镜像上的内核已经支持RNDIS Gadget了。
        然后参考我以前写的一贴 全志平台上通过configfs(libcomposite)配置RNDIS Gadget(u_ether)及Windows下的驱动 来在configFS中启用RNDIS。在D1s上这个教程有一些地方需要灵活处理一下,首先是/sys/kernel/config/usb_gadget下已经有设备g1了,不用新建,然后g1/configs/下也有了一个配置,我这里是c.1,所以也不用新建。之后创建软链接也是链接到configs/c.1/下。
        之后是配置网络。上面链接的教程提供了通过修改/etc/network/interfaces来配置的方法,如果生成D1s镜像时把根分区设置成了squashFS,/etc/就变成了只读的,没法更改。另一种方式是直接通过命令配置:

        ifconfig usb0 up
        ifconfig usb0 192.168.137.2 netmask 255.255.255.0
        route add default gw 192.168.137.1
        

        这时电脑应该能识别出一个没有Internet访问的网络。把电脑的那个网络的IP设置为192.168.137.1就可以和板子实现局域网互联了。
        通过将电脑的互联网共享给板子,还可以使板子联通外网。这个操作在各个系统下不一样,Windows下的操作很容易查到,这里就不赘述了。

        1 Reply Last reply Reply Quote Share 0
        • M
          Maihuanyi LV 5 @SdtEE last edited by

          @sdtee 使用虚拟网卡传输文件会死机,你有遇到过吗

          root@TinaLinux:/# random: sshd: uninitialized urandom read (32 bytes read)
          random: sshd: uninitialized urandom read (32 bytes read)
          random: sftp-server: uninitialized urandom read (32 bytes read)
          random: sshd: uninitialized urandom read (32 bytes read)
          random: sshd: uninitialized urandom read (32 bytes read)
          ------------[ cut here ]------------
          kernel BUG at mm/slub.c:3995!
          Kernel BUG [#1]
          Modules linked in: pwrdngpio(O) djibatgpio(O) gpioled(O) e34gpio(O) btgpio(O) gpiokey(O) beep(O) ch341 usbserial usb_storage
          CPU: 0 PID: 0 Comm: swapper Tainted: G           O      5.4.61 #245
          sepc: ffffffe0000a38b0 ra : ffffffe0000a3880 sp : ffffffe00056b9f0
           gp : ffffffe0005c7f98 tp : ffffffe000570670 t0 : 6d99feea10b6aaa5
           t1 : 2d4da631d6d0e31f t2 : 659139479badf51b s0 : ffffffe00056ba40
           s1 : ffffffe003fc1dc0 a0 : ffffffe003fc1dc0 a1 : 0000000000000000
           a2 : 0000000000000074 a3 : ffffffe002e882bc a4 : 0000000000000000
           a5 : 0000000000000000 a6 : 4b74ffab150d1112 a7 : 7eb4787c647c9008
           s2 : ffffffe0005a8728 s3 : 0000000000000000 s4 : ffffffe002e88042
           s5 : ffffffe001b60590 s6 : 000000000000007a s7 : 0000000000000200
           s8 : 0000000000000001 s9 : ffffffd004056004 s10: 000000000000007a
           s11: 000000000000007a t3 : e453c24597201865 t4 : 05bf9ed9991e8f30
           t5 : 8b36fe4c753b25db t6 : ffffffe001b522bc
          sstatus: 0000000200000100 sbadaddr: 0000000000000000 scause: 0000000000000003
          ---[ end trace 0e4c88a1db2c99aa ]---
          Kernel panic - not syncing: Fatal exception in interrupt
          ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
          
          whycan L 2 Replies Last reply Reply Quote Share 0
          • whycan
            whycan晕哥 LV 9 @Maihuanyi last edited by

            @maihuanyi 在 通过USB共享使D1s上的tina联网(RNDIS Gadget) 中说:

            kernel BUG at mm/slub.c:3995!

            sys_config.fex 里面把cpu和dram的频率都降到1/4试一试?

            M 1 Reply Last reply Reply Quote Share 0
            • M
              Maihuanyi LV 5 @whycan last edited by

              @whycan sys_config.fex里面没有修改cpu的频率

              ;----------------------------------------------------------------------------------
              ;storage_type   = boot medium, 0-nand, 1-sd, 2-emmc, 3-nor, 4-emmc3, 5-spinand -1(defualt)auto scan
              ;----------------------------------------------------------------------------------
              [target]
              boot_clock      = 1008
              storage_type    = 1
              
              ;*****************************************************************************
              ;sdram configuration
              ;
              ;*****************************************************************************
              [dram_para]
              dram_clk            = 528                                                                                                                                                   
              dram_type           = 2
              dram_zq             = 0x07b7bf9
              dram_odt_en         = 0x00
              dram_para1          = 0x000000d2
              dram_para2          = 0x00000000
              dram_mr0            = 0x00000E73
              dram_mr1            = 0x02
              

              难道是dram_clk、boot_clock???
              我改了没有效果...

              whycan 1 Reply Last reply Reply Quote Share 0
              • whycan
                whycan晕哥 LV 9 @Maihuanyi last edited by

                @maihuanyi
                对,上面就是cpu和dram

                M 2 Replies Last reply Reply Quote Share 0
                • M
                  Maihuanyi LV 5 @whycan last edited by

                  @whycan 改了/4还是不行

                  1 Reply Last reply Reply Quote Share 0
                  • Y
                    yesrpg227 LV 3 last edited by

                    学习. 在V851s上试试.

                    1 Reply Last reply Reply Quote Share 0
                    • L
                      lvjun0728 LV 5 @Maihuanyi last edited by

                      @maihuanyi 这个我这边测试t113也是这个问题,ping可以通,使用ssh连接内核崩溃,后面我换了ncm方式,就没有这个问题了。

                      Q 1 Reply Last reply Reply Quote Share 0
                      • M
                        Maihuanyi LV 5 @whycan last edited by

                        @whycan 5421309c-90e9-46b5-af37-a4c9170808d7-image.png
                        定位问题是内存这里报错,不知道怎么解决

                        Q 1 Reply Last reply Reply Quote Share 0
                        • Q
                          qqqlb LV 6 @Maihuanyi last edited by

                          @maihuanyi udc dma(sunxi_udc.c)相关的有bug,问问供应商或者论坛大佬要要补丁。

                          1 Reply Last reply Reply Quote Share 0
                          • Q
                            qqqlb LV 6 @lvjun0728 last edited by

                            @lvjun0728 你好,你在t113上使用的ncm方式的操作方法能分享一下吗

                            1 Reply Last reply Reply Quote Share 0
                            • 1 / 1
                            • First post
                              Last post

                            Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                            行为准则 | 用户协议 | 隐私权政策