Raspberry 2 realtime kernel image

Hi,

I just got my Raspberry 2, do you have any news regarding a raspbian realtime image for it?

Sebastian,

We should get ours soon and will definitely make a RT kernel for it.

I thought I´ll learn something new and try to compile my own RT_PREEMPT kernel for my RPi2…
But then I found, that there is now patch available for the RPi2s 3.18 kernel. I am still looking for a solution, but I guess I just have to wait.

And the pigpio library is not available for Rpi2, too…

Currently it’s not easy to make an preempt_rt kernel due to the lack of rt-patch for 3.18 which is the lowest Linux version for RPi. But we hope that we will be able to solve that issue over time. Possible solutions:

  1. Backport support for RPi2 into 3.14 kernel (probably shouldn’t be that hard)
  2. Try to apply rt-patch-3.14 on 3.18 kernel (this one is tricky)
  3. Even if the first two options fail the rt-patch for 3.18 will come out eventually.

I’d like to ask Navio users not to rush changing the platform as it will take some time for us to support it:)

Great news! rt-patch for 3.18 has been released - LKML: Sebastian Andrzej Siewior: [ANNOUNCE] 3.18.7-rt1
That should speed up supporting Navio+RPi2 combo drastically. I’ll be posting updates on the progress.

The kernel for RPi2 has been built and works.

pi@raspberrypi:~$ uname -a
Linux raspberrypi 3.18.7-rt1-v7+ #1 SMP PREEMPT RT Fri Feb 20 19:12:28 MSK 2015 armv7l GNU/Linux

I will leave it for testing for all night and if it won’t crash will upload it.

2 Likes

Great news!

Nice going :slight_smile: Have you tested SPI yet? I seem to have everything working on a standard raspbian distribution but SPI. (I’m using a memory map for GPIO for now, very CPU intensive tho :s from the class here Raspberry/mmapGPIO at master · timknapen/Raspberry · GitHub). I2C works fine, can run the LED example and the Barometer one. But the MPU and the gps are just returning 0’s or failing the gps connection test.
I’ve enabled SPI in the kernel and added the “dtparam=spi=on” to /boot/config.txt. lsmod shows the spi_bcm2708 driver loaded and spidev0.0 and spidev0.1 are showing in /dev
Its not saying it’s failing to open the device just getting null data returned from the chips. (SPI still works on the old B+)

So I suppose the question is am I missing something (probably obvious) or do I have a potential hardware issue on the PI 2

Have the Raspberry 2 realtime kernel image been uploaded yet?

Not yet. Please give me some time to properly test everything. I’ll upload it in a day or two.

Patched and configured source code is in linux-rpi-rt repo on Github.
As well as instructions on how to compile it and install the new kernel.

SD image for usage with Navio and APM will be uploaded some time later together with APM port for RPi2.

1 Like

I’ve found some problems with the rt-kernel for RPi2 - cores get locked sometimes. The release is delayed until that issue is investigated and solved.

Ehi Mikhail
I’m trying the new kernel you uploaded (I also got a new RPI2 and I want to try it), but there are a lot of problems.
The following test are relative to the RPIB+ board, but note that the same results apply for the RPI2.

First of all, all the IMU measurements are wrong (in particular all of them are 0.0)… I suspect is some library related trouble… but I think is good to know :smile:

pi@raspberrypi ~/Navio/C++/Examples/AccelGyroMag $ ./AccelGyroMag
Acc: +0.000 +0.000 +0.000 Gyr: +0.000 +0.000 +0.000 Mag: +0.000 +0.000 +0.000

To get some idea of what is happening with the kernel you prepared you may take a look to these logs:

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.7-rt1+ #1 PREEMPT RT Sun Feb 22 17:59:58 MSK 2015 armv6l GNU/Linux

