您尚未登录。

#4 Re: 全志 SOC » 求教荔枝派nano的F1C100s的GPIO在驱动端一般的操作方法 » 2020-01-10 10:37:38

感谢晕哥,请问PG0 =  6*32+0 = 192 是怎么来的?是每个GPIO组默认都是32个吗,例如PA0 = 1, PB0 = 32?跟datasheet里面的pin num是同一个东西吗,为什么貌似对不上呢?
gpio.jpg

#5 全志 SOC » 求教荔枝派nano的F1C100s的GPIO在驱动端一般的操作方法 » 2020-01-10 09:50:41

wenfengtou
回复: 7

想问下大家在驱动端是怎么操作GPIO的(不是直接在用户空间操作sys/class的方法),例如让特定GPIO输出高低电平。在dts里面看到大多数是使用
pinctrl的方法,例如spi,串口等,但是貌似都没有让gpio设置高低电平的方法,不知道要怎么配置dts才能完成高低电平的配置。

spi0_pins_a: spi0-pins-pc {
	pins = "PC0", "PC1", "PC2", "PC3";
	function = "spi0";
};

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pins_a>;
	status = "okay";
	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "winbond,xt25f128b", "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;
	  };

};

或者说有什么推荐的操作GPIO的方法或者资料网站?诚意求教,因为看到网上很多都是其他平台的或者太久了,对于新手来说无法操作,所以才来求助的。

#7 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 17:05:07

多谢各位大神指导,现在总结一下我这边荔枝派nano ,kernel版本4.14出现udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers问题解决:
1.按照89楼进行配置
2.buildroot配置adbd
3.按照97楼修改usb开机启动报错问题
4.按照99楼配置dts的PE2的gpio电平为GPIO_ACTIVE_LOW

#8 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 09:13:51

参照链接 https://whycan.cn/t_1672.html#p22720

Michael 说:

设备树文件里有个PE2的gpio电平设置,补丁里面设置的是active high为device模式,改为low就是host模式

usblow.jpg

这里默认是GPIO_ACTIVE_HIGH,改成GPIO_ACTIVE_LOW才能识别到usb adb。但GPIO_ACTIVE_LOW是host模式,不太理解为什么adb要用host模式

#9 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 08:32:35

99楼最后一个图发错了,adb可以正常连接了。但为什么是配置usb为host模式呢?不是应该是device模式吗

#10 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 01:54:37

adb要配置usb为host模式还是device模式呢?参照链接 https://whycan.cn/t_1672.html#p22720 进行修改

Michael 说:

设备树文件里有个PE2的gpio电平设置,补丁里面设置的是active high为device模式,改为low就是host模式

电脑可以识别出一个叫做USB Function的设备,不知道是否正常?
FluxBB bbcode 测试

而这个USB Function设备居然可以用adb连接了。这算是正常的了吗?按照理解adb不是应该属于usb device模式吗???
FluxBB bbcode 测试

#11 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 01:18:13

按照红白机大神的做法,修改drivers/usb/musb/sunxi.c:742行后,启动adbd看上去是正常了,但是电脑一点反应都没有,识别不到adb设备

