* can4linux compilation for i.mx25 under 2.6.39
@ 2012-05-30 11:39 Martin Kozusky
2012-05-30 11:50 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 11:39 UTC (permalink / raw)
To: linux-can
Hello,
I downloaded latest sources of can4linux from svn and I'm trying to
compile it for 2.6.39 kernel (i.mx25 driver).
I edit cross-imx25 with proper compiler settings etc then ".
cross-imx25" and "make"
There are some errors like
core.c:441:12: error: 'CAN1_BASE_ADDR' undeclared
core.c:452:11: error: 'MXC_INT_CAN1' undeclared
I can change CAN1_BASE_ADDR to MX25_CAN1_BASE_ADDR and MXC_INT_CAN1 to
MX25_INT_CAN1, but there is error
imx35.c:18:26: fatal error: mach/mxc_can.h: No such file or directory
Does anybody have idea where do I get this file? When I comment this
line, compilation continues and stops at
imx35.c:113:18: error: dereferencing pointer to incomplete type
Does it have anything to do with Karo tx25 board? (which I'm not using)
I already have CAN running using SocketCAN, but I also wanted to try
can4linux.
Thanks for any help,
Martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 11:39 can4linux compilation for i.mx25 under 2.6.39 Martin Kozusky
@ 2012-05-30 11:50 ` Marc Kleine-Budde
2012-05-30 12:05 ` Martin Kozusky
0 siblings, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 11:50 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]
Hello Martin,
On 05/30/2012 01:39 PM, Martin Kozusky wrote:
> Hello,
> I downloaded latest sources of can4linux from svn and I'm trying to
> compile it for 2.6.39 kernel (i.mx25 driver).
> I edit cross-imx25 with proper compiler settings etc then ".
> cross-imx25" and "make"
>
> There are some errors like
> core.c:441:12: error: 'CAN1_BASE_ADDR' undeclared
> core.c:452:11: error: 'MXC_INT_CAN1' undeclared
>
> I can change CAN1_BASE_ADDR to MX25_CAN1_BASE_ADDR and MXC_INT_CAN1 to
> MX25_INT_CAN1, but there is error
>
> imx35.c:18:26: fatal error: mach/mxc_can.h: No such file or directory
It comes from a Karo patch:
http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openembedded.git;a=commitdiff_plain;h=58d6c0ace0c9fe2a3ed9fa845bec9a89583e2fd5
> Does anybody have idea where do I get this file? When I comment this
> line, compilation continues and stops at
>
> imx35.c:113:18: error: dereferencing pointer to incomplete type
>
> Does it have anything to do with Karo tx25 board? (which I'm not using)
> I already have CAN running using SocketCAN, but I also wanted to try
> can4linux.
Why do you want to use can4linux? Socketcan is the official CAN Stack
for Linux. Be sure you use the latest kernel, because the flexcan driver
has some bugs and problems prior to v3.4.
Regards, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 11:50 ` Marc Kleine-Budde
@ 2012-05-30 12:05 ` Martin Kozusky
2012-05-30 12:08 ` Martin Kozusky
2012-05-30 12:16 ` Marc Kleine-Budde
0 siblings, 2 replies; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 12:05 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 13:50, Marc Kleine-Budde napsal(a):
> Hello Martin,
>
> On 05/30/2012 01:39 PM, Martin Kozusky wrote:
>> Hello,
>> I downloaded latest sources of can4linux from svn and I'm trying to
>> compile it for 2.6.39 kernel (i.mx25 driver).
>> I edit cross-imx25 with proper compiler settings etc then ".
>> cross-imx25" and "make"
>>
>> There are some errors like
>> core.c:441:12: error: 'CAN1_BASE_ADDR' undeclared
>> core.c:452:11: error: 'MXC_INT_CAN1' undeclared
>>
>> I can change CAN1_BASE_ADDR to MX25_CAN1_BASE_ADDR and MXC_INT_CAN1 to
>> MX25_INT_CAN1, but there is error
>>
>> imx35.c:18:26: fatal error: mach/mxc_can.h: No such file or directory
>
> It comes from a Karo patch:
>
> http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openembedded.git;a=commitdiff_plain;h=58d6c0ace0c9fe2a3ed9fa845bec9a89583e2fd5
>
>> Does anybody have idea where do I get this file? When I comment this
>> line, compilation continues and stops at
>>
>> imx35.c:113:18: error: dereferencing pointer to incomplete type
>>
>> Does it have anything to do with Karo tx25 board? (which I'm not using)
>> I already have CAN running using SocketCAN, but I also wanted to try
>> can4linux.
>
> Why do you want to use can4linux? Socketcan is the official CAN Stack
> for Linux. Be sure you use the latest kernel, because the flexcan driver
> has some bugs and problems prior to v3.4.
>
> Regards, Marc
>
>
Hello Marc,
I wanted to try if it will be faster than socketcan (which is dropping
some CAN frames on my HW under heavy load). I need the closest way to
the controller, and I thought that when can4linux is not using sockets
layer it could be faster. I also wanted to try LinCAN (which is compared
to SocketCAN here:
http://dce.felk.cvut.cz/hanzalek/publications/Hanzalek10_168894.pdf )
but I think it doesn't support Flexcan
Martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:05 ` Martin Kozusky
@ 2012-05-30 12:08 ` Martin Kozusky
2012-05-30 12:18 ` Marc Kleine-Budde
2012-05-30 12:16 ` Marc Kleine-Budde
1 sibling, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 12:08 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 14:05, Martin Kozusky napsal(a):
> Dne 30.5.2012 13:50, Marc Kleine-Budde napsal(a):
>> Hello Martin,
>>
>> On 05/30/2012 01:39 PM, Martin Kozusky wrote:
>>> Hello,
>>> I downloaded latest sources of can4linux from svn and I'm trying to
>>> compile it for 2.6.39 kernel (i.mx25 driver).
>>> I edit cross-imx25 with proper compiler settings etc then ".
>>> cross-imx25" and "make"
>>>
>>> There are some errors like
>>> core.c:441:12: error: 'CAN1_BASE_ADDR' undeclared
>>> core.c:452:11: error: 'MXC_INT_CAN1' undeclared
>>>
>>> I can change CAN1_BASE_ADDR to MX25_CAN1_BASE_ADDR and MXC_INT_CAN1 to
>>> MX25_INT_CAN1, but there is error
>>>
>>> imx35.c:18:26: fatal error: mach/mxc_can.h: No such file or directory
>>
>> It comes from a Karo patch:
>>
>> http://git.openpandora.org/cgi-bin/gitweb.cgi?p=openembedded.git;a=commitdiff_plain;h=58d6c0ace0c9fe2a3ed9fa845bec9a89583e2fd5
>>
>>
>>> Does anybody have idea where do I get this file? When I comment this
>>> line, compilation continues and stops at
>>>
>>> imx35.c:113:18: error: dereferencing pointer to incomplete type
>>>
>>> Does it have anything to do with Karo tx25 board? (which I'm not using)
>>> I already have CAN running using SocketCAN, but I also wanted to try
>>> can4linux.
>>
>> Why do you want to use can4linux? Socketcan is the official CAN Stack
>> for Linux. Be sure you use the latest kernel, because the flexcan driver
>> has some bugs and problems prior to v3.4.
>>
>> Regards, Marc
>>
And I can only use 2.6.39 kernel because there is no patch for my board
for kernel 3.x yet :(
>>
>
> Hello Marc,
> I wanted to try if it will be faster than socketcan (which is dropping
> some CAN frames on my HW under heavy load). I need the closest way to
> the controller, and I thought that when can4linux is not using sockets
> layer it could be faster. I also wanted to try LinCAN (which is compared
> to SocketCAN here:
> http://dce.felk.cvut.cz/hanzalek/publications/Hanzalek10_168894.pdf )
> but I think it doesn't support Flexcan
>
> Martin
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:05 ` Martin Kozusky
2012-05-30 12:08 ` Martin Kozusky
@ 2012-05-30 12:16 ` Marc Kleine-Budde
2012-05-30 12:29 ` Martin Kozusky
1 sibling, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 12:16 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
On 05/30/2012 02:05 PM, Martin Kozusky wrote:
>> Why do you want to use can4linux? Socketcan is the official CAN Stack
>> for Linux. Be sure you use the latest kernel, because the flexcan driver
>> has some bugs and problems prior to v3.4.
>>
>> Regards, Marc
> Hello Marc,
> I wanted to try if it will be faster than socketcan (which is dropping
> some CAN frames on my HW under heavy load). I need the closest way to
Have you debugged which component is dropping frames? Is it the hardware
or the socket because your application is to slow?
> the controller, and I thought that when can4linux is not using sockets
> layer it could be faster. I also wanted to try LinCAN (which is compared
> to SocketCAN here:
> http://dce.felk.cvut.cz/hanzalek/publications/Hanzalek10_168894.pdf )
> but I think it doesn't support Flexcan
Good luck :)
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:08 ` Martin Kozusky
@ 2012-05-30 12:18 ` Marc Kleine-Budde
2012-05-30 12:34 ` Martin Kozusky
0 siblings, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 12:18 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
On 05/30/2012 02:08 PM, Martin Kozusky wrote:
>>> Why do you want to use can4linux? Socketcan is the official CAN Stack
>>> for Linux. Be sure you use the latest kernel, because the flexcan driver
>>> has some bugs and problems prior to v3.4.
>>>
>>> Regards, Marc
>>>
>
> And I can only use 2.6.39 kernel because there is no patch for my board
> for kernel 3.x yet :(
Ask your supplier to a) backport the fixes to your kernel or b) to
deliver a 3.4 based BSP.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:16 ` Marc Kleine-Budde
@ 2012-05-30 12:29 ` Martin Kozusky
2012-05-30 12:40 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 12:29 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 14:16, Marc Kleine-Budde napsal(a):
> On 05/30/2012 02:05 PM, Martin Kozusky wrote:
>>> Why do you want to use can4linux? Socketcan is the official CAN Stack
>>> for Linux. Be sure you use the latest kernel, because the flexcan driver
>>> has some bugs and problems prior to v3.4.
>>>
>>> Regards, Marc
>
>> Hello Marc,
>> I wanted to try if it will be faster than socketcan (which is dropping
>> some CAN frames on my HW under heavy load). I need the closest way to
>
> Have you debugged which component is dropping frames? Is it the hardware
> or the socket because your application is to slow?
I tried to solve this 19.4.2012 (thread "CAN messages being lost on
i.MX25 with flexcan") and when I changed rcvbuf_size to 10000000 it
helped, but still sometimes few CAN frames are dropped (and many more
when I try to write to SD card or internal flash). So I think it's not
HW problem.
The best for me would be some kernel module which would just put the CAN
frame into some big "from userspace available" buffer in the interrupt
and nothing more. My app would check if there is anything new and read
it out.
There are around 1500/sec (at 250kbit) can frames on the bus when the
problem arise, I think it's not that much.
Martin
>> the controller, and I thought that when can4linux is not using sockets
>> layer it could be faster. I also wanted to try LinCAN (which is compared
>> to SocketCAN here:
>> http://dce.felk.cvut.cz/hanzalek/publications/Hanzalek10_168894.pdf )
>> but I think it doesn't support Flexcan
>
> Good luck :)
>
> Marc
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:18 ` Marc Kleine-Budde
@ 2012-05-30 12:34 ` Martin Kozusky
2012-05-30 12:37 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 12:34 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 14:18, Marc Kleine-Budde napsal(a):
> On 05/30/2012 02:08 PM, Martin Kozusky wrote:
>>>> Why do you want to use can4linux? Socketcan is the official CAN Stack
>>>> for Linux. Be sure you use the latest kernel, because the flexcan driver
>>>> has some bugs and problems prior to v3.4.
>>>>
>>>> Regards, Marc
>>>>
>>
>> And I can only use 2.6.39 kernel because there is no patch for my board
>> for kernel 3.x yet :(
>
> Ask your supplier to a) backport the fixes to your kernel or b) to
> deliver a 3.4 based BSP.
or c) backport the fixes myself :) I think that will be fastest way, if
it's just about fixes of flexcan driver. Or are there many changes in
many kernel files?
Martin
> Marc
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:34 ` Martin Kozusky
@ 2012-05-30 12:37 ` Marc Kleine-Budde
0 siblings, 0 replies; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 12:37 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 783 bytes --]
On 05/30/2012 02:34 PM, Martin Kozusky wrote:
>>> And I can only use 2.6.39 kernel because there is no patch for my board
>>> for kernel 3.x yet :(
>>
>> Ask your supplier to a) backport the fixes to your kernel or b) to
>> deliver a 3.4 based BSP.
>
> or c) backport the fixes myself :) I think that will be fastest way, if
> it's just about fixes of flexcan driver. Or are there many changes in
> many kernel files?
No, IIRC 2 patches on the driver, one small infrastructure patch.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:29 ` Martin Kozusky
@ 2012-05-30 12:40 ` Marc Kleine-Budde
2012-05-30 12:50 ` Martin Kozusky
0 siblings, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 12:40 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
On 05/30/2012 02:29 PM, Martin Kozusky wrote:
>> Have you debugged which component is dropping frames? Is it the hardware
>> or the socket because your application is to slow?
>
> I tried to solve this 19.4.2012 (thread "CAN messages being lost on
> i.MX25 with flexcan") and when I changed rcvbuf_size to 10000000 it
Oh, I see, this conversation slipped my mind.
> helped, but still sometimes few CAN frames are dropped (and many more
> when I try to write to SD card or internal flash). So I think it's not
> HW problem.
> The best for me would be some kernel module which would just put the CAN
> frame into some big "from userspace available" buffer in the interrupt
> and nothing more. My app would check if there is anything new and read
> it out.
> There are around 1500/sec (at 250kbit) can frames on the bus when the
> problem arise, I think it's not that much.
Are you writing the can frames to storage in the same thread as
receiving them?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:40 ` Marc Kleine-Budde
@ 2012-05-30 12:50 ` Martin Kozusky
2012-05-30 13:18 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 12:50 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 14:40, Marc Kleine-Budde napsal(a):
> On 05/30/2012 02:29 PM, Martin Kozusky wrote:
>>> Have you debugged which component is dropping frames? Is it the hardware
>>> or the socket because your application is to slow?
>>
>> I tried to solve this 19.4.2012 (thread "CAN messages being lost on
>> i.MX25 with flexcan") and when I changed rcvbuf_size to 10000000 it
>
> Oh, I see, this conversation slipped my mind.
>
>> helped, but still sometimes few CAN frames are dropped (and many more
>> when I try to write to SD card or internal flash). So I think it's not
>> HW problem.
>> The best for me would be some kernel module which would just put the CAN
>> frame into some big "from userspace available" buffer in the interrupt
>> and nothing more. My app would check if there is anything new and read
>> it out.
>> There are around 1500/sec (at 250kbit) can frames on the bus when the
>> problem arise, I think it's not that much.
>
> Are you writing the can frames to storage in the same thread as
> receiving them?
No, CAN has it's own thread, which is just making struct from can
messages (reading via select() ) and writes them into another buffer.
Then the main thread reads this buffer and writes to SD card. Now I
changed it so that this buffer is 30MB big, so I first store all the
messages into RAM, and when I don't need to record CAN frames anymore, I
write all of them to card from this big buffer.
But this is just limited workaround because I'm limited with the RAM
size (so I had to make the buffer cyclic and just latest xxxx messages
are stored, older are overwritten when the buffer is full).
Martin
> Marc
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 12:50 ` Martin Kozusky
@ 2012-05-30 13:18 ` Marc Kleine-Budde
2012-05-30 13:26 ` Martin Kozusky
0 siblings, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 13:18 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]
On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>> The best for me would be some kernel module which would just put the CAN
>>> frame into some big "from userspace available" buffer in the interrupt
>>> and nothing more. My app would check if there is anything new and read
>>> it out.
>>> There are around 1500/sec (at 250kbit) can frames on the bus when the
>>> problem arise, I think it's not that much.
>>
>> Are you writing the can frames to storage in the same thread as
>> receiving them?
>
>
> No, CAN has it's own thread, which is just making struct from can
> messages (reading via select() ) and writes them into another buffer.
> Then the main thread reads this buffer and writes to SD card. Now I
> changed it so that this buffer is 30MB big, so I first store all the
> messages into RAM, and when I don't need to record CAN frames anymore, I
> write all of them to card from this big buffer.
> But this is just limited workaround because I'm limited with the RAM
> size (so I had to make the buffer cyclic and just latest xxxx messages
> are stored, older are overwritten when the buffer is full).
Have you setup realtime priorities for you CAN thread?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 13:18 ` Marc Kleine-Budde
@ 2012-05-30 13:26 ` Martin Kozusky
2012-05-30 14:18 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-30 13:26 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>> The best for me would be some kernel module which would just put the CAN
>>>> frame into some big "from userspace available" buffer in the interrupt
>>>> and nothing more. My app would check if there is anything new and read
>>>> it out.
>>>> There are around 1500/sec (at 250kbit) can frames on the bus when the
>>>> problem arise, I think it's not that much.
>>>
>>> Are you writing the can frames to storage in the same thread as
>>> receiving them?
>>
>>
>> No, CAN has it's own thread, which is just making struct from can
>> messages (reading via select() ) and writes them into another buffer.
>> Then the main thread reads this buffer and writes to SD card. Now I
>> changed it so that this buffer is 30MB big, so I first store all the
>> messages into RAM, and when I don't need to record CAN frames anymore, I
>> write all of them to card from this big buffer.
>> But this is just limited workaround because I'm limited with the RAM
>> size (so I had to make the buffer cyclic and just latest xxxx messages
>> are stored, older are overwritten when the buffer is full).
>
> Have you setup realtime priorities for you CAN thread?
No, I did't set up any special attributes. Do you mean I should use
pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
Martin
> Marc
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 13:26 ` Martin Kozusky
@ 2012-05-30 14:18 ` Marc Kleine-Budde
2012-05-31 13:29 ` Martin Kozusky
0 siblings, 1 reply; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-30 14:18 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]
On 05/30/2012 03:26 PM, Martin Kozusky wrote:
> Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
>> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>>> The best for me would be some kernel module which would just put
>>>>> the CAN
>>>>> frame into some big "from userspace available" buffer in the interrupt
>>>>> and nothing more. My app would check if there is anything new and read
>>>>> it out.
>>>>> There are around 1500/sec (at 250kbit) can frames on the bus when the
>>>>> problem arise, I think it's not that much.
>>>>
>>>> Are you writing the can frames to storage in the same thread as
>>>> receiving them?
>>>
>>>
>>> No, CAN has it's own thread, which is just making struct from can
>>> messages (reading via select() ) and writes them into another buffer.
>>> Then the main thread reads this buffer and writes to SD card. Now I
>>> changed it so that this buffer is 30MB big, so I first store all the
>>> messages into RAM, and when I don't need to record CAN frames anymore, I
>>> write all of them to card from this big buffer.
>>> But this is just limited workaround because I'm limited with the RAM
>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>> are stored, older are overwritten when the buffer is full).
>>
>> Have you setup realtime priorities for you CAN thread?
> No, I did't set up any special attributes. Do you mean I should use
> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
or better SCHED_FIFO for your can thread.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-30 14:18 ` Marc Kleine-Budde
@ 2012-05-31 13:29 ` Martin Kozusky
2012-05-31 13:42 ` Marc Kleine-Budde
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-05-31 13:29 UTC (permalink / raw)
To: linux-can
Dne 30.5.2012 16:18, Marc Kleine-Budde napsal(a):
> On 05/30/2012 03:26 PM, Martin Kozusky wrote:
>> Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
>>> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>>>> The best for me would be some kernel module which would just put
>>>>>> the CAN
>>>>>> frame into some big "from userspace available" buffer in the interrupt
>>>>>> and nothing more. My app would check if there is anything new and read
>>>>>> it out.
>>>>>> There are around 1500/sec (at 250kbit) can frames on the bus when the
>>>>>> problem arise, I think it's not that much.
>>>>>
>>>>> Are you writing the can frames to storage in the same thread as
>>>>> receiving them?
>>>>
>>>>
>>>> No, CAN has it's own thread, which is just making struct from can
>>>> messages (reading via select() ) and writes them into another buffer.
>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>> messages into RAM, and when I don't need to record CAN frames anymore, I
>>>> write all of them to card from this big buffer.
>>>> But this is just limited workaround because I'm limited with the RAM
>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>> are stored, older are overwritten when the buffer is full).
>>>
>>> Have you setup realtime priorities for you CAN thread?
>> No, I did't set up any special attributes. Do you mean I should use
>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>
> or better SCHED_FIFO for your can thread.
Hello Marc,
I tried that and still when I write
dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
SD card) around 300 CAN frames (from 68500 frames) are lost :(
Martin
> Marc
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-31 13:29 ` Martin Kozusky
@ 2012-05-31 13:42 ` Marc Kleine-Budde
2012-05-31 16:28 ` Oliver Hartkopp
2012-06-01 6:19 ` Martin Kozusky
0 siblings, 2 replies; 20+ messages in thread
From: Marc Kleine-Budde @ 2012-05-31 13:42 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]
On 05/31/2012 03:29 PM, Martin Kozusky wrote:
> Dne 30.5.2012 16:18, Marc Kleine-Budde napsal(a):
>> On 05/30/2012 03:26 PM, Martin Kozusky wrote:
>>> Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
>>>> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>>>>> The best for me would be some kernel module which would just put
>>>>>>> the CAN
>>>>>>> frame into some big "from userspace available" buffer in the
>>>>>>> interrupt
>>>>>>> and nothing more. My app would check if there is anything new and
>>>>>>> read
>>>>>>> it out.
>>>>>>> There are around 1500/sec (at 250kbit) can frames on the bus when
>>>>>>> the
>>>>>>> problem arise, I think it's not that much.
>>>>>>
>>>>>> Are you writing the can frames to storage in the same thread as
>>>>>> receiving them?
>>>>>
>>>>>
>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>> anymore, I
>>>>> write all of them to card from this big buffer.
>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>> are stored, older are overwritten when the buffer is full).
>>>>
>>>> Have you setup realtime priorities for you CAN thread?
>>> No, I did't set up any special attributes. Do you mean I should use
>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>
>> or better SCHED_FIFO for your can thread.
> Hello Marc,
> I tried that and still when I write
> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
> SD card) around 300 CAN frames (from 68500 frames) are lost :(
http://man7.org/linux/man-pages/man2/recvmmsg.2.html
Maybe you can use recvmmsg(). I don't know if it works already on can
sockets.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-31 13:42 ` Marc Kleine-Budde
@ 2012-05-31 16:28 ` Oliver Hartkopp
2012-06-01 8:12 ` Martin Kozusky
2012-06-01 6:19 ` Martin Kozusky
1 sibling, 1 reply; 20+ messages in thread
From: Oliver Hartkopp @ 2012-05-31 16:28 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can
>>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>>> anymore, I
>>>>>> write all of them to card from this big buffer.
>>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>>> are stored, older are overwritten when the buffer is full).
>>>>>
>>>>> Have you setup realtime priorities for you CAN thread?
>>>> No, I did't set up any special attributes. Do you mean I should use
>>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>>
>>> or better SCHED_FIFO for your can thread.
>> Hello Marc,
>> I tried that and still when I write
>> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
>> SD card) around 300 CAN frames (from 68500 frames) are lost :(
>
> http://man7.org/linux/man-pages/man2/recvmmsg.2.html
>
> Maybe you can use recvmmsg(). I don't know if it works already on can
> sockets.
I wonder, if accessing the MMC/SD card leads to a long-time blocking of
interrupts and therefore lost frames on controller level.
Looks like the flexcan RX FIFO overflow is documented here:
http://lxr.linux.no/#linux+v3.4/drivers/net/can/flexcan.c#L603
Martin, can you check the overflow counters with
ifconfig can0
or
ip -statistics link show can0
after the problem with writing to the MMC/SD card showed up?
Regards,
Oliver
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-31 13:42 ` Marc Kleine-Budde
2012-05-31 16:28 ` Oliver Hartkopp
@ 2012-06-01 6:19 ` Martin Kozusky
1 sibling, 0 replies; 20+ messages in thread
From: Martin Kozusky @ 2012-06-01 6:19 UTC (permalink / raw)
To: linux-can
Dne 31.5.2012 15:42, Marc Kleine-Budde napsal(a):
> On 05/31/2012 03:29 PM, Martin Kozusky wrote:
>> Dne 30.5.2012 16:18, Marc Kleine-Budde napsal(a):
>>> On 05/30/2012 03:26 PM, Martin Kozusky wrote:
>>>> Dne 30.5.2012 15:18, Marc Kleine-Budde napsal(a):
>>>>> On 05/30/2012 02:50 PM, Martin Kozusky wrote:
>>>>>>>> The best for me would be some kernel module which would just put
>>>>>>>> the CAN
>>>>>>>> frame into some big "from userspace available" buffer in the
>>>>>>>> interrupt
>>>>>>>> and nothing more. My app would check if there is anything new and
>>>>>>>> read
>>>>>>>> it out.
>>>>>>>> There are around 1500/sec (at 250kbit) can frames on the bus when
>>>>>>>> the
>>>>>>>> problem arise, I think it's not that much.
>>>>>>>
>>>>>>> Are you writing the can frames to storage in the same thread as
>>>>>>> receiving them?
>>>>>>
>>>>>>
>>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>>> anymore, I
>>>>>> write all of them to card from this big buffer.
>>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>>> are stored, older are overwritten when the buffer is full).
>>>>>
>>>>> Have you setup realtime priorities for you CAN thread?
>>>> No, I did't set up any special attributes. Do you mean I should use
>>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>>
>>> or better SCHED_FIFO for your can thread.
>> Hello Marc,
>> I tried that and still when I write
>> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
>> SD card) around 300 CAN frames (from 68500 frames) are lost :(
>
> http://man7.org/linux/man-pages/man2/recvmmsg.2.html
>
> Maybe you can use recvmmsg(). I don't know if it works already on can
> sockets.
I'm already using this Marc, it helped only a little :(
Martin
> Marc
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-05-31 16:28 ` Oliver Hartkopp
@ 2012-06-01 8:12 ` Martin Kozusky
2012-06-01 11:22 ` Oliver Hartkopp
0 siblings, 1 reply; 20+ messages in thread
From: Martin Kozusky @ 2012-06-01 8:12 UTC (permalink / raw)
To: linux-can
Dne 31.5.2012 18:28, Oliver Hartkopp napsal(a):
>
>>>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>>>> anymore, I
>>>>>>> write all of them to card from this big buffer.
>>>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>>>> are stored, older are overwritten when the buffer is full).
>>>>>>
>>>>>> Have you setup realtime priorities for you CAN thread?
>>>>> No, I did't set up any special attributes. Do you mean I should use
>>>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>>>
>>>> or better SCHED_FIFO for your can thread.
>>> Hello Marc,
>>> I tried that and still when I write
>>> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
>>> SD card) around 300 CAN frames (from 68500 frames) are lost :(
>>
>> http://man7.org/linux/man-pages/man2/recvmmsg.2.html
>>
>> Maybe you can use recvmmsg(). I don't know if it works already on can
>> sockets.
>
>
> I wonder, if accessing the MMC/SD card leads to a long-time blocking of
> interrupts and therefore lost frames on controller level.
>
> Looks like the flexcan RX FIFO overflow is documented here:
> http://lxr.linux.no/#linux+v3.4/drivers/net/can/flexcan.c#L603
>
> Martin, can you check the overflow counters with
>
> ifconfig can0
>
> or
>
> ip -statistics link show can0
>
> after the problem with writing to the MMC/SD card showed up?
Hello Oliver,
I just configured can0 with canconfig (speed to 250kbs) and canconfig
can0 start
(BTW: what does "can0 state: ERROR-ACTIVE" mean after I write canconfig
can0 start? )
Then I started sending CAN packets. I sent 39660 packets to CAN, but
only 35734 were received by the CAN layer?
this is what is shown (without any app running)
root@vmx25 /opt$ ./ip -statistics link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
mode DEFAULT qlen 10
link/can
RX: bytes packets errors dropped overrun mcast
280440 35734 6 0 6 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
And this is show when I copy 5MB to SD card with dd. This time 39347
packets where sent from my app.
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN
mode DEFAULT qlen 10
link/can
RX: bytes packets errors dropped overrun mcast
152197 19335 21 0 21 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
Should I try to backport the latest flexcan.c to my 2.6.39 kernel and
see if it helps?
Martin
> Regards,
> Oliver
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: can4linux compilation for i.mx25 under 2.6.39
2012-06-01 8:12 ` Martin Kozusky
@ 2012-06-01 11:22 ` Oliver Hartkopp
0 siblings, 0 replies; 20+ messages in thread
From: Oliver Hartkopp @ 2012-06-01 11:22 UTC (permalink / raw)
To: Martin Kozusky; +Cc: linux-can Mailing List
On 01.06.2012 10:12, Martin Kozusky wrote:
> Dne 31.5.2012 18:28, Oliver Hartkopp napsal(a):
>>
>>>>>>>> No, CAN has it's own thread, which is just making struct from can
>>>>>>>> messages (reading via select() ) and writes them into another buffer.
>>>>>>>> Then the main thread reads this buffer and writes to SD card. Now I
>>>>>>>> changed it so that this buffer is 30MB big, so I first store all the
>>>>>>>> messages into RAM, and when I don't need to record CAN frames
>>>>>>>> anymore, I
>>>>>>>> write all of them to card from this big buffer.
>>>>>>>> But this is just limited workaround because I'm limited with the RAM
>>>>>>>> size (so I had to make the buffer cyclic and just latest xxxx messages
>>>>>>>> are stored, older are overwritten when the buffer is full).
>>>>>>>
>>>>>>> Have you setup realtime priorities for you CAN thread?
>>>>>> No, I did't set up any special attributes. Do you mean I should use
>>>>>> pthread_attr_setschedpolicy(ptr,SCHED_RR) or something else?
>>>>>
>>>>> or better SCHED_FIFO for your can thread.
>>>> Hello Marc,
>>>> I tried that and still when I write
>>>> dd if=/dev/zero of=/mnt/mmcblk0p1/test bs=512 count=10000 (copy 5MB to
>>>> SD card) around 300 CAN frames (from 68500 frames) are lost :(
>>>
>>> http://man7.org/linux/man-pages/man2/recvmmsg.2.html
>>>
>>> Maybe you can use recvmmsg(). I don't know if it works already on can
>>> sockets.
>>
>>
>> I wonder, if accessing the MMC/SD card leads to a long-time blocking of
>> interrupts and therefore lost frames on controller level.
>>
>> Looks like the flexcan RX FIFO overflow is documented here:
>> http://lxr.linux.no/#linux+v3.4/drivers/net/can/flexcan.c#L603
>>
>> Martin, can you check the overflow counters with
>>
>> ifconfig can0
>>
>> or
>>
>> ip -statistics link show can0
>>
>> after the problem with writing to the MMC/SD card showed up?
>
> Hello Oliver,
> I just configured can0 with canconfig (speed to 250kbs) and canconfig can0 start
> (BTW: what does "can0 state: ERROR-ACTIVE" mean after I write canconfig can0
> start? )
>
> Then I started sending CAN packets. I sent 39660 packets to CAN, but only
> 35734 were received by the CAN layer?
>
> this is what is shown (without any app running)
>
> root@vmx25 /opt$ ./ip -statistics link show can0
> 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10
> link/can
> RX: bytes packets errors dropped overrun mcast
> 280440 35734 6 0 6 0
> TX: bytes packets errors dropped carrier collsns
> 0 0 0 0 0 0
>
> And this is show when I copy 5MB to SD card with dd. This time 39347 packets
> where sent from my app.
>
> 2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10
> link/can
> RX: bytes packets errors dropped overrun mcast
> 152197 19335 21 0 21 0
> TX: bytes packets errors dropped carrier collsns
> 0 0 0 0 0 0
>
Well this seems to prove my assumption that you get overruns in the flexcan RX FIFO
when you access the SD card :-(
> Should I try to backport the latest flexcan.c to my 2.6.39 kernel and see if
> it helps?
In general a backport is a good idea (and should be pretty easy) - there are
only four fixes to apply - especially the irq flooding fix is recommended:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=history;f=drivers/net/can/flexcan.c
But i think you will still have the overruns shown up in your output above.
No matter if you use the Mainline flexcan driver or if you would use any
other flexcan driver. :-(
It really looks like the the SD card access blocks the interrupts in a way
the the frames are overwritten inside the controller itself as no-one gets
the CAN frames from the RX FIFO in time.
Don't know if there's anything that could be done with the interrupt
subsystem in Linux to solve this.
@Marc: Is there something that can be done ...
- with or without NAPI
- by increasing the flexcan RX FIFO
- with interrupt priorities on the i.mx25 ??
Regards,
Oliver
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-06-01 11:23 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-30 11:39 can4linux compilation for i.mx25 under 2.6.39 Martin Kozusky
2012-05-30 11:50 ` Marc Kleine-Budde
2012-05-30 12:05 ` Martin Kozusky
2012-05-30 12:08 ` Martin Kozusky
2012-05-30 12:18 ` Marc Kleine-Budde
2012-05-30 12:34 ` Martin Kozusky
2012-05-30 12:37 ` Marc Kleine-Budde
2012-05-30 12:16 ` Marc Kleine-Budde
2012-05-30 12:29 ` Martin Kozusky
2012-05-30 12:40 ` Marc Kleine-Budde
2012-05-30 12:50 ` Martin Kozusky
2012-05-30 13:18 ` Marc Kleine-Budde
2012-05-30 13:26 ` Martin Kozusky
2012-05-30 14:18 ` Marc Kleine-Budde
2012-05-31 13:29 ` Martin Kozusky
2012-05-31 13:42 ` Marc Kleine-Budde
2012-05-31 16:28 ` Oliver Hartkopp
2012-06-01 8:12 ` Martin Kozusky
2012-06-01 11:22 ` Oliver Hartkopp
2012-06-01 6:19 ` Martin Kozusky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).