频道栏目
首页 > 资讯 > 其他 > 正文

树莓派3的调试串口问题的不完美解决:让蓝牙与调试共存

16-09-09        来源:[db:作者]  
收藏   我要投稿

问题

因为RaspberryPi3的BT与Debug串口共用,导致同一时间只能有一个可以使用,尽管也可以使用软的UART1来控制BT,但是这样子的话需要将CPU的频率固定.

而我们在实际开发中,在mount rootfs之前. 是需要用debug串口来查看kernel启动情况,是否有mount rootfs

解决方案

发现可以使用下面这两种方式来解决

USB UART console

Network console

但是最终觉得还是使用USB UART console比较方便. 代价是需要买两根USB转串口线.

 

使用方法

硬件

直接将两根USB UART的DB9接口的2,3,5用杜邦线连起来, 2与3需要交叉.

软件方面

内核的支持

直接选中配置即可,同时依赖USB Serial驱动

下面是说明

 

同时选中自己的USB转串口的芯片支持,例如ch341, cp2102

 

 

userspace的配置

在内核中选中了,我们还需要配置userspace的console参数

 

8250.nr_uarts=0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2709.boardrev=0xa02082 bcm2709.serial=0x20d22efd smsc95xx.macaddr=B8:27:EB:D2:2E:FD bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 debug rootwait console=ttyUSB0,115200 root=/dev/nfs nfsroot=192.168.2.100:/home/hexiongjun/nfs/rpi3_qt ip=dhcp rootfstype=nfs smsc95xx.turbo_mode=N consoleblank=0

注意里面的console=参数

 

同时还需要配置agatty

在/etc/inittab中注意配置:

 

l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
USB0:12345:respawn:/bin/start_getty 115200 ttyUSB0
# /sbin/getty invocations for the runlevels.
#