# adbd
install_listener('tcp:5037','*sm[  409.934107] read descriptors
artsocket*')
[  409.938587] read strings
[  409.942409] g_ffs gadget: g_ffs ready

#12 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-06 00:20:13

U-Boot SPL 2018.01-05681-g4898b8a (Jan 05 2020 - 11:56:03)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI


U-Boot 2018.01-05681-g4898b8a (Jan 05 2020 - 11:56:03 +0800) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
SF: Detected xt25f128b with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
SF: Detected xt25f128b with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x70000, size 0x10000
SF: 65536 bytes @ 0x70000 Read: OK
device 0 offset 0x80000, size 0x400000
SF: 4194304 bytes @ 0x80000 Read: OK
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 816fb000, end 816ffef3 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.0-licheepi-nano+ (liwenfeng@liwenfeng-VirtualBox) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #10 Sun Jan 5 15:00:54 CST 2020
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=squashfs
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22672K/32768K available (6144K kernel code, 210K rwdata, 1392K rodata, 1024K init, 251K bss, 10096K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0700000   (7136 kB)
[    0.000000]       .init : 0xc0900000 - 0xc0a00000   (1024 kB)
[    0.000000]       .data : 0xc0a00000 - 0xc0a348c0   ( 211 kB)
[    0.000000]        .bss : 0xc0a39d98 - 0xc0a78ab4   ( 252 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000043] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000108] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000619] Console: colour dummy device 80x30
[    0.001546] console [tty0] enabled
[    0.001640] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070274] pid_max: default: 32768 minimum: 301
[    0.070645] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070741] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072178] CPU: Testing write buffer coherency: ok
[    0.073868] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076376] devtmpfs: initialized
[    0.082622] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082789] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083100] pinctrl core: initialized pinctrl subsystem
[    0.084992] random: get_random_u32 called from bucket_table_alloc+0x80/0x1a4 with crng_init=0
[    0.085322] NET: Registered protocol family 16
[    0.086640] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088468] cpuidle: using governor menu
[    0.110829] SCSI subsystem initialized
[    0.111235] usbcore: registered new interface driver usbfs
[    0.111449] usbcore: registered new interface driver hub
[    0.111699] usbcore: registered new device driver usb
[    0.112202] pps_core: LinuxPPS API ver. 1 registered
[    0.112287] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.112416] PTP clock support registered
[    0.112904] Advanced Linux Sound Architecture Driver Initialized.
[    0.113823] random: fast init done
[    0.115897] clocksource: Switched to clocksource timer
[    0.141748] NET: Registered protocol family 2
[    0.143212] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.143361] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.143449] TCP: Hash tables configured (established 1024 bind 1024)
[    0.143747] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.143850] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.144323] NET: Registered protocol family 1
[    0.145365] RPC: Registered named UNIX socket transport module.
[    0.145471] RPC: Registered udp transport module.
[    0.145520] RPC: Registered tcp transport module.
[    0.145563] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.146701] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.148487] Initialise system trusted keyrings
[    0.149112] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.163753] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.166187] NFS: Registering the id_resolver key type
[    0.166354] Key type id_resolver registered
[    0.166412] Key type id_legacy registered
[    0.166565] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.180394] Key type asymmetric registered
[    0.180503] Asymmetric key parser 'x509' registered
[    0.180745] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.180841] io scheduler noop registered
[    0.180890] io scheduler deadline registered
[    0.181666] io scheduler cfq registered (default)
[    0.181764] io scheduler mq-deadline registered
[    0.181819] io scheduler kyber registered
[    0.182876] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.192322] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.359746] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.386586] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 22, base_baud = 6250000) is a 16550A
[    0.880554] console [ttyS0] enabled
[    0.889645] SCSI Media Changer driver v0.25 
[    0.897325] m25p80 spi0.0: xt25f128b (16384 Kbytes)
[    0.902356] 5 ofpart partitions found on MTD device spi0.0
[    0.907988] Creating 5 MTD partitions on "spi0.0":
[    0.912842] 0x000000000000-0x000000070000 : "u-boot"
[    0.920504] 0x000000070000-0x000000080000 : "dtb"
[    0.927847] 0x000000080000-0x000000480000 : "kernel"
[    0.935247] 0x000000480000-0x000000c00000 : "rootfs"
[    0.942814] 0x000000c00000-0x000001000000 : "overlayfs"
[    0.951114] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.957847] ehci-platform: EHCI generic platform driver
[    0.963389] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.969803] ohci-platform: OHCI generic platform driver
[    0.975459] usbcore: registered new interface driver usb-storage
[    0.982467] i2c /dev entries driver
[    1.046023] sunxi-mmc 1c0f000.mmc: base:0xc28ae000 irq:18
[    1.053443] usbcore: registered new interface driver usbhid
[    1.059216] usbhid: USB HID core driver
[    1.080557] NET: Registered protocol family 17
[    1.085317] Key type dns_resolver registered
[    1.091898] Loading compiled-in X.509 certificates
[    1.106172] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[    1.117956] ------------[ cut here ]------------
[    1.122731] WARNING: CPU: 0 PID: 3 at drivers/usb/musb/sunxi.c:411 sunxi_musb_ep_offset+0x3c/0x54
[    1.131768] sunxi_musb_ep_offset called with non 0 offset
[    1.137270] Modules linked in:
[    1.140384] CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.14.0-licheepi-nano+ #10
[    1.147949] Hardware name: Allwinner suniv Family
[    1.152720] Workqueue: events deferred_probe_work_func
[    1.158029] [<c010e50c>] (unwind_backtrace) from [<c010b68c>] (show_stack+0x10/0x14)
[    1.165862] [<c010b68c>] (show_stack) from [<c011666c>] (__warn+0xd4/0xfc)
[    1.172864] [<c011666c>] (__warn) from [<c01166cc>] (warn_slowpath_fmt+0x38/0x48)
[    1.180498] [<c01166cc>] (warn_slowpath_fmt) from [<c0482ce8>] (sunxi_musb_ep_offset+0x3c/0x54)
[    1.189348] [<c0482ce8>] (sunxi_musb_ep_offset) from [<c04767f4>] (ep_config_from_hw+0xc4/0x158)
[    1.198280] [<c04767f4>] (ep_config_from_hw) from [<c0478468>] (musb_probe+0x8dc/0xbec)
[    1.206439] [<c0478468>] (musb_probe) from [<c03feb80>] (platform_drv_probe+0x50/0xac)
[    1.214442] [<c03feb80>] (platform_drv_probe) from [<c03fd398>] (driver_probe_device+0x234/0x2f0)
[    1.223443] [<c03fd398>] (driver_probe_device) from [<c03fb9b8>] (bus_for_each_drv+0x48/0x94)
[    1.232097] [<c03fb9b8>] (bus_for_each_drv) from [<c03fd080>] (__device_attach+0xac/0x114)
[    1.240487] [<c03fd080>] (__device_attach) from [<c03fc68c>] (bus_probe_device+0x84/0x8c)
[    1.248785] [<c03fc68c>] (bus_probe_device) from [<c03fab14>] (device_add+0x370/0x58c)
[    1.256827] [<c03fab14>] (device_add) from [<c03fe998>] (platform_device_add+0x100/0x218)
[    1.265085] [<c03fe998>] (platform_device_add) from [<c03ff368>] (platform_device_register_full+0xec/0x100)
[    1.274979] [<c03ff368>] (platform_device_register_full) from [<c0482944>] (sunxi_musb_probe+0x244/0x408)
[    1.284704] [<c0482944>] (sunxi_musb_probe) from [<c03feb80>] (platform_drv_probe+0x50/0xac)
[    1.293286] [<c03feb80>] (platform_drv_probe) from [<c03fd398>] (driver_probe_device+0x234/0x2f0)
[    1.302284] [<c03fd398>] (driver_probe_device) from [<c03fb9b8>] (bus_for_each_drv+0x48/0x94)
[    1.310931] [<c03fb9b8>] (bus_for_each_drv) from [<c03fd080>] (__device_attach+0xac/0x114)
[    1.319312] [<c03fd080>] (__device_attach) from [<c03fc68c>] (bus_probe_device+0x84/0x8c)
[    1.327614] [<c03fc68c>] (bus_probe_device) from [<c03fcac8>] (deferred_probe_work_func+0x48/0x140)
[    1.336799] [<c03fcac8>] (deferred_probe_work_func) from [<c0129a7c>] (process_one_work+0x1d8/0x3ec)
[    1.346071] [<c0129a7c>] (process_one_work) from [<c0129f2c>] (worker_thread+0x29c/0x5b8)
[    1.354331] [<c0129f2c>] (worker_thread) from [<c012efc8>] (kthread+0x120/0x138)
[    1.361870] [<c012efc8>] (kthread) from [<c0107da8>] (ret_from_fork+0x14/0x2c)
[    1.369199] ---[ end trace 2897f0f1d9259ee2 ]---
[    1.373871] musb-sunxi 1c13000.usb: Error unknown readb offset 128
[    1.380243] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
[    1.388181] musb-hdrc: probe of musb-hdrc.1.auto failed with error -22
[    1.395661] ALSA device list:
[    1.398870]   #0: Loopback 1
[    1.409490] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.421025] devtmpfs: mounted
[    1.428604] Freeing unused kernel memory: 1024K
[    1.667697] random: crng init done
Starting syslogd: OK
Starting klogd: OK
read-only file system detected...done
Starting network: OK

