McbOpenComEx funtion of mcbc12.lib for CAN communication

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

McbOpenComEx funtion of mcbc12.lib for CAN communication

跳至解决方案
3,896 次查看
IkerL
Contributor I

Hello,

I am trying to communicate with a MPC5744P microcontroller using the function "McbOpenComEx" of the mcbc12.lib library in my Visual C++ project. I want to communicate via the Over CAN plug-in module and I am using the following connect string for the function "McbOpenComEx ":

"{C10A92C3-7D47-4FDC-94B6-64B8E5C85E01};drv=ixxat;port=1;bitrate=250000;cmdid=0x7aa;rspid=0x7aa;tmo=500".

I can not communicate with the microcontroller. Am I using the correct connect string?

Thanks,

Iker

0 项奖励
回复
1 解答
3,841 次查看
MichalH
NXP Apps Support
NXP Apps Support

Thanks for the feedback. Please mark the above answer as "correct".

Regards,
Michal

在原帖中查看解决方案

0 项奖励
回复
7 回复数
3,885 次查看
MichalH
NXP Apps Support
NXP Apps Support

Dear Iker,

yes the connect string seems good to me for the FreeMASTER-over-CAN communication. What is the error code that you get? Does the normal desktop FreeMASTER application work well with your board when using this configuration and the IXXAT interface?

Thanks,
Michal

 

0 项奖励
回复
3,881 次查看
IkerL
Contributor I

Hello Michal,

the normal FreeMASTER application (I use FreeMaster 2.0) communicates well with the board via over-CAN using the IXXAT interface. When I try to communicate with my Visual C++ application the McbOpenComEx function returns the 0x800401F0 value.

Thanks,

Iker

0 项奖励
回复
3,875 次查看
MichalH
NXP Apps Support
NXP Apps Support

Hello Iker,

this is the standard Windows error "CoInitialize has not been called.". As FreeMASTER plug-ins use the Microsoft COM+ technology, the caller thread needs to initialize it before opening the plug-ins.

Also, don't forget to call McbAttachThread() from each thread (other than the thread which has opened the port) before accessing any other Mcb methods.

Regards,
Michal

0 项奖励
回复
3,855 次查看
IkerL
Contributor I

Hello Michal,

I am still using the mcbc12.lib library and it seems after coinitializing the communication with our microcontroller is OK because the "McbOpenComEx" function returns the 0 value.

Thanks,

Iker

0 项奖励
回复
3,842 次查看
MichalH
NXP Apps Support
NXP Apps Support

Thanks for the feedback. Please mark the above answer as "correct".

Regards,
Michal

0 项奖励
回复
3,884 次查看
MichalH
NXP Apps Support
NXP Apps Support

One more point: you should upgrade to FreeMASTER 3.1 and use its mcbc30.dll library to be able to connect to target boards supporting either classic communication or the new "protocol v4" communication.

Visit https://www.nxp.com/freemaster to download the latest version.

Regards,
Michal

0 项奖励
回复
3,880 次查看
IkerL
Contributor I

Hello again Michal,

I will install FreeMaster 3.1 and I will use the mcbc30.lib library as you recommend me.

Thanks,

Iker

0 项奖励
回复