1、4G模块接入树莓派,查看设备是否在线

    image.png
    如果网口中有设备wwan0存在,说明设备驱动已经OK,开始配置忘了接入;
    2、再次检查确认硬件设备变化,是否4G模块启动没问题

    1. ifconfig

    运行结果如下:
    image.png
    若出现下方内容,说明设备运行正常

    adding VLAN 0 to HW filter on device wwan0

    3、添加配置
    What is libmbim安装libmbim: libmbim详细信息和命令可以参考 用此程序貌似可以很方便的获取很多硬件信息

    1. dmesg

    在/etc下新建拨号配置文件:

    1. sudo apt-get install libmbim-utils -y

    在配置文件中写入运营商APN,我用的是中国电信卡,经过测试只用填写一行APN信息即可:

    1. sudo vim /etc/mbim-network.conf
    1. APN="ctlte"

    连接网络命令

    1. sudo mbim-network /dev/cdc-wdm0 start

    之后会根据你的配置信息自动连接,出现successfully说明连接成功:
    树莓派使用华为ME909S 4G模块连接蜂窝网 - 图3
    连接成功后,差不多要等待一分钟,接口wwan0就会获得分配的IP地址:
    树莓派使用华为ME909S 4G模块连接蜂窝网 - 图4
    此时你的树莓派就可以愉快的上网了,wwan0也会自动加入路由表,不需要再手动配置。
    树莓派使用华为ME909S 4G模块连接蜂窝网 - 图5

    增加开机自启动
    1、创建启动脚本 simcom_wwan.sh

    1. #!/bin/bash
    2. sudo mbim-network /dev/cdc-wdm0 start

    2、给脚本赋予可执行权限

    1. chmod 777 simcom_wwan.sh

    3、创建rc.local ,增加开机启动

    1. sudo vim /etc/rc.local

    在exit 0 前面增加一行命令

    1. su pi -c "exec /home/pi/Program/simcom_wwan.sh"

    4、重启

    1. sudo reboot

    验证网络是否连接

    1. route -v

    image.png
    如上图所示,如果wwan0在路由列表中,则表明网络连接正常


    参考资料
    https://blog.csdn.net/weixin_43845201/article/details/96184090?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

    微雪电子
    https://www.waveshare.net/shop/SIM7600CE-4G-HAT.htm
    https://www.waveshare.net/study/article-929-1.html
    https://www.waveshare.net/study/article-962-1.html

    推荐
    https://www.waveshare.net/wiki/%E6%A0%91%E8%8E%93%E6%B4%BERNDIS%E6%8B%A8%E5%8F%B7%E4%B8%8A%E7%BD%91

    华为
    https://blog.csdn.net/weixin_43845201/article/details/96184090

    https://blog.csdn.net/weixin_43845201/article/details/96184090?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param