Welcome to Buildroot

大佬 这是我启动的日志,帮忙看看是否有问题?

#13 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 14:48:01

二楼的配置文件加7楼的脚本还是报一样的错,udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers

#14 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 14:45:08

神奇了,使用二楼的内核配置文件也报一样的错

#15 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 14:04:48

checkout 说:

这几个选项https://whycan.cn/files/members/1237/usb.jpg

大佬,可以发下.config文件给我看看吗?我们的内核版本是一样的

#17 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 13:46:00

FluxBB bbcode 测试

是按照这样子配置了,但是还是一样的报错

#18 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 13:00:10

FluxBB bbcode 测试
如上图,lsmod第一次看的时候是空的,后面执行modprobe g_ffs idVendor=0x18d1 idProduct=0x4e42后,出现三个module
g_ffs                  16384  0
usb_f_fs               32768  2 g_ffs
libcomposite           40960  2 g_ffs,usb_f_fs
这样是正常的吗?最后报错[   55.895723] udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers

#19 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 12:49:00

50楼,我应该没有装两个garget呀,怎么看有没有装两个?

#20 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 11:48:41

checkout 说:

参考50楼


51楼那个依赖是指什么?

adbd &
[1]-  Terminated                 adbd
# install_listener[   99.342029] read descriptors
('tcp:5037','*sm[   99.345182] read strings
artsocket*')
[   99.349252] udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers

#21 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-05 11:47:59

win32prog 说:

看下用的是不是 micro usb线, usb id 有没有上拉/下拉.

是用的micro usb线,怎么看usb id有没有上下拉?

#22 Re: 全志 SOC » 分享个licheepi nano镜像,支持adb调试 » 2020-01-03 19:28:07

FluxBB bbcode 测试

你好,我这样配置有问题吗?启动adbd的时候报错

adbd &
[1]-  Terminated                 adbd
# install_listener[   99.342029] read descriptors
('tcp:5037','*sm[   99.345182] read strings
artsocket*')
[   99.349252] udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers

#24 Re: 全志 SOC » 荔枝派Nano连接usb提示“USB 设备描述符失败” » 2020-01-01 11:05:30

什么手机牌子的原装线比较好?这种micro usb线现在手机都很少用了,得上网买一条

#25 全志 SOC » 荔枝派Nano连接usb提示“USB 设备描述符失败” » 2020-01-01 10:27:20

wenfengtou
回复: 6

短接 1 4接,上电后提示“USB 设备描述符失败”
之前windows下装成功了驱动,并且烧录成功过一次,但后面想刷第二次就出现这个错误了。
usb
con

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn