zoukankan      html  css  js  c++  java
  • Beaglebone环境建立:电源适配器供电+网线ssh

      最近我在Beaglebone Black上做LCD移植,搞了几天LCD背光就是不亮。今天突然发现LCD的电源引脚没有电压。

      转接板对LCD供电使用VDD_5V引脚,这个引脚的电流是通过电源适配器直接供电,之前Beaglebone是用USB连接到电脑的,所以这种情况下VDD_5V引脚没有电流。

      我打算用电源适配器供电+网线SSH控制这一种模式进行开发,主要步骤如下。

      在/etc/init.d中新建set_up_eth0文件,文件内容如下:

    #!/bin/sh
    # This file use to config eth0
    
    # Shut down usb0
    ifconfig usb0 down
    
    # Set eth0
    ifconfig eth0 192.168.7.3 netmask 255.255.255.0 dstaddr 192.168.7.1
    
    echo Eth0 set up
    # End

      建立自启动链接如下:

    root@beaglebone# ln -s /etc/init.d/set_up_eth0 /etc/rc5.d/S07set_up_eth0

      完毕后重启开发板,更改PC的IP地址后,就可以通过网线建立SSH连接了。



    PS:

      1. 我第一个想到的方法是Adapter+USB一同连接到Beaglebone上面,但是没有选择这个方法。原因之一是,我曾经买过一个BB Black坏了(我肯定是电源芯片坏了,但返厂后厂家检测报告是CPU烧毁,我完全不知道正常的使用怎么能把CPU烧毁-_-#),那个板子我曾短时间两个接口同时供电。原因之二是,我查了BB Black的电源芯片手册,没有提及Adapter和USB能否同时供电。

      2. 在/etc/network/interfaces这个文件中存有IP配置的信息,按照这个文件的功能,我将其修改如下:

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    # When use eth0, you must down usb0, i don't known why
    auto eth0
    iface eth0 inet static
        address 192.168.7.3
        netmask 255.255.255.0
        network 192.168.7.0
        gateway 192.168.7.1
    
    # Example to keep MAC address between reboots
    #hwaddress ether DE:AD:BE:EF:CA:FE
    
    # WiFi Example
    #auto wlan0
    #iface wlan0 inet dhcp
    #    wpa-ssid "essid"
    #    wpa-psk  "password"
    
    # Ethernet/RNDIS gadget (g_ether)
    # ... or on host side, usbnet and random hwaddr
    # Note on some boards, usb0 is automaticly setup with an init script
    # in that case, to completely disable remove file [run_boot-scripts] from the boot partition
    # iface usb0 inet static
    #    address 192.168.7.2
    #    netmask 255.255.255.0
    #    network 192.168.7.0
    #    gateway 192.168.7.1

      但是修改完毕重启板子后,输入ifconfig查看到eth0和usb0的信息没有变化。注意到/etc/network/interfaces中有一句话“Note on some boards, usb0 is automaticly setup with an init script”,这句话意味着即使更改了这个文件,usb0还会按照以往一样被建立,而usb0的存在也会导致eth0连接失败(我不知道为什么),所以最后采用在系统初始化的时候利用sh来配置eth0信息。

      3. 至于为什么放在/etc/rc5.d/目录中,可以参考这篇文章《linux的运行模式:runlevel》。输入#runlevel 命令后查看到当前运行模式为5。

  • 相关阅读:
    (十一)设置关闭多核cpu的核
    (十)修改开发板主频
    (九)How to use the audio gadget driver
    (8)全志A64查看寄存器
    内存溢出问题配置
    百度数据库优化经验
    如何让sql运行的更快
    百度性能优化
    spring ioc原理
    JNDI
  • 原文地址:https://www.cnblogs.com/Si-Mao/p/3780804.html
Copyright © 2011-2022 走看看