pi@raspberrypi ~ $ dmesg 
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.18.7-rt1+ (clouded@cl) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #1 PREEMPT RT Sun Feb 22 17:59:58 MSK 2015
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: BCM2708
[    0.000000] cma: Reserved 8 MiB at 0x1b800000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c082e730, node_mem_map db474000
[    0.000000]   Normal zone: 896 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 114688 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 113792
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0x10 bcm2708.serial=0x231a7de4 smsc95xx.macaddr=B8:27:EB:1A:7D:E4 bcm2708_fb.fbswap=1 bcm2708.disk_led_gpio=47 bcm2708.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  sdhci_bcm2708.enable_llm=0 dwc_otg.speed=1 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 437312K/458752K available (5749K kernel code, 386K rwdata, 1896K rodata, 344K init, 775K bss, 21440K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff000000   ( 552 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc077f6f0   (7646 kB)
[    0.000000]       .init : 0xc0780000 - 0xc07d6000   ( 344 kB)
[    0.000000]       .data : 0xc07d6000 - 0xc08368e8   ( 387 kB)
[    0.000000]        .bss : 0xc08368e8 - 0xc08f8780   ( 776 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:522
[    0.000023] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483648000ns
[    0.000057] Switching to timer-based delay loop, resolution 1000ns
[    0.000352] Console: colour dummy device 80x30
[    0.001767] console [tty1] enabled
[    0.001805] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=1000)
[    0.001812] pid_max: default: 32768 minimum: 301
[    0.002265] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.002280] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.003545] Initializing cgroup subsys memory
[    0.003583] Initializing cgroup subsys devices
[    0.003608] Initializing cgroup subsys freezer
[    0.003631] Initializing cgroup subsys net_cls
[    0.003650] Initializing cgroup subsys blkio
[    0.003814] CPU: Testing write buffer coherency: ok
[    0.003827] ftrace: allocating 19431 entries in 57 pages
[    0.118073] Setting up static identity map for 0x5308f0 - 0x53094c
[    0.123428] devtmpfs: initialized
[    0.146423] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.149818] swork_kthread enter
[    0.151347] pinctrl core: initialized pinctrl subsystem
[    0.152606] NET: Registered protocol family 16
[    0.158635] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.165309] cpuidle: using governor ladder
[    0.171445] cpuidle: using governor menu
[    0.172065] bcm2708.uart_clock = 3000000
[    0.172175] of_platform_populate failed: -22
[    0.177011] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.177084] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.177160] mailbox: Broadcom VideoCore Mailbox driver
[    0.177756] bcm2708_vcio: mailbox at f200b880
[    0.178361] bcm_power: Broadcom power driver
[    0.178423] bcm_power_open() -> 0
[    0.178456] bcm_power_request(0, 8)
[    0.679212] bcm_mailbox_read -> 00000080, 0
[    0.679342] bcm_power_request -> 0
[    0.679578] Serial: AMBA PL011 UART driver
[    0.679838] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev3
[    1.081148] console [ttyAMA0] enabled
[    1.154670] SCSI subsystem initialized
[    1.158888] usbcore: registered new interface driver usbfs
[    1.164685] usbcore: registered new interface driver hub
[    1.170373] usbcore: registered new device driver usb
[    1.178327] Switched to clocksource stc
[    1.248966] FS-Cache: Loaded
[    1.252476] CacheFiles: Loaded
[    1.281258] NET: Registered protocol family 2
[    1.287695] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    1.294939] TCP bind hash table entries: 4096 (order: 4, 98304 bytes)
[    1.301732] TCP: Hash tables configured (established 4096 bind 4096)
[    1.308237] TCP: reno registered
[    1.311529] UDP hash table entries: 256 (order: 2, 16384 bytes)
[    1.317556] UDP-Lite hash table entries: 256 (order: 2, 16384 bytes)
[    1.324642] NET: Registered protocol family 1
[    1.330012] RPC: Registered named UNIX socket transport module.
[    1.336001] RPC: Registered udp transport module.
[    1.340751] RPC: Registered tcp transport module.
[    1.345496] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.353812] bcm2708_dma: DMA manager at f2007000
[    1.358741] bcm2708_gpio: bcm2708_gpio_probe c07e4f20
[    1.364763] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.375228] futex hash table entries: 256 (order: 1, 8192 bytes)
[    1.381541] audit: initializing netlink subsys (disabled)
[    1.387078] audit: type=2000 audit(1.282:1): initialized
[    1.417204] VFS: Disk quotas dquot_6.5.2
[    1.421788] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.433552] FS-Cache: Netfs 'nfs' registered for caching
[    1.440654] NFS: Registering the id_resolver key type
[    1.445848] Key type id_resolver registered
[    1.450079] Key type id_legacy registered
[    1.456158] msgmni has been set to 870
[    1.463211] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.471081] io scheduler noop registered
[    1.475097] io scheduler deadline registered (default)
[    1.480553] io scheduler cfq registered
[    1.487808] BCM2708FB: allocated DMA memory 5bc00000
[    1.493187] BCM2708FB: allocated DMA channel 0 @ f2007000
[    1.505247] Console: switching to colour frame buffer device 82x26
[    1.518427] bcm2708-dmaengine bcm2708-dmaengine: Load BCM2835 DMA engine driver
[    1.528459] uart-pl011 dev:f1: no DMA platform data
[    1.536562] vc-cma: Videocore CMA driver
[    1.542424] vc-cma: vc_cma_base      = 0x00000000
[    1.548866] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.556042] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.585141] brd: module loaded
[    1.601627] loop: module loaded
[    1.607105] vchiq: vchiq_init_state: slot_zero = 0xdb800000, is_master = 0
[    1.617435] Loading iSCSI transport class v2.0-870.
[    1.626541] usbcore: registered new interface driver smsc95xx
[    1.634304] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.842208] Core Release: 2.80a
[    1.847171] Setting default values for core params
[    1.853700] Finished setting default values for core params
[    2.061645] Using Buffer DMA mode
[    2.066744] Periodic Transfer Interrupt Enhancement - disabled
[    2.074381] Multiprocessor Interrupt Enhancement - disabled
[    2.081647] OTG VER PARAM: 0, OTG VER FLAG: 0
[    2.087808] Dedicated Tx FIFOs mode
[    2.093983] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xdbc14000 dma = 0x5bc14000 len=9024
[    2.107465] FIQ FSM acceleration enabled for :
[    2.107465] Non-periodic Split Transactions
[    2.107465] Periodic Split Transactions
[    2.107465] High-Speed Isochronous Endpoints
[    2.131091] dwc_otg: Microframe scheduler enabled
[    2.131221] WARN::hcd_init_fiq:412: FIQ on core 0 at 0xc03def58
[    2.131232] WARN::hcd_init_fiq:413: FIQ ASM at 0xc03df230 length 36
[    2.131257] WARN::hcd_init_fiq:438: MPHI regs_base at 0xdc806000
[    2.131284] dwc_otg bcm2708_usb: DWC OTG Controller
[    2.161786] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    2.171258] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    2.178666] Init: Port Power? op_state=1
[    2.184384] Init: Power Port (0)
[    2.189750] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.198396] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.207396] usb usb1: Product: DWC OTG Controller
[    2.213803] usb usb1: Manufacturer: Linux 3.18.7-rt1+ dwc_otg_hcd
[    2.221694] usb usb1: SerialNumber: bcm2708_usb
[    2.229797] hub 1-0:1.0: USB hub found
[    2.235553] hub 1-0:1.0: 1 port detected
[    2.242172] dwc_otg: FIQ enabled
[    2.242199] dwc_otg: NAK holdoff enabled
[    2.242214] dwc_otg: FIQ split-transaction FSM enabled
[    2.242282] Module dwc_common_port init
[    2.243108] usbcore: registered new interface driver usb-storage
[    2.251653] mousedev: PS/2 mouse device common for all mice
[    2.260227] bcm2835-cpufreq: min=700000 max=700000
[    2.267429] sdhci: Secure Digital Host Controller Interface driver
[    2.275379] sdhci: Copyright(c) Pierre Ossman
[    2.282243] DMA channels allocated for the MMC driver
[    2.309650] Load BCM2835 MMC driver
[    2.316940] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.331976] hidraw: raw HID events driver (C) Jiri Kosina
[    2.339903] usbcore: registered new interface driver usbhid
[    2.347549] usbhid: USB HID core driver
[    2.353759] TCP: cubic registered
[    2.358473] mmc0: host does not support reading read-only switch, assuming write-enable
[    2.360772] mmc0: new high speed SDHC card at address 0001
[    2.364471] mmcblk0: mmc0:0001 SD8GB 7.32 GiB 
[    2.366844]  mmcblk0: p1 p2
[    2.367650] mmcblk0: p2 size 15400960 extends beyond EOD, truncated
[    2.401476] Initializing XFRM netlink socket
[    2.407653] NET: Registered protocol family 17
[    2.414428] Key type dns_resolver registered
[    2.422991] registered taskstats version 1
[    2.429532] vc-sm: Videocore shared memory driver
[    2.436262] [vc_sm_connected_init]: start
[    2.441570] Indeed it is in host mode hprt0 = 00021501
[    2.457075] [vc_sm_connected_init]: end - returning 0
[    2.497492] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.512439] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    2.524055] devtmpfs: mounted
[    2.532637] Freeing unused kernel memory: 344K (c0780000 - c07d6000)
[    2.641665] usb 1-1: new full-speed USB device number 2 using dwc_otg
[    2.654108] Indeed it is in host mode hprt0 = 00021501
[    2.848627] usb 1-1: not running at top speed; connect to a high speed hub
[    2.863766] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    2.873587] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.895271] hub 1-1:1.0: USB hub found
[    2.906722] hub 1-1:1.0: 5 ports detected
[    3.195890] usb 1-1.1: new full-speed USB device number 3 using dwc_otg
[    3.291557] usb 1-1.1: not running at top speed; connect to a high speed hub
[    3.304460] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.316506] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.331854] smsc95xx v1.0.4
[    3.400727] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:1a:7d:e4
[    4.784703] udevd[173]: starting version 175
[    6.501988] bcm2708_i2c_init_pinmode(1,2)
[    6.600730] bcm2708_i2c_init_pinmode(1,3)
[    6.667788] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 400000)
[    6.808885] bcm2708_spi bcm2708_spi.0: master is unqueued, this is deprecated
[    6.889595] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
[   10.721499] pcm512x 1-004d: Failed to reset device: -5
[   10.755823] pcm512x: probe of 1-004d failed with error -5
[   10.782005] pcm512x 1-004c: Failed to reset device: -5
[   10.801811] pcm512x: probe of 1-004c failed with error -5
[   14.523439] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   15.351784] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   15.631551] random: nonblocking pool is initialized
[   16.925587] i2c /dev entries driver
[   28.791032] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   30.233153] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[   41.025632] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SSFS

