USBDev_SendPacket(1, @USBbuffer, 64) question

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

USBDev_SendPacket(1, @USBbuffer, 64) question

#1 Post by phil31 » 25 Mar 2016 18:12

Dear all

i play with the USB device library from the libstock, and PIC32MX450F256H.
i need to send to the host about 512 bytes.

as i read, the maximum packet size is 64 bytes, so i need to send 8 packets.
i tried in a loop with the "USBDev_SendPacket(1, @USBbuffer, 64)" procedure.
but it seem that i loose some bytes during the transaction :(

Please, how can i be sure that the packet is send, then i can send the next one ?

Thanks, best regards
Phil

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: USBDev_SendPacket(1, @USBbuffer, 64) question

#2 Post by uros.cvetinovic » 28 Mar 2016 15:58

Hi Phil,

Unfortunately, we didn't test USB device library with packages which size is larger than 64 bytes.
Library is written to work within FS USB specification, therefore we can't recommend you sending packets larger than 64 bytes,
because FS USB specification allows packets with maximum sizes of 64 bytes.

It's possible to send larger packages without any loss, but it simply can't be guaranteed within the specification, so we haven't tested it.

Best regards,

Uros

r0driguw
Posts: 8
Joined: 15 May 2015 21:47

Re: USBDev_SendPacket(1, @USBbuffer, 64) question

#3 Post by r0driguw » 28 Mar 2016 19:40

Hi Phil,

There is a function USBDev_DataSentHandler(uint8_t ep) called when the packet is sent.

In my application I set a flag on this function to allow others packets to be sent.

Regards,

Rodrigo

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: USBDev_SendPacket(1, @USBbuffer, 64) question

#4 Post by phil31 » 29 Mar 2016 13:27

Hi All,

- ME team : as often, you read too fast ...

- Rodrigo : yes i found this DataSentHandler procedure, and try exactly as you suggest..
but unfortunately, was unlucky .. maybe a problem in my code, was late in the night !
thanks for you confirmation, will check it again

regards

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: USBDev_SendPacket(1, @USBbuffer, 64) question

#5 Post by uros.cvetinovic » 30 Mar 2016 14:48

Hi,

I just wanted to say that we can not guarantee that there wouldn't be data lost when sending packages larger than 64 bytes,
although there is a function USBDev_RegisterDataSentHandler().

As I mentioned before, unfortunately, we didn't test USB device library with packages which size is larger than 64 bytes.

But there are users, just like Rodrigo, who implemented a way to set a flag on this function to allow other packages to be sent.

Best regards,

Uros

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: USBDev_SendPacket(1, @USBbuffer, 64) question

#6 Post by phil31 » 31 Mar 2016 22:54

Uros,

as just want to say that you read too fast too !

i didn't say that a send packet larger than 64 bytes !!
i try to send multiples packet of 64 bytes EACH ! .. 8 packets of 64 bytes each ..

need to investigate more with the DataSentHandler procedure

regards

Post Reply

Return to “mikroBasic PRO for PIC32 General”