check if device is ready to recieve

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ageurtse
Posts: 4
Joined: Sun Jan 08, 2012 10:39 am

check if device is ready to recieve

Post by ageurtse » Sat Feb 11, 2012 8:11 pm

hello is there a way to check if my device is ready to recieve the next portion of data.
i need to send 8 portion's of 128 bytes.

now i wan't to know if the device is ready to recieve the next portion of 128 byte's.

i think that my host transmits to much data to the device. so i wan't to control it by telling it to wait for the device.

but how can i do that.

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: check if device is ready to recieve

Post by ulao » Mon Feb 13, 2012 3:59 am

Well normal you wait for the host, then send 8 at a time. This is using a interrupt end point.

while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 0, 8 ); //once ready send 8 bytes
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 8, 5); // now wait for ready again and send 5 more.

I have only ever taken this up to 16 but I dont see why it wont go to 128.

while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 0, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 8, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 16, 8 );
while (!usbInterruptIsReady()){usbPoll(); } usbSetInterrupt((void *)&reportBuffer + 24, 8 );
...

Post Reply