I found your same problem with SPI :frowning:

Mines saying something slightly different…
[ 4.391837] bcm2708_spi 3f204000.spi: master is unqueued, this is deprecated
[ 4.450764] bcm2708_spi 3f204000.spi: SPI Controller at 0x3f204000 (irq 80)

But still not working, the B+ is listing DMA channels being assigned to SPI, whereas the PI 2 is not. It’s likely a driver issue somewhere due to the base GPIO address having to change because of the increase in memory on the PI 2.

Additional, Managed to get
[ 4.080281] bcm2708_spi bcm2708_spi.0: DMA channel 2 at address 0xf3007200 with irq 77
[ 4.095429] bcm2708_spi bcm2708_spi.0: DMA channel 4 at address 0xf3007400 with irq 20
[ 4.143685] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x3f204000 (irq 80)
[ 4.158616] bcm2708_spi bcm2708_spi.0: SPI Controller running in dma mode

but still getting nulls/0’s from the SPI devices :frowning: (by adding GitHub - notro/spi-bcm2708: Discontinued. SPI master driver with DMA support for the Raspberry Pi to the source for the standard Raspbian distro)
Nice how it only takes an hour to compile the kernel on the PI itself now tho :smile:

edit:
Narrowing it down, it seems the status return in the transfer function in SPIdev.h is returning errno 22 (Invalid argument)

