LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

The second time I use viWrite to communicate by USB gives an error

 
0 Kudos
Message 1 of 5
(3,944 Views)

Hi Paul Bros,

Could you be a little more explicit about the problem? Screenshot of the error or code you use?

Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 2 of 5
(3,925 Views)

Hi Julien,

I use the following functions to communicate with my ATMEL AT91SAM7S64 application.

I used nivisa development driver succesfull. I can see my USBapplication by the program "Test and measurement".

I use after I opened my appication and USB device

printf("USB1 Interrupt Event\n");
   zend_buf[0]=stx;
    zend_buf[1]=35+48;
    zend_buf[2]=0+48;
    Zet_Xor(3);
    zend_buf[4]=dle;
    zend_buf[5]=etx;
    memset(&ontvang_buf[0],0,100);start_pos=0;aantal_char=6;

    receivedreplyisOK==FALSE;
    retnCount=VI_SUCCESS;
    status=viWrite(instr,zend_buf ,aantal_char,retnCount);

 

status = viInstallHandler (instr, VI_EVENT_USB_INTR, usbHndlr,0);      
 status = viEnableEvent (instr, VI_EVENT_USB_INTR, VI_HNDLR, VI_NULL);

while(receivedreplyisOK==FALSE)

//correct reply from ATMEL received

printf("USB2 Interrupt Event\n");
   zend_buf[0]=stx;
    zend_buf[1]=35+48;
    zend_buf[2]=0+48;
    Zet_Xor(3);
    zend_buf[4]=dle;
    zend_buf[5]=etx;
    memset(&ontvang_buf[0],0,100);start_pos=0;aantal_char=6;
    retnCount=VI_SUCCESS;
    status=viWrite(instr,zend_buf ,aantal_char,retnCount);

After USB1 Interrupt Event is transmitted

The message is received by the ATMEL uP and he arrage a reply with data. This datastring is received by the host perfectly.

When I do the viWrite again (USB2 Interrupt Event is transmitted) I get the following error on the screen.

"Could not perform operation because I/O error"

When I place the

status = viInstallHandler (instr, VI_EVENT_USB_INTR, usbHndlr,0);      
 status = viEnableEvent (instr, VI_EVENT_USB_INTR, VI_HNDLR, VI_NULL);

before the first viWrite opeartion there is no reply from the ATMEL.Why is this happening, I suppose that the activation of the viInstallHandler and viEnableEvent

infuent the viWrite operation and is that the reason why it works fine time and the second time not. Could it be that there must be a Flag resetting before I use viWrite?

 

With regards

 

Paul

 

0 Kudos
Message 3 of 5
(3,911 Views)

Paul,

Have you any error code? It could help us. thanks

Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 4 of 5
(3,868 Views)
Hi all,

We're beginning to develop a system on ATMEL AT91SAM7S-EK Evolution Board, but we have some problems about the usb driver created by the NI-VISA Driver Wizard version 4.1. We created this usb driver following the instruction reported in "Control your USB Device".
Plugging-in the hardware and trying to complete the installation, the OS (Windows XP) gives us the following error message:

It is impossible to run the device (Code 10).

Checking the Windows Device Manager, the hardware comes up with the yellow esclamation mark.

Can you help us?

Many thanks.

Maurizio G.
0 Kudos
Message 5 of 5
(3,750 Views)