至此就可以使用了,然后我们可以看到启动的log了,也可以在串口进行交互了

 

 

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.17 (hexiongjun@hexiongjun-9020) (gcc version 5.3.0 (GCC) ) #2 SMP Thu Aug 25 19:14:07 CST 2016
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x2e400000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 192512
[    0.000000] free_area_init_node: node 0, pgdat 80a29080, node_mem_map add64000
[    0.000000]   Normal zone: 1692 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 192512 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (9520->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 13 pages/cpu @aefaa000 s22540 r8192 d22516 u53248
[    0.000000] pcpu-alloc: s22540 r8192 d22516 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 190820
[    0.000000] Kernel command line: 8250.nr_uarts=0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2709.boardrev=0xa02082 bcm2709.serial=0x20d22efd smsc95xx.macaddr=B8:27:EB:D2:2E:FD bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 debug rootwait console=ttyUSB0,115200 root=/dev/nfs nfsroot=192.168.2.100:/home/hexiongjun/nfs/rpi3_qt ip=dhcp rootfstype=nfs smsc95xx.turbo_mode=N consoleblank=0
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 742756K/770048K available (6904K kernel code, 465K rwdata, 2548K rodata, 488K init, 774K bss, 19100K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xaf800000 - 0xff800000   (1280 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xaf000000   ( 752 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x809433e4   (9453 kB)
[    0.000000]       .init : 0x80944000 - 0x809be000   ( 488 kB)
[    0.000000]       .data : 0x809be000 - 0x80a32408   ( 466 kB)
[    0.000000]        .bss : 0x80a35000 - 0x80af68d4   ( 775 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000008] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000025] Switching to timer-based delay loop, resolution 52ns
[    0.000278] Console: colour dummy device 80x30
[    0.000308] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000328] pid_max: default: 32768 minimum: 301
[    0.000626] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000641] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001565] Disabling cpuset control group subsystem
[    0.001596] Initializing cgroup subsys io
[    0.001625] Initializing cgroup subsys memory
[    0.001662] Initializing cgroup subsys devices
[    0.001680] Initializing cgroup subsys freezer
[    0.001699] Initializing cgroup subsys net_cls
[    0.001742] CPU: Testing write buffer coherency: ok
[    0.001803] ftrace: allocating 23123 entries in 68 pages
[    0.057457] CPU0: update cpu_capacity 1024
[    0.057488] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.057501] [bcm2709_smp_prepare_cpus] enter
[    0.057638] Setting up static identity map for 0x8240 - 0x8274
[    0.059268] [bcm2709_boot_secondary] cpu:1 started (0) 18
[    0.059505] [bcm2709_secondary_init] enter cpu:1
[    0.059549] CPU1: update cp[    3.254223] usb 1-1.4: new full-speed USB device number 5 using dwc_otg
[    3.365909] usb 1-1.4: New USB device found, idVendor=248a, idProduct=8566
[    3.365928] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.365944] usb 1-1.4: Product: Wireless Receiver
[    3.365959] usb 1-1.4: Manufacturer: Telink
[    3.374651] input: Telink Wireless Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:248A:8566.0001/input/input0
[    3.435145] hid-generic 0003:248A:8566.0001: input,hidraw0: USB HID v1.11 Keyboard [Telink Wireless Receiver] on usb-3f980000.usb-1.4/input0
[    3.444454] input: Telink Wireless Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:248A:8566.0002/input/input1
[    3.504669] hid-generic 0003:248A:8566.0002: input,hidraw1: USB HID v1.11 Mouse [Telink Wireless Receiver] on usb-3f980000.usb-1.4/input1
[    3.584236] usb 1-1.5: new low-speed USB device number 6 using dwc_otg
[    3.713088] usb 1-1.5: New USB device found, idVendor=03f0, idProduct=0324
[    3.713126] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.713141] usb 1-1.5: Product: HP Basic USB Keyboard
[    3.713157] usb 1-1.5: Manufacturer: Lite-On Technology Corp.
[    3.728780] input: Lite-On Technology Corp. HP Basic USB Keyboard as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:03F0:0324.0003/input/input2
[    3.784935] hid-generic 0003:03F0:0324.0003: input,hidraw2: USB HID v1.10 Keyboard [Lite-On Technology Corp. HP Basic USB Keyboard] on usb-3f980000.usb-1.5/input0
[    3.884515] random: nonblocking pool is initialized
[    5.978086] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[    6.004220] Sending DHCP requests ., OK
[    6.084216] IP-Config: Got DHCP answer from 192.168.2.1, my address is 192.168.2.58
[    6.084425] IP-Config: Complete:
[    6.084444]      device=eth0, hwaddr=b8:27:eb:d2:2e:fd, ipaddr=192.168.2.58, mask=255.255.255.0, gw=192.168.2.1
[    6.084457]      host=192.168.2.58, domain=, nis-domain=(none)
[    6.084470]      bootserver=192.168.2.1, rootserver=192.168.2.100, rootpath=
[    6.084481]      nameserver0=192.168.2.1
[    6.172885] VFS: Mounted root (nfs filesystem) readonly on device 0:16.
[    6.173465] devtmpfs: mounted
[    6.174318] Freeing unused kernel memory: 488K (80944000 - 809be000)
INIT: version 2.88 booting
Starting udev
udev: Not using udev cache because of changes detected in the following files:
udev:     /proc/version /proc/cmdline /proc/devices
udev:     lib/udev/rules.d/* etc/udev/rules.d/*
udev: The udev cache will be regenerated. To identify the detected changes,
udev: compare the cached sysconf at   /etc/udev/cache.data
udev: against the current sysconf at  /dev/shm/udev.cache
[    7.659066] udevd[138]: starting version 3.1.5
[    8.043498] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    8.059734] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    8.281759] usbcore: registered new interface driver brcmfmac
[    8.446359] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Dec 15 2015 18:10:45 version 7.45.41.23 (r606571) FWID 01-cc4eda9c
[    8.467391] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    8.664053] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    8.664125] cfg80211: World regulatory domain updated:
[    8.664141] cfg80211:  DFS Master region: unset
[    8.664151] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    8.664172] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    8.664255] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    8.664272] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    8.664289] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    8.664306] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    8.664323] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    8.664339] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    8.664355] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
Populating dev cache
Wed Sep  7 09:00:52 UTC 2016
INIT: Entering runlevel: 5
Configuring network interfaces... ifup skipped for nfsroot interface eth0
run-parts: /etc/network/if-pre-up.d/nfsroot: exit status 1
Starting system message bus: dbus.
Starting OpenBSD Secure Shell server: sshd
done.
Starting rpcbind daemon...[   11.333302] NET: Registered protocol family 10
done.
starting statd: done
相关TAG标签
上一篇:创业门徒:大学教授李泽湘如何孵化出了大疆等明星科技公司?
下一篇:植入百度地图(二)——实现定位及方向传感器
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站