edit2:
Solved! the spi_ioc_transfer structure has changed. added…

struct spi_ioc_transfern {
__u64 tx_buf;
__u64 rx_buf;
__u32 len;
__u32 speed_hz;
__u16 delay_usecs;
__u8 bits_per_word;
__u8 cs_change;
__u8 tx_nbits;
__u8 rx_nbits;
__u16 pad;
};

to SPIdev.h and made the transfer function use that instead :smile: GPS, AccelGyroMag and AHRS are all working fine now
(that might not work with the rt kernel, but it should help with some hints)

None… actually adjusting the structure into SPIdev.h does not solve the problem. Tested with Raspberry Pi B+.

How much time it will take to have a stable new kernel for the Navio??? :frowning:

V.

@vincenzocalabro @mathewoxenham

Seems like spidev compatibility was broken, very strange. Btw, it only affects C++, Python examples are working without modifications.

It’s hard to estimate when the kernel for RPi2 will be ready, maybe a couple of weeks.

Here’s the link for the new kernel version for RPi2, but it doesn’t differ much, as it also crashes on cyclictest.

rpi2-kernel-3.18.7-rt2 (WARNING! KERNEL IS NOT STABLE!)

Could you guys please install it on RPi2, install cyclistest and run:

sudo cyclictest --smp -p99 -m -n

After running that an ssh session on my RPi2 freezes in a couple of minutes and then a few seconds later the serial console freezes too. Does the same happen on yours?

Thanks for the reply. I hope you will also understand what is wrong with the C++ library. That is a serious issue :frowning:

I found some information about this issue:

http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97314&start=75

http://www.raspberrypi.org/forums/viewtopic.php?p=680665#p680665

http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=101380&p=702587

it seems that the whole problem is caused by the fact that the spi structure is not initialized (memset) to zero.

I will test this asap, meanwhile you can take a look to these links and if you find the solution, please let me know (and update the git repository) :smiley:

V.

@vincenzocalabro

SPI fixed and works for me now. Please pull the changes from the github. Thanks for finding the solution!