Hi Wolfgang,

On Tue, Oct 27, 2009 at 06:29:57PM +0100, Wolfgang Grandegger wrote:
> Luotao Fu wrote:
> > Hi,
> > 
> > I'm playing with 2.6.31 + mscan driver on a mpc5200B board the last
> > days, have slightly backported the mscan driver to meet the can frame
> > work in 2.6.31. Now I ran into a quite funny situation:
> > 
> > The board is connected to a host, which has an IXXAT PCI can card
> > (2.6.26 and an unknown SocketCAN version, which is more or less recent,
> > since it provides sysfs entries). The host is set to a baudrate of
> > 250kbit, while the target comes up with 125kbit. As soon as the host and
> > target are up and running, I send a frame with cansend from the host.
> > After that both sides go into bus passive, which is the expected
> > behaviour. However the board seems not to be able to get out there any
> > more. Turning off the interface -> change the baudrate to 250K ->
> > turning on the interface went through without errors. However the board
> > seems to stuck and neither sending nor receiving will work any more. I
> > instrumented the mscan_set_mode() call with the attached patch and
> > noticed that the RXACT is never cleared in this case any more and the
> > initrq will eventually never reach. a small screenshot to make it a
> > little more clear:
> > ## Usually changing bitrate should read like this
> > @target: /sbin/ip link set can1 type can bitrate 250000
> > changing bit rate to can1
> > [  105.854706] ctl0: 0x10
> > [  105.857231] ctl0: 0x2
> > ## sleep mode request is set
> > [  105.863075] ctl0: 0x3
> > ## init mode request is set
> 
> Hm, the lines above are from a ifconfig down, right?
> 

Ah, je, the kernel prints are from ifconfig down. I lied a little since
in the screenshot since I wrote the commands into a script. Actually I
thought myself the whole time that the printks come from bitrate stuff,
just like in the prehistorical old version. This was however the only
untruth here. I promise. ;-)

> > [  105.888505] mpc52xx_can f0000980.can: setting BTR0=0x0a BTR1=0x18
> > ## after the mscan got stuck resetting bitrate reads like this:
> > @target: /sbin/ip link set can1 type can bitrate 250000
> > changing bit rate to can1
> > [  303.130686] ctl0: 0x50
> > [  303.160088] ctl0: 0x52
> > [  303.162512] ctl0: 0x52
> > [  303.206860] mpc52xx_can f0000980.can: setting BTR0=0x0a BTR1=0x18
> > 
> > Seems RXACT is never cleared on the mscan side. Setting to init_mode
> > will then eventually fail and the controller stucks in sleep mode. I
> > can solve the problem by pulling the target from can bus and so
> > cause an bus-off to restart the stuff or I restart the can controller
> > on the host side. However it still feels like a bug. Two questions:
> 
> Either a hardware or a software bug. RXACT can not be cleared by software.
> 

Noticed that. I do think that the RXACT is triggered by the host
retrying sending the message. Could this be the reason why the mscan
controller got stuck?

> > 1. why is the failed initrq uncatched? I doubled checked with an mscan
> > driver from an reeeeal old socketcan patch(-r466) + 2.6.23, it will fail
> > on spinning wait for slpak and quit there with an -ENODEV. Why is it not
> > happening any more?
> 
> Could you highlight the differences between to new and the old version?
> And does the old approach fix the problem?
> 

I mistook on this one. In the old version the do_set_mode was called
while changing baudrate with INIT_MODE set. In the new version the
do_set_mode is called during ifconfig down with SLEEP_MODE. Where
there's no init request, there's also no error to catch.

> > 2. Any hint for a possible fix the problem described above or is it more
> > a conceptional question / hardware problem with mscan?
> 
> >From time to time I have observed myself wired problems with the MSCAN
> CAN state management, which I was unable to explain. I will try to
> reproduce your symptoms on my setup.

thx

cheers
Luotao Fu
-- 
Pengutronix e.K.                           | Dipl.-Ing. Luotao Fu        |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to