Dear All,
I am trying to setup the CAN bus for transmitting and receiving message by socketcan library. (cansend and candump)
However, the flexcan(can0) always can receive the message frame which send by itself even if I set the register "SRX_DIS" of flexcan to "1".
Would someone help me to set this up please?
Which BSP are you using? and apply all the patches?
For your information, here is the link of BSP and patches for i.MX53.
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX53_SW
Hi Jimmy,
I use the QSB BSP and modify its config for CAN bus transciveing based on mx53_loco and mx53_ard.
The CAN port could send and receive message with another CAN device. (by cantest tool)
However, it receive the message sent by itself, too. This is not normal behavior in CAN spec.
I have added all of the patches for iMX53 when I built image, especially patch about CAN bus.
Thank you and your response.
Hi,
Can you please explain how/when are you setting the srx_dis is being set?
Can you try read with memtool the FLEXCANx_MCR register? check if the SRX_DIS bit is really being set or not.
I am wondering if the feature is really implemented.(if the driver ever sets the bit)
Or if the bit is set during initialization. (It must be set during init, otherwise it may fail)
Hello,
I observed the value of srx_dis by flexcan driver (in the path /sys/devices/platform/FlexCAN.0/)
and the value 1 before and after the driver up.
Ushnek, please click Correct Answer/Helpful Answer if Ioseph Martinez answered your questions.
Thanks,
Yixing
Hi,
Did you try using /unit_tests/memtool?
if you are accessing driver /sys/devices/platform/FlexCAN.0/ I am not sure you are seeing the real srx_dis... but simply a mirrored value or variable of the driver.
With the memtool you will see the exact value on the CAN peripheral register. From ref manual addresses are
FLEXCAN-1_MCR is 53FC_8000h base + 0h offset = 53FC_8000h
FLEXCAN-2_MCR is 53FC_C000h base + 0h offset = 53FC_C000h
Please then check the actual register value and let me know.
Hi all,
I had used memtool to read register but it would print below message.
Reading 0x1 count starting at adUnhandled fault: external abort on non-linefetch (0x1018) at 0x2aac5000
dress 0x53FC8000
Bus error
So I am not sure these address could be read by memtool. Maybe these address are not in the trustzone with MMU?
By the way, I find the solution for my flexcan driver issue. According the documentation of socketcan "can.txt" point this description in section 3.2 and 6.2, I add the device flag "IFF_ECHO" in flexcan/drv.c. The echo message would not be received itself and srx_dis register could be workable, too. I don't know why flexcan source code is not add this flag in default.
After all, the srx_dis bit is workable in my board but the flexcan driver need add IFF_ECHO flag to stop receiving message sent itself.
Ushnek