Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

LIN API with C++ in MFC Application

Hi
 
I am using the LIN API library nicanmsc.lib and Nican.h file to work with the MFC application that I am writing in Visual C++ 6.0.
 
The problem i am encounter with one the API of Nican.h  called  "ncWrite(NCTYPE_OBJH          ObjHandle,
                           NCTYPE_UINT32        SizeofData,
                           NCTYPE_ANY_P         Data)"
 
As this API is used to configure the LIN Interface Slave task to configure or subscribe the data.To do that you have to have frame type is response Entry frame and  one of Data Type called "Is Remote " value equal to 16. Now I am doing exactly same things to achieve configure response entry frame to send data from slave based on the ID from master. As I am able to run this API from my application and its executing correctly and sending correct information that I want to send to Master but the problem I am seeing is that when you execute any of this API it comes with STATUS  back of the execution part went correctly on not based on the value that it returns. In my case eventhough the command looks to me executed correctly as sending the correct data but the STATUS comes with negative value which means it has something wrong in it. I can't figure out the problem in here.
 
Let me know if you any body encounter this kind of problem before. I described you the best way i can describe the problem but if any body has more question feel free to ask it.
 
Thanks
 
Chirayu
0 Kudos
Message 1 of 14
(7,767 Views)

What is the negative number you mentioned? Did you translate this number to an error message?

Whenever the api gives you a negative number, this means that an error occured. Please post this error and the function name where the error occured first.

DirkW

0 Kudos
Message 2 of 14
(7,758 Views)

Well,

Function name As I described you first is "ncWrite".I have to check what is negative value and will let u know.But looks to me function is behaving correctly because what ever data i am trying to send as by configurig the LIN as slave devices is happening correctly.

So I have no idea why it is giving me error message.And This is only happening in my Application which is written in MFC C++.I have example program which is pure C and in that it returns no negative status. So that make confusion bigger.

I will let you know the code as soon as I find out.

Thanks

Chirayu

0 Kudos
Message 3 of 14
(7,755 Views)
OK attached is the Error code and Message that it will print if we print the status information in String form.Its .jpeg  file.let me know if you have any trouble to open the file.
 
Thanks
 
Chirayu
0 Kudos
Message 4 of 14
(7,747 Views)
Multiple duplicate posts.  Please see the following links for more information on this issue.
 
 
Scott G.
AE Specialist
National Instruments
0 Kudos
Message 5 of 14
(7,731 Views)
Hi,
 
There must be something wrong with your frame type. Is the frame type (IsRemote) really dezimal 16. Perhaps you configured it in hex 16 and then it translates to d22?
Could you perhaps enable Error Logging to receive an Error frame with detailed error information?
 
DirkW
0 Kudos
Message 6 of 14
(7,718 Views)

Hi,

Thanks for your reply..

Well, I am using decimal 16.It is sending the frame data as well as check sum correctly as I can verify that but Status coming back is negative because of some reason.I had a Error logging also enable.So the message i think its detailed  message that its coming with.

Let me know if you any idea that I can try else.

Thanks

Chirayu

0 Kudos
Message 7 of 14
(7,713 Views)
Hi,
Could you please debug which function call brings the error first? Is it the slave execution or the master which sends the header frame?
Are you sure the header has the same id as published from the slave?
 
DirkW
0 Kudos
Message 8 of 14
(7,699 Views)
Hi,
 
Well Error is generated by "ncWrite" Command all other command works fine. In this application the Master is generating the Header and ID and the Slave is reponding with response frame based on the ID. ID value is 16. Ya header has same id because i can debug through and as soon as ncwrite executed it adds the data to the whole frame.The Data is 100% correct but and the same slave can read with read command that frame but ncwrite comes with negative status error messag.
 
Let me know if you have any thing I can try or you think might creat the problem
 
Thanks
 
Chirayu
0 Kudos
Message 9 of 14
(7,691 Views)

Could you post a small example showing what you are doing and which should reproduce the error?

Thanks

DirkW

0 Kudos
Message 10 of 14
(7,681 Views)