05-20-2011 11:40 AM
Attached is a slimmed down version of my code.
05-27-2011 10:46 AM
Dennisatwork,
I'm sorry its taken so long for me to get back to you. I took a look through your code, and ran into a lot of problems. First off, the common_head.h file was not included so I had a bunch of broken items when I went to compile.
The biggest things however, were:
1) These declarations of functions are inside another function. This may have been part of your issue:
int CAN_init(void);
int write_CAN_cmd(int);
int read_CAN_cmd(int);
void set_Tx_data(const char* Tx_msg);
void Clear_data(void);
2) It seems like you try to pass two variables to the set_TX_data() when its definition only specifies one.
The second point is probably not related to your GPF, but is a problem. However, the GPF may be caused by the first one.
Check these things out and let us know how it goes.
05-27-2011 11:20 AM
1. The NI CAN example: "Transmit Receive same Port.prj" has all of these functions separate.
2. Typo - I forgot to remove "panelHandle". If that was there then I would get a compile error.
3. I will try to insert the following into the "Transmit Receive same Port.prj" - Timer10CallBack( ) function to see if the GPF happens:
Maybe you could try the same.
NCTYPE_STATE_P CurrentState = 0 ;
Status = ncWaitForState( TXRXHandle, NC_ST_WRITE_SUCCESS ,NC_DURATION_NONE, CurrentState);
05-31-2011 11:20 AM
Hi Dennisatwork,
Could you re-post your code, with the header file and any changes that you've made so far, so that we can try to reproduce this here?
05-31-2011 11:28 AM
I get a GPF using the example project "Transmit Receive same Port.prj" with
NCTYPE_STATE_P CurrentState = 0 ;
Status = ncWaitForState( TXRXHandle, NC_ST_WRITE_SUCCESS ,NC_DURATION_NONE, CurrentState);
inserted into Timer10CallBack( ) function.
06-01-2011 02:01 PM
Hi Dennisatwork,
Thanks for the additional info. It's hard to say why that's not working properly with the example either. As TJ mentioned above, if you could attach your missing header file and updated code, we'll try it on our end to see if we're able to reproduce that general protection fault that you're seeing.
06-01-2011 03:18 PM
The GPF can be reproduced with the example project.
06-02-2011 11:36 AM
Hello Dennisatwork,
I am running CVI 2010, but I could not reproduce the GPF that you are referring to from the example you referrenced. I don't actually have a CAN device to receive from, but I am using a USB-8473. Here is where I insterted the code as you specified:
...
int CVICALLBACK Timer10CallBack (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
NCTYPE_CAN_STRUCT ReceiveBuf[150];
NCTYPE_UINT32 ActualDataSize=0;
u16 i=0;
u16 j=0;
char output[15];
char CharBuff[26];
NCTYPE_STATE_P CurrentState = 0 ;
Status = ncWaitForState( TXRXHandle, NC_ST_WRITE_SUCCESS ,NC_DURATION_NONE, CurrentState);
switch (event)
{
case EVENT_TIMER_TICK:
...
I can run and send without any error. Exactly when does the GPF occur on your end?
06-02-2011 11:39 AM
The GPF happens when the program executes the ncWaitForState() function.
06-02-2011 12:36 PM
Dennisatwork,
Ok, so it happens every single time ncWaitForState() executes. I am not seeing this behavior.
Here is my setup:
What kind of hardware are you using, and what driver version do you have?