All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: CAN bus
PostPosted: Thu Jan 03, 2008 2:02 pm 
Offline


Thu Jan 03, 2008 12:26 pm

9
Hi!
Could someone please point me in the right direction to enable the CAN bus on efika 5200 board with openSUSE 10.3.


Top
 Profile  
 
 Post subject: Re: CAN bus
PostPosted: Thu Jan 03, 2008 4:53 pm 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
Okay the configuration is as follows:

CAN1 is connected to the CAN1 port - it's present on I2C1 pins (W19 and V19).

The way I see it you need to look at Chapter 7 of the manual and look at the GPS Port Configuration Register, for the "ALT" bits - will set up alternative configuration so that CAN1 is on I2C1.

Code:
01 = ALT CAN position: CAN1 on I2C1, CAN2 on Tmr0/1 pins, see Note 1


Doing this in my head, you can do this from Firmware using;

Code:
0xf0000b00 dup l@ 0x10000000 and l!


You can then access the MSCAN bus at MBAR + 0x0900. I would suggest you perform that logic operation above and add in the code to a Forth script or your nvramrc to enable it on boot;

Code:
s" /builtin" find-device
new-device
 s" mscan" 2dup device-name device-type
 0xf0000900 0x40 reg
 s" MPC52xx MSCAN Controller 1" encode-string s" .description" property
 s" mpc5200b-mscan" encode-string s" mpc5200-mscan" encode-string encode+ s" compatible" property
 0 encode-int s" cell-index" property
finish-device


You may need to add a probe-all above it in nvramrc if it's not there, and put all this between that and "install-console banner" if that's present.

Please do not try this unless you're sure! Now all you need is a driver for the CAN bus, and you're all set (this at least gives any arch/powerpc-compliant driver all the things it needs from the firmware)

As a side effect, it seems that the CAN pins on the bottom of the board are an effective I2C bus on boot without further configuration. You could add the bus with this snippet (mutually exclusive with the above):

Code:
s" /builtin" find-device
new-device
 s" i2c" 2dup device-name device-type
 0xf0003d00 0x1c reg
 s" MPC52xx i2c Controller 1" encode-string s" .description" property
 s" mpc5200b-i2c" encode-string s" mpc5200-i2c" encode-string encode+ s" compatible" property
 0 encode-int s" cell-index" property
finish-device


There are obviously missing interrupt properties etc. but I will leave that as an exercise to the reader.

If someone manages to test these please give me a nudge and I will integrate them happily into the Device Tree Supplement and Platform Specifications page! I know a lot of people wanted an I2C bus on their Efika for controlling devices, and this is the key information..
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: CAN bus nightmare
PostPosted: Fri Feb 29, 2008 10:54 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
I tried that and it failed with:

cpu_exception:
SRR0 0x0101EE34 SRR1 0x00003030 MSR 0x00003030
LR 0x0101EE10 CTR 0x01018C84 CR 0x48002022 XER 0x20000000
DAR 0x709A2C93 DSISR 0x40000000 Type 3
GPR[] 0x0000000B 0x017FF5B0 0x00000000 0x0000000B 0x017FF5BC 0xFFFFFFFE 0x000000
07 0x017FF6B0
GPR[] 0x07C043E4 0x0000000B 0x00000000 0x017FF5B8 0x28004022 0x1001C0D0 0x000000
00 0xC6695D00
GPR[] 0xC0001FFF 0xC000002A 0x00001FFF 0x00000012 0x08000000 0x8000002A 0x002652
DA 0xF000002A
GPR[] 0x00000000 0x00000001 0x00000000 0x00000000 0x017FF718 0x00000010 0x07C5D7
40 0x709A2C93
ibat0U 0x00001FFF ibat0L 0x00000012
ibat1U 0xF0001FFF ibat1L 0xF0000012
ibat2U 0x00000000 ibat2L 0x00000000
ibat3U 0x00000000 ibat3L 0x00000000
dbat0U 0xF0001FFF dbat0L 0xF000002A
dbat1U 0x80001FFF dbat1L 0x8000002A
dbat2U 0x00001FFF dbat2L 0x00000012
dbat3U 0xC0001FFF dbat3L 0xC000002A
HID0 0x0000C000
deadend:


Top
 Profile  
 
 Post subject: Re: CAN bus nightmare
PostPosted: Sat Mar 01, 2008 3:40 pm 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
vedran wrote:
I tried that and it failed with:


Just by running the code snippet?
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: Nightmare continues
PostPosted: Mon Mar 03, 2008 4:41 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
There was also a snippet which is supposed to fix sound, but other than that nothing else.


Top
 Profile  
 
 Post subject: Re: Nightmare continues
PostPosted: Mon Mar 03, 2008 7:28 am 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
vedran wrote:
There was also a snippet which is supposed to fix sound, but other than that nothing else.


Are you running the same firmware as me (20070122) as posted in Platform Support?

