Custom Kernel Fails to Find SD Card


17 posts
by tom.k.cook » Mon Jun 25, 2012 9:54 am
I'm trying to build a custom kernel with the RT-Preempt patch applied. Here's what I've done:

* git clone http://github.com/bootc/linux.git
* git checkout origin/rpi-3.2.20
* Downloaded and applied patch-3.2.20-rt32.patch
* Installed bootc's 3.2.21 kernel on my rpi and rebooted
* Copied rpi:/proc/config.gz to linux/.config
* make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- oldconfig

This only asked me about RT-related things, everything else is from bootc's 3.2.21 config.

* make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- bzImage modules
* make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=/tmp/modules modules_install
* Copied arch/arm/boot/zImage to rpi:/boot/kernel.img
* Copied /tmp/modules/* to rpi:/
* On the rpi: depmod 3.2.20-rt32+

But when I reboot with my kernel, it always gets stuck at the line:

[ 3.779202] Waiting for root device /dev/mmcblk0p2...

I assume this means that it can't find the SD card, in turn because the appropriate driver for it is either not in the kernel configuration or because the RT-Preempt patch breaks it.

It doesn't seem to be a problem with the card itself - I can put the card in a reader and swap the kernel image back to the stock 3.1.9 or bootc's 3.2.21 images and it all works again.

Can anyone point me to what I need in the kernel in order to get past this point in the boot? Or what might be breaking? I would attach my attempted .config if I could figure out a file extension that the forum allows.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by AndrewS » Mon Jun 25, 2012 1:06 pm
I guess the obvious thing to do would be to try building the rpi-3.2.20 kernel without applying the RT patch :?:

Couple of other tips:
- you can run depmod before plugging the SDcard into the pi by using the -b flag (which rpi-update uses in its "offline" mode)
- you can specify the kernel to load in /boot/config.txt which saves you renaming files back and forth
User avatar
Posts: 2193
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by tom.k.cook » Mon Jun 25, 2012 1:28 pm
Yes, I guess so. Colour me lazy. :o

Thanks for the tip on config.txt.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by tom.k.cook » Mon Jun 25, 2012 3:12 pm
Yes, bootc's rpi-3.2.20 tree boots fine. So somehow RT-Preempt breaks the SD card driver. Sigh.

Anyone got any tips on how to debug this sort of thing? Can I get a kdb session through the UART that early in a boot?
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by AndrewS » Mon Jun 25, 2012 4:33 pm
Okay, here's my next poking-in-the-dark suggestion ;)
Try compiling the kernel_emergency.img (embedded initramfs) with the 3.2.20 kernel with the RT-Preempt patch applied, as that should get you to a working Linux environment without needing to mount the SD card?

Or I guess the other option would be to host your rootfs on a USB drive rather than an SD card? As long as that doesn't suffer from the same problem, of course! :?
User avatar
Posts: 2193
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by tom.k.cook » Mon Jun 25, 2012 4:45 pm
Yes, someone on linux-rt-users suggested similar; put the root on an NFS share. I'll give it a go when I get back to my desk tomorrow.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by Brokentoaster » Thu Jun 28, 2012 6:39 pm
Any further progress on this?

I have compiled Chris Boot' s 3.2.16 kernel with rt patch 27 applied but I get a kernel panic should I enable any preemptive kernel options. The same kernel runs fine if the Preemption Model is set to No Forced Preemption (Server) or Voluntary Kernel Preemption (Desktop).

I'm assuming that as the BCM2708 specifics are not in the main line kernel the RT patch does not touch them. Unless anyone has any better ideas I will look at applying the RT changes to the mach-2708 files.

My kernel messages are as follows :

Code: Select all
Linux version 3.2.16-rt27+ (nick@garagelinux) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-70) ) #6 PREEMPT RT Thu Jun 28 18:32:57 BST 2012
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: BCM2708
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 48768
Kernel command line: dma.dmachans=0x3c bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=512 bcm2708.boardrev=0x2 bcm2708.serial=0x5fcda584 smsc95xx.macaddr=B8:27:EB:CD:A5:84 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 192MB = 192MB total
Memory: 189804k/189804k available, 6804k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xcc800000 - 0xd8000000   ( 184 MB)
    lowmem  : 0xc0000000 - 0xcc000000   ( 192 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0459000   (4420 kB)
      .init : 0xc0459000 - 0xc0478000   ( 124 kB)
      .data : 0xc0478000 - 0xc04992e0   ( 133 kB)
       .bss : 0xc0499304 - 0xc04e5fe4   ( 308 kB)
NR_IRQS:85
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
sched_clock: wrong multiply/shift: 2097152000>>21 vs calculated 4194304000>>22
sched_clock: fix multiply/shift to avoid scheduler hiccups
timer_set_mode: unhandled mode:1
timer_set_mode: unhandled mode:3
Console: colour dummy device 80x30
console [tty1] enabled
Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
vc-mem: mm_vc_mem_phys_addr = 0x00000000
vc-mem: mm_vc_mem_size      = 0x10000000 (256 MiB)
mailbox: Broadcom VideoCore Mailbox driver
bcm2708_vcio: mailbox at f200b880
bcm_power: Broadcom power driver
bcm_power_open() -> 0
bcm_power_request(0, 8)
bcm_mailbox_read -> 00000080, 0
bcm_power_request -> 0
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83) is a PL011 rev3
console [ttyAMA0] enabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource stc
FS-Cache: Loaded
CacheFiles: Loaded
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 5, 196608 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 128 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 128 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
bcm2708_dma: DMA manager at cc808000
bcm2708_gpio: bcm2708_gpio_probe c047de18
vc-mem: Videocore memory driver
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
FS-Cache: Netfs 'nfs' registered for caching
msgmni has been set to 370
io scheduler noop registered
io scheduler deadline registered (default)
io scheduler cfq registered
BCM2708FB: registering framebuffer (656x512@16)
bcm2708_fb_set_par info(cb8ef000) 656x512 (656x512), 0, 16
BCM2708FB: start = cc900000,4d385000 width=656, height=512, bpp=16, pitch=1312 size=671744 success=0
Console: switching to colour frame buffer device 82x32
BCM2708FB: register framebuffer (0)
brd: module loaded
loop: module loaded
vcos: [1]: vchiq_init_state: slot_zero = 0xffd80000, is_master = 0
vcos: [1]: vchiq_init_state: called
vcos: [1]: vchiq: initialised - version 2 (min 2), device 253.0
usbcore: registered new interface driver smsc95xx
cdc_ncm: 04-Aug-2011
usbcore: registered new interface driver cdc_ncm
dwc_otg: version 2.90b 6-MAY-2010 (platform bus)
Core Release: 2.80a
Setting default values for core params
Finished setting default values for core params
cc840008 -> 1
Using Buffer DMA mode
Periodic Transfer Interrupt Enhancement - disabled
Multiprocessor Interrupt Enhancement - disabled
Dedicated Tx FIFOs mode
dwc_otg bcm2708_usb: DWC OTG Controller
dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
dwc_otg bcm2708_usb: irq 75, io mem 0x00000000
Init: Port Power? op_state=1
Init: Power Port (0)
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: DWC OTG Controller
usb usb1: Manufacturer: Linux 3.2.16-rt27+ dwc_otg_hcd
usb usb1: SerialNumber: bcm2708_usb
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usbcore: registered new interface driver uas
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
mousedev: PS/2 mouse device common for all mice
cpuidle: using governor ladder
cpuidle: using governor menu
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
bcm_power_open() -> 1
Registered led device: mmc0::
mmc0: SDHCI controller on BCM2708_Arasan [platform] using platform's DMA
mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
sdhci-pltfm: SDHCI platform and OF driver helper
Registered led device: led0
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
------------[ cut here ]------------
Kernel BUG at c035fa78 [verbose debug info unavailable]
Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
Modules linked in:
CPU: 0    Not tainted  (3.2.16-rt27+ #6)
PC is at rt_spin_lock_slowlock+0x1f4/0x220
LR is at rt_spin_lock_slowlock+0x60/0x220
pc : [<c035fa78>]    lr : [<c035f8e4>]    psr: 60000113
sp : cba13ec0  ip : cba13ec0  fp : cba13f1c
r10: c0484074  r9 : c0058780  r8 : c047a0a4
r7 : cba11ba1  r6 : cba11ba0  r5 : cba12000  r4 : cb9f7320
r3 : 00000001  r2 : 00000000  r1 : cba11ba1  r0 : cba11ba0
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 00c5387d  Table: 00004008  DAC: 00000017
Process irq/77-bcm2708_ (pid: 34, stack limit = 0xcba12268)
Stack: (0xcba13ec0 to 0xcba14000)
3ec0: cba13eec cba13ed0 c001200c c0010c00 00000002 cba12000 00000001 cba12000
3ee0: cba13f14 cba13ef0 c0010c60 00000000 cba13f5c cba13f01 c001b544 cb9f7260
3f00: cb9f7320 00000006 00000000 c047a0a4 cba13f2c cba13f20 c035fc84 c035f890
3f20: cba13f54 cba13f30 c0299c1c c035fc80 c048401c cba12000 cb9fbb20 c048401c
3f40: c047a0a4 c0484074 cba13f74 cba13f58 c00587a8 c0299bb0 00000000 cb9fbb20
3f60: cba12000 00000001 cba13fac cba13f78 c005869c c005878c 00000013 c0484078
3f80: 00000000 cb82dd8c cb9fbb20 c005856c 00000013 00000000 00000000 00000000
3fa0: cba13ff4 cba13fb0 c003c36c c0058578 00000000 cb9fbb20 00000000 cba13fbc
3fc0: cba13fbc 00000000 c0024cc0 00000013 cba13fd0 cba13fd0 00000000 cb82dd8c
3fe0: c003c2e0 c0024cc0 00000000 cba13ff8 c0024cc0 c003c2ec 00000000 00000000
Backtrace: 
[<c035f884>] (rt_spin_lock_slowlock+0x0/0x220) from [<c035fc84>] (rt_spin_lock+0x10/0x14)
 r8:c047a0a4 r7:00000000 r6:00000006 r5:cb9f7320 r4:cb9f7260
[<c035fc74>] (rt_spin_lock+0x0/0x14) from [<c0299c1c>] (sdhci_bcm2708_dma_irq+0x78/0x2e4)
[<c0299ba4>] (sdhci_bcm2708_dma_irq+0x0/0x2e4) from [<c00587a8>] (irq_forced_thread_fn+0x28/0x60)
[<c0058780>] (irq_forced_thread_fn+0x0/0x60) from [<c005869c>] (irq_thread+0x130/0x1d4)
 r6:00000001 r5:cba12000 r4:cb9fbb20 r3:00000000
[<c005856c>] (irq_thread+0x0/0x1d4) from [<c003c36c>] (kthread+0x8c/0x94)
[<c003c2e0>] (kthread+0x0/0x94) from [<c0024cc0>] (do_exit+0x0/0x694)
 r6:c0024cc0 r5:c003c2e0 r4:cb82dd8c
Code: e3c3e001 e150000c e584e008 0afffff1 (e7f001f2) 
---[ end trace 0000000000000002 ]---
exiting task "irq/77-bcm2708_" (34) is an active IRQ thread (irq 77)
note: irq/77-bcm2708_[34] exited with preempt_count 1
usb 1-1: new high-speed USB device number 2 using dwc_otg
------------[ cut here ]------------
Kernel BUG at c035fa78 [verbose debug info unavailable]
Internal error: Oops - undefined instruction: 0 [#2] PREEMPT
Modules linked in:
CPU: 0    Tainted: G      D       (3.2.16-rt27+ #6)
PC is at rt_spin_lock_slowlock+0x1f4/0x220
LR is at rt_spin_lock_slowlock+0x60/0x220
pc : [<c035fa78>]    lr : [<c035f8e4>]    psr: 60000113
sp : cb889c30  ip : cb889c30  fp : cb889c8c
r10: cb9fce20  r9 : cb9e0838  r8 : cb9fb5e0
r7 : cb861141  r6 : cb861140  r5 : cb888000  r4 : cb9f68e0
r3 : 00000001  r2 : 00000000  r1 : cb861141  r0 : cb861140
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 00c5387d  Table: 00004008  DAC: 00000017
Process khubd (pid: 13, stack limit = 0xcb888268)
Stack: (0xcb889c30 to 0xcb88a000)
9c20:                                     c0010c60 c0011ff4 cb889c8c cb889c78
9c40: c001b544 c035f598 00000000 c001b544 cb889c74 cb889c60 c001b544 00000000
9c60: c0485294 cb9fb501 cb889c8c cb889cc0 cb9fce20 cb9fb660 cb9e0850 cb9fb5e0
9c80: cb889c9c cb889c90 c035fc84 c035f890 cb889cb4 cb889ca0 c0277000 c035fc80
9ca0: cb9fb660 cb9fce20 cb889cec cb889cb8 c0273b78 c0276ff8 cb8e77c0 cb9fce20
9cc0: cb889cec cb889cd0 cb9fb620 cb9fce20 cb9fb660 cb9e0850 cb8e77c0 cb9fce20
9ce0: cb889d14 cb889cf0 c0274140 c0273b60 00000000 00000000 cb9fce20 4b9e7460
9d00: cb9fb620 cb9e0850 cb889d44 cb889d18 c026f394 c027410c cb889d44 cb889d28
9d20: c024c0bc c035fc58 00000000 4b9e7460 cb9ff5e0 cb9fb660 cb889d9c cb889d48
9d40: c0270efc c026f338 00000040 cb9e7460 4b9e7460 00000001 00000000 c001430c
9d60: c001200c 00000000 00000000 cb9e0850 cb9e0838 cb9ff5e0 cb8e77c0 00000000
9d80: 00000010 cb9ff5e8 00000080 00000000 cb889dec cb889da0 c024d6a8 c0270d14
9da0: cb889dcc cb889db0 c001200c c0010c00 00000002 cb888000 00000001 cb8001e0
9dc0: cb889df4 00000040 cb889e24 00000000 00000000 cb889e7c 00000080 00000000
9de0: cb889e1c cb889df0 c024ee90 c024d5fc cb9ff5e0 cb9ff5e0 cb889e24 00000000
9e00: 00001388 cb889e7c 00000080 00000000 cb889e6c cb889e20 c0250124 c024edb0
9e20: c035fc5c 00000000 cb889e28 cb889e28 00000000 cb889e40 c024f20c cb889e3c
9e40: cb889e3c cb9ff5e0 cb889e6c cb9e7460 c024fbf4 00000040 00000000 00000100
9e60: cb889eac cb889e70 c02503a0 c02500e8 80000080 cb9e0800 c035fc5c c035f53c
9e80: cb889eac cb9e0800 cb9fb6a0 c04df7f8 00001388 00000002 00000000 cb97c400
9ea0: cb889f0c cb889eb0 c02488f0 c02502e4 00000100 00000000 cb9fb6a0 00000040
9ec0: 00001388 c001b4b8 00000001 c048f570 cb8e77c0 00000032 00000003 00000001
9ee0: cb889f0c cb9e0800 cb942800 cb8e77c0 cb97c400 cb8e77d8 00000002 00000000
9f00: cb889fac cb889f10 c024a83c c0248224 00000001 cb888000 00000001 cb888000
9f20: c0010c60 c0011ff4 cb889f94 cb97c620 cb8e77c0 00000008 00000000 cb97c430
9f40: cb97c620 cb942a38 cb94289c cb97c408 cb942800 cb942800 00000001 cb97c489
9f60: 00000000 cb861140 c003c9b4 cb889f6c cb889f6c c024a348 00000101 00000000
9f80: 00000000 cb82defc 00000000 c024a348 00000013 00000000 00000000 00000000
9fa0: cb889ff4 cb889fb0 c003c36c c024a354 00000000 00000000 00000000 cb889fbc
9fc0: cb889fbc 00000000 c0024cc0 00000013 cb889fd0 cb889fd0 00000000 cb82defc
9fe0: c003c2e0 c0024cc0 00000000 cb889ff8 c0024cc0 c003c2ec ffffffff ffffffff
Backtrace: 
[<c035f884>] (rt_spin_lock_slowlock+0x0/0x220) from [<c035fc84>] (rt_spin_lock+0x10/0x14)
 r8:cb9fb5e0 r7:cb9e0850 r6:cb9fb660 r5:cb9fce20 r4:cb889cc0
[<c035fc74>] (rt_spin_lock+0x0/0x14) from [<c0277000>] (DWC_SPINLOCK_IRQSAVE+0x14/0x24)
[<c0276fec>] (DWC_SPINLOCK_IRQSAVE+0x0/0x24) from [<c0273b78>] (dwc_otg_hcd_qh_add+0x24/0x2b0)
 r4:cb9fce20 r3:cb9fb660
[<c0273b54>] (dwc_otg_hcd_qh_add+0x0/0x2b0) from [<c0274140>] (dwc_otg_hcd_qtd_add+0x40/0xbc)
[<c0274100>] (dwc_otg_hcd_qtd_add+0x0/0xbc) from [<c026f394>] (dwc_otg_hcd_urb_enqueue+0x68/0x238)
 r7:cb9e0850 r6:cb9fb620 r5:4b9e7460 r4:cb9fce20
[<c026f32c>] (dwc_otg_hcd_urb_enqueue+0x0/0x238) from [<c0270efc>] (urb_enqueue+0x1f4/0x2d8)
 r7:cb9fb660 r6:cb9ff5e0 r5:4b9e7460 r4:00000000
[<c0270d08>] (urb_enqueue+0x0/0x2d8) from [<c024d6a8>] (usb_hcd_submit_urb+0xb8/0x6e0)
[<c024d5f0>] (usb_hcd_submit_urb+0x0/0x6e0) from [<c024ee90>] (usb_submit_urb+0xec/0x358)
[<c024eda4>] (usb_submit_urb+0x0/0x358) from [<c0250124>] (usb_start_wait_urb+0x48/0xcc)
[<c02500dc>] (usb_start_wait_urb+0x0/0xcc) from [<c02503a0>] (usb_control_msg+0xc8/0xec)
 r8:00000100 r7:00000000 r6:00000040 r5:c024fbf4 r4:cb9e7460
[<c02502d8>] (usb_control_msg+0x0/0xec) from [<c02488f0>] (hub_port_init+0x6d8/0xc94)
[<c0248218>] (hub_port_init+0x0/0xc94) from [<c024a83c>] (hub_thread+0x4f4/0x10b4)
[<c024a348>] (hub_thread+0x0/0x10b4) from [<c003c36c>] (kthread+0x8c/0x94)
[<c003c2e0>] (kthread+0x0/0x94) from [<c0024cc0>] (do_exit+0x0/0x694)
 r6:c0024cc0 r5:c003c2e0 r4:cb82defc
Code: e3c3e001 e150000c e584e008 0afffff1 (e7f001f2) 
---[ end trace 0000000000000003 ]---
note: khubd[13] exited with preempt_count 1
Waiting for root device /dev/mmcblk0p2...
Posts: 4
Joined: Wed Jun 27, 2012 9:24 pm
by tom.k.cook » Wed Jul 04, 2012 12:39 pm
Brokentoaster wrote:Any further progress on this?

I have compiled Chris Boot' s 3.2.16 kernel with rt patch 27 applied but I get a kernel panic should I enable any preemptive kernel options. The same kernel runs fine if the Preemption Model is set to No Forced Preemption (Server) or Voluntary Kernel Preemption (Desktop).

snip


Yes, that's the same kernel OOPS I get now with 3.2.21-rt33. The problem seems to be in the USB driver code and how it uses spinlocks to get exclusive access to something or other. I haven't looked into it far enough to figure out what exactly is going wrong.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by tom.k.cook » Wed Jul 04, 2012 3:27 pm
And a similar oops in the SD card driver. How did you get your kernel log - through the UART? Or something else?
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by Brokentoaster » Wed Jul 04, 2012 4:44 pm
I used the UART via a hacked Nokia USB cable I bought on eBay for $1.50 a couple of years ago. see http://www.uchobby.com/index.php/2009/10/04/diy-usb-to-serial-cable-for-3/ for more details.

I also compiled with CONFIG_KALLSYMS: Load all symbols for debugging/kksymoops
Posts: 4
Joined: Wed Jun 27, 2012 9:24 pm
by tom.k.cook » Wed Jul 04, 2012 5:10 pm
Hmmm. I can't see how the MMC SDHCI can cause that oops, but I'm not even sure mine's doing it as it scrolls off the screen. I'll have to get my UART sorted out tonight to see.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by tom.k.cook » Wed Jul 04, 2012 5:11 pm
Some more details on this - the oops seems to be caused by the SD card driver acquiring the same spinlock twice in the same IRQ handling thread. I'm not really sure how this could come about except if the IRQ handler preempted itself - but surely that's the point of using spin_lock_irqsave?
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by tom.k.cook » Wed Jul 04, 2012 6:27 pm
Brokentoaster wrote:I used the UART via a hacked Nokia USB cable I bought on eBay for $1.50 a couple of years ago. see http://www.uchobby.com/index.php/2009/10/04/diy-usb-to-serial-cable-for-3/ for more details.


AFAICT that uses 5V on the UART lines - it's based on the PL2303 which is the bog standard USB-to-Serial converter chip and that just uses the USB +5V for VSS. And all I can see of the RasPI documentation says that all lines on the GPIO header are not 5V tolerant.

So.

Does it work? Have you let the magic smoke out of your RasPI? Or am I missing something in the documentation?
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by Brokentoaster » Wed Jul 04, 2012 8:09 pm
The Nokia cable is actually based on 3.3V which is why the cable works well. The PL2303HX will allow 3.3V on the RS232 logic side (check the VDD_232 signal on pin 4, page 9 of data-sheet).

I was originally using a 5V based FTDI chip from my reprap printer, but only connecting the TX pin (on the RasPi) so no lines on the RasPi were being driven above 3.3V, and the 3.3V is enough for the FTDI to see a logic level '1'. I didn't really like this as it was one way only and not 100% reliable.

I originally bought the Nokia cable to use on the reprap but was not very reliable due to 5V-3.3V voltage level difference. I threw it in a drawer for a couple of years until I pulled it out the other day, confirming on the scope that it was 3.3V before plugging it in.

I'm not convinced its totally safe due to what happens when I remove power to the RasPi but leave the nokia cable connected. This will drive the RX pin on the RasPi high while no power is given to VCC on the RasPi. I could remove the nokia cable every time, but this either re-enumerates the /dev/ttyUSB on my debug machine to a new number (which is a pain), or runs a risk reconnecting it incorrectly to the raspi each time.

Hmmm I might have to solder on a reset pin to the RasPi to stop me removing the power every time I want to reboot after a crash.
Posts: 4
Joined: Wed Jun 27, 2012 9:24 pm
by dom » Wed Jul 04, 2012 8:26 pm
Brokentoaster wrote:I'm not convinced its totally safe due to what happens when I remove power to the RasPi but leave the nokia cable connected. This will drive the RX pin on the RasPi high while no power is given to VCC on the RasPi.


I have no idea if it's safe or not, but have used a similar UART connected to various 2835 chips over the last couple of years. Never even though about unplugging UART when powering off board. Not seen any ill effect from it.
Moderator
Moderator
Posts: 3861
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by tom.k.cook » Mon Jan 21, 2013 1:03 pm
After six months of getting distracted by other things, I've finally got a MAX3232CPE RS232 driver connected to the UART and a working serial console, and I've returned to attempting a PREEMPT_RT kernel. This time its a 3.6.11-rt25.

The MMC controller still seems to be a problem. The driver loads okay, but it can't (for some reason) find the root partition. The serial console shows this:

Code: Select all
[    1.968440] sdhci: Secure Digital Host Controller Interface driver
[    1.976573] sdhci: Copyright(c) Pierre Ossman
[    1.982947] sdhci: Enable low-latency mode
[    2.030125] mmc0: SDHCI controller on BCM2708_Arasan [platform] using platform's DMA
[    2.041937] mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
[    2.050030] sdhci-pltfm: SDHCI platform and OF driver helper


Which looks reasonably successful to me. But then a few lines down:

Code: Select all
[    2.190052] Waiting for root device /dev/mmcblk0p2...
[    2.319942] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.328770] Indeed it is in host mode hprt0 = 00001101
[    2.530539] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[    2.539411] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0


And that's where it stops. There's no indication that anything has gone wrong and I assume that it is just "waiting" for mmcblk0p2.

Any ideas on why this might happen?
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am
by tom.k.cook » Mon Jan 21, 2013 1:58 pm
And indeed comparing to a dmesg from a standard boot shows that it is not finding the MMC/SD card. The USB driver seems to be working in 3.6.11, so I'll try putting the root partition on a USB stick and see if that fares any better.
Posts: 39
Joined: Fri Jun 22, 2012 8:51 am