From: Alexandre COFFIGNAL <acoffignal@geral.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] imx28 rtcan flexcan system freezes
Date: Wed, 22 Jan 2014 12:36:09 +0100 [thread overview]
Message-ID: <52DFAD29.4000800@geral.com> (raw)
In-Reply-To: <52DFAA18.6080703@xenomai.org>
Le 22/01/2014 12:23, Gilles Chanteperdrix a écrit :
> On 01/22/2014 11:24 AM, Alexandre COFFIGNAL wrote:
>> Hi all,
>>
>> I use two rtcan flexcan on imx28-evk board.
>>
>> If both rtcan devices receive a data at the same time, this cause a freeze.
>> After investigation, i found that if I replace in flexcan_rx_interrupt
>> these instructions :
>> - *(__be32 *)(cf->data + 0) =
>> - cpu_to_be32(flexcan_read(&mb->data[0]));
>> - *(__be32 *)(cf->data + 4) =
>> - cpu_to_be32(flexcan_read(&mb->data[1]));
>>
>> by these
>>
>> + data0 = flexcan_read(&mb->data[0]);
>> + data1 = flexcan_read(&mb->data[1]);
>> +
>> + cf->data[3]=((data0 >> 0) & 0xFF) ;
>> + cf->data[2]=((data0 >> 8) & 0xFF) ;
>> + cf->data[1]=((data0 >> 16) & 0xFF) ;
>> + cf->data[0]=((data0 >> 24) & 0xFF) ;
>> + cf->data[7]=((data1 >> 0) & 0xFF) ;
>> + cf->data[6]=((data1 >> 8) & 0xFF) ;
>> + cf->data[5]=((data1 >> 16) & 0xFF) ;
>> + cf->data[4]=((data1 >> 24) & 0xFF) ;
>>
>> rtcan flexcan works perfectly.
>> is anyone know what is the problem with first instructions ?
> Probably mb->data does not have the right alignment. Could you not
> arrange to get it properly aligned? Failing that, you should use
> put_unaligned instead of open coding it.
>
>
here structures used in flexcan driver, it seem to be aligned
/* Structure of the message buffer */
struct flexcan_mb {
u32 can_ctrl;
u32 can_id;
u32 data[2];
};
/* Structure of the hardware registers */
struct flexcan_regs {
u32 mcr; /* 0x00 */
u32 ctrl; /* 0x04 */
u32 timer; /* 0x08 */
u32 _reserved1; /* 0x0c */
u32 rxgmask; /* 0x10 */
u32 rx14mask; /* 0x14 */
u32 rx15mask; /* 0x18 */
u32 ecr; /* 0x1c */
u32 esr; /* 0x20 */
u32 imask2; /* 0x24 */
u32 imask1; /* 0x28 */
u32 iflag2; /* 0x2c */
u32 iflag1; /* 0x30 */
u32 crl2; /* 0x34 */
u32 esr2; /* 0x38 */
u32 _reserved2[2];
u32 crcr; /* 0x44 */
u32 rxfgmask; /* 0x48 */
u32 rxfir; /* 0x4c */
u32 _reserved3[12];
struct flexcan_mb cantxfg[64];
};
next prev parent reply other threads:[~2014-01-22 11:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 10:24 [Xenomai] imx28 rtcan flexcan system freezes Alexandre COFFIGNAL
2014-01-22 11:23 ` Gilles Chanteperdrix
2014-01-22 11:36 ` Alexandre COFFIGNAL [this message]
2014-01-22 12:00 ` Gilles Chanteperdrix
2014-01-22 13:27 ` Alexandre COFFIGNAL
2014-01-22 13:30 ` Gilles Chanteperdrix
2014-01-22 14:04 ` Alexandre COFFIGNAL
2014-01-22 14:12 ` Gilles Chanteperdrix
2014-01-23 10:04 ` Gilles Chanteperdrix
2014-01-23 11:36 ` Wolfgang Grandegger
2014-01-23 12:05 ` Gilles Chanteperdrix
2014-01-23 12:21 ` Wolfgang Grandegger
2014-01-23 12:23 ` Gilles Chanteperdrix
2014-01-23 13:07 ` Gilles Chanteperdrix
2014-01-23 12:54 ` Alexandre COFFIGNAL
2014-01-23 13:10 ` Alexandre COFFIGNAL
2014-01-26 19:26 ` Wolfgang Grandegger
2014-01-26 19:29 ` Gilles Chanteperdrix
2014-01-26 20:16 ` Wolfgang Grandegger
2014-01-26 20:56 ` Gilles Chanteperdrix
2014-01-27 7:56 ` Wolfgang Grandegger
2014-01-28 22:06 ` Gilles Chanteperdrix
2014-01-29 7:16 ` Wolfgang Grandegger
2014-01-29 15:50 ` Alexandre COFFIGNAL
2014-01-29 17:58 ` Gilles Chanteperdrix
2014-01-31 13:15 ` Alexandre COFFIGNAL
2014-01-23 19:48 ` Gilles Chanteperdrix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52DFAD29.4000800@geral.com \
--to=acoffignal@geral.com \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.