Try without the sound fix, which should not even be required with this firmware. I am trying to reproduce the crash and burn here without success.. the new (possibly final) efika.forth will be delayed because of this extra testing, but it's worthwhile because of the problem.

Can you reproduce it if you type out the snippet manually, word by word, pressing return at the relevant points (where it seems safe to do so, but you can literally press return instead of space because Forth is cool :)?
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: My bad!
PostPosted: Tue Mar 04, 2008 4:23 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
It was unrelated problem! The firmware update is the same, and it boots ok, but openSUSE 10.3 kernel complains something about duplicate entries in device tree.


Top
 Profile  
 
 Post subject: Re: My bad!
PostPosted: Tue Mar 04, 2008 4:57 am 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
vedran wrote:
It was unrelated problem! The firmware update is the same, and it boots ok, but openSUSE 10.3 kernel complains something about duplicate entries in device tree.


Post the error please?
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: Kernel error
PostPosted: Fri Mar 07, 2008 10:22 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
This is cut from dmesg:

snip snip
----------
device-tree: Duplicate name in /builtin@F0000000, renamed to "mscan@F0000900#1"
NET: Registered protocol family 16
kobject_add failed for f0000900.mscan with -EEXIST, don't try to register things with the same name in the same directory.
Call Trace:
[c0615e20] [c000843c] show_stack+0x58/0x188 (unreliable)
[c0615e70] [c016cdac] kobject_shadow_add+0x160/0x1a4
[c0615e90] [c02266e8] device_add+0x90/0x4ec
[c0615ed0] [c000a36c] of_device_register+0x24/0x34
[c0615ee0] [c000a8e4] of_platform_device_create+0x150/0x17c
[c0615f00] [c000a93c] of_platform_bus_create+0x2c/0xb4
[c0615f20] [c000ab04] of_platform_bus_probe+0xe4/0x134
[c0615f40] [c04299cc] mpc52xx_declare_of_platform_devices+0x1c/0x40
[c0615f50] [c041c6c8] ppc_init+0x6c/0x84
[c0615f60] [c0416248] kernel_init+0xf0/0x288
[c0615ff0] [c00137d4] kernel_thread+0x44/0x60
arch/powerpc/platforms/52xx/mpc52xx_common.c: Error while probing of_platform bus
PCI: Probing PCI hardware
MPC52xx BestComm inited


Top
 Profile  
 
 Post subject: Re: Kernel error
PostPosted: Fri Mar 07, 2008 10:23 am 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
vedran wrote:
This is cut from dmesg:


This looks as if you just ran the snippet twice?
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: Mea culpa!
PostPosted: Mon Mar 10, 2008 4:33 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
It appears I did manage to screw up boot up precedure, so it DID run the snippet twice.
Very sorry for that, I'm still new to the power architecture and openfirmware.
But not one more thing that is bugging me, kernel driver for can controller (http://www.peak-system.com/linux/files/ ... 6.7.tar.gz)
refuses to compile on openSUSE 10.3.
Kernel headers and sources are both installed but it still nags
that it still can find version.h file.
Ideas are most welcome :-)
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 4:34 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
that was supposed to be "can't find version.h file" :-)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 4:56 am 
Offline
Site Admin


Fri Sep 24, 2004 1:39 am

1589

Alamo Heights, TX
vedran wrote:
that was supposed to be "can't find version.h file" :-)


I'm not even sure that version of the driver supports the MPC52xx..?

Anyway, the instruction PDF coming with it explains;

Quote:
2. The “/lib/modules/'uname -r'/build/include/linux/version.h“ file has to exist or being
copied before from the path “/boot/vmlinuz.version.h“.


Do you have your kernel build environment set up exactly how your distribution requires? The instructions imply that you are building the module for an already existing kernel - you should build one first, boot into it, and then compile against the running kernel, modules and installed kernel headers for that version.

version.h only gets generated from successful kernel builds :D
Matt Sealey, Genesi USA Inc.
Product Development Analyst


Top
 Profile  
 
 Post subject: Works!
PostPosted: Mon Mar 10, 2008 7:05 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
There is nothing a little kernel update won't fix :-)
Ran zypper up, to update the system, among other things it pulled the new kernel (2.6.22.17-0.1-default) and with that compile went on smoothly.
Thanks again for your patience! :-)


Top
 Profile  
 
 Post subject: Spoke to soon
PostPosted: Mon Mar 10, 2008 7:26 am 
Offline


Thu Jan 03, 2008 12:26 pm

9
Kernel module compiles and loads ok, but it appears it can't find any interfaces.

-- snip --
# cat /proc/pcan

*------------ PEAK-Systems CAN interfaces (www.peak-system.com) -------------
*-------------------------- Release_20080220_n ----------------------------
*---------------- [mod] [isa] [pci] [dng] [par] [usb] [pcc] -----------------
*--------------------- 0 interfaces @ major 253 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status


-- end snip --

How can I be sure that the forth snippet did it job?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Exabot [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group