i.MX8M Plus CAN FD setsockopt() fails in C code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M Plus CAN FD setsockopt() fails in C code

282 Views
abhayaugustin1
Contributor II

What is the correct function commands to open a socket , enable canfd frames and bind to the interface .The socket should receive bit rate switchcing frames.
ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on //This is the command i use to enable can interface 

Currently i am using :

socket(PF_CAN, SOCK_RAW , CAN_RAW);
setsockopt(sock, SOL_CAN_RAW, CAN_RAW_FD_FRAMES, &enable_canfd, sizeof(enable_canfd));
setsockopt is giving me error code 22 (EINVAL).


what are the correct arguements for :
socket();
setsockopt();

Tags (3)
0 Kudos
Reply
1 Reply

249 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi 

 

CAN-FD is not supported on the consumer version of i.MX 8M Plus,   it is only available  on the Industrial version.

Unfortunately on the 8MP EVK,   the consumer version  is installed,  so i.MX 8M Plus EVK not support CAN-FD feature.

 

Regards

Daniel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2141418%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX8M%20Plus%20CAN%20FD%20setsockopt()%20fails%20in%20C%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2141418%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWhat%20is%20the%20correct%20function%20commands%20to%20open%20a%20socket%20%2C%20enable%20canfd%20frames%20and%20bind%20to%20the%20interface%20.The%20socket%20should%20receive%20bit%20rate%20switchcing%20frames.%3CBR%20%2F%3Eip%20link%20set%20can0%20up%20type%20can%20bitrate%20500000%20dbitrate%202000000%20fd%20on%20%2F%2FThis%20is%20the%20command%20i%20use%20to%20enable%20can%20interface%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3ECurrently%20i%20am%20using%20%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Esocket%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3EPF_CAN%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%20SOCK_RAW%20%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%20%3CSPAN%3ECAN_RAW%3C%2FSPAN%3E%3CSPAN%3E)%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Esetsockopt%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Esock%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%20%3CSPAN%3ESOL_CAN_RAW%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%20%3CSPAN%3ECAN_RAW_FD_FRAMES%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%20%3CSPAN%3E%26amp%3B%3C%2FSPAN%3E%3CSPAN%3Eenable_canfd%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%20%3CSPAN%3Esizeof%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Eenable_canfd%3C%2FSPAN%3E%3CSPAN%3E))%3B%3CBR%20%2F%3Esetsockopt%20is%20giving%20me%20error%20code%2022%20(EINVAL).%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%3CBR%20%2F%3Ewhat%20are%20the%20correct%20arguements%20for%20%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22%22%3Esocket%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E()%3B%3CBR%20%2F%3Esetsockopt()%3B%3C%2FSPAN%3E%3CSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2143401%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX8M%20Plus%20CAN%20FD%20setsockopt()%20fails%20in%20C%20code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2143401%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ECAN-FD%20is%20not%20supported%20on%20the%20consumer%20version%20of%26nbsp%3Bi.MX%208M%20Plus%2C%26nbsp%3B%20%26nbsp%3Bit%20is%20only%20available%26nbsp%3B%26nbsp%3Bon%20the%20Industrial%20version.%3C%2FP%3E%0A%3CP%3EUnfortunately%26nbsp%3Bon%20the%208MP%20EVK%2C%26nbsp%3B%20%26nbsp%3Bthe%20consumer%20version%26nbsp%3B%20is%20installed%2C%26nbsp%3B%20so%20i.MX%208M%20Plus%20EVK%20not%20support%20CAN-FD%20feature.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E