Re: seek for help on Libusb & STM32

Pradeepa Senanayake <[email protected]>
Newsgroups gmane.comp.lib.libusb.devel.windows
Message-ID <CA+1tQ73odz9dq-f76zN5O09jWZ2DGXs==iQnb-dJ_6yPoaZT9A@mail.gmail.com>
Best regards,
Pradeepa Senanayake.
On Mar 10, 2014 10:08 PM, "Pradeepa Senanayake" <[email protected]>
wrote:

> Hello Xiudong,
>
> There is nothing wrong in your english. Your requirement is crystal clear.
> Using VCP it is hard to achieve that speed. So the best way you can tackle
> the issue would be to implement a custom class. This can be done easyly by
> changing the descriptors in your CDC example too.
>
> The easiest way is to have one interface. Within that interface have one
> bulk in and one bulk out endpoints. If you need you can have another bulk
> out endpoint to send any commands. That you should decide.
>
> In the CDC example by ST there are plenty of class specific coding. You
> will have to carefully remove them. There will be a few functional
> descriptors too that you will have to remove. ( I assume that you know USB
> basics. If  not please refer to websites like 'usb in a nutshell' or 'usb
> made simple' )
>
> Obviously bulk.c will not work with your current USB configurations.
> Because it is expecting a bulk in and out endpoints in your interface 0.
> But your interface 0 only contains one interrupt endpoint. That should be
> the reason why it is failing.
> Start by changing the firmware in the discovery board. Implement a vendor
> specific class.
>
> I m just giving you a overall view of the matter. Attempt the changes and
> if you come across any issue please don't hesitate to send a mail.
>
> Thank you,
> Best regards,
> Pradeepa Senanayake.
> On Mar 10, 2014 12:18 PM, "Duan Xiudong" <[email protected]> wrote:
>
>> Hello   Pradeepa,
>>
>> I'm glad you can reply. Thank you very much for your instruction.
>>
>> Maybe I didn't made it clear. My application do something like data
>> sampling and acquiring. These data should be sent to PC with a speed of
>> 500KByte/s or even higher. As you know, it is difficult for  VCP to
>> reach such a high speed. I guess it might be possible using USB bulk
>> transport directly instead of VCP. And that is why I want to apply
>> LibUSB in my application.
>>
>> I got another link of discussion between you and another guy
>>
>> http://libusb.6.n5.nabble.com/LibUSB-and-the-STM32F4-Discovery-td5712505.html#a5712516
>>
>> After reading this, I think my problem might be inside the device
>> firmware. I changed it from ST official VCP demo project.(I change only
>> a little, just delete those don't match STM32F4 Discovery board.) Though
>> it can work as a COM port, it might not fit with the Libusb example code(
>> bulk.c in libusb-win32-1.2.6 zip file from official website).
>>
>> As I had learned, there're 2 interfaces in CDC class. One has a interrupt
>> EP for CMD, the other has 2 bulk EPs for Data. If I want to use the libusb
>> bulk read function to get data, what change should I make to the firmware?
>> Should I delete the former interface? I'm totally new to USB and CDC. I
>> hope you can give further advises.
>>
>> As you might figure out, my English is not very good. And there is few
>> information about Libusb in Chinese. So it is a little hard for me to
>> get help around. If you can give me some detail advises or send me some
>> example codes (if possible), I will appreciate it very much.
>>
>> Thank you once more.
>>
>> Best wishes,
>> Daniel Duan.
>>
>> PS:I just find I set my name wrong. In fact,Duan is my family name, which
>> comes first in our Chinese tradition.
>>
>>
>>
>>
>> 2014-03-10 11:30 GMT+08:00 Pradeepa Senanayake <[email protected]>:
>>
>>> Hello Duan,
>>>
>>> Since the firmware you use is for a VCP it will be enumerated within the
>>> PC side as a COM port. In that case you can directly use serial writing
>>> methods to access the device. I don't think that you need libusb in that
>>> case. But if you wan't to have lets say a Vendor Specific class with your
>>> own descriptors (ie. Endpoint types, etc. ) then LibUSB will come in handy.
>>>
>>> For your application, if COM port is enough, I would recommend using
>>> methods to access COM port rather than using LibUSB. Do a google search
>>> with keywords such as " Writing to a COM port using visual studio" and you
>>> will get plenty of hits.
>>>
>>>
>>> >>   I  learned  you had done similar works from here
>>> >> https://sourceforge.net/p/libusb-win32/mailman/libusb-win32-devel/thread/CA+1tQ71CeMubpzV2rBHPnWQ5Zcnihx1e>>>>
>>>   [email protected]/<https://sourceforge.net/p/libusb-win32/mailman/libusb-win32-devel/thread/CA+1tQ71CeMubpzV2rBHPnWQ5Zcnihx1e24_1wqFHicofGqsi0Q@mail.gmail.com/>
>>>
>>> In the above link, he is not using VCP. That is why it is easier to use
>>> LibUSB. I'm just a LibUSB user (not a developer) so the devs will correct
>>> me if I am wrong.
>>>
>>> Please refer to this discussion,
>>>
>>>  http://sourceforge.net/p/libusb-win32/mailman/message/31338949/
>>>
>>> it will hopefully clear most of the doubts.
>>>
>>> Hope I helped.
>>>
>>> Thank you,
>>>
>>>
>>>
>>> Best Regards,
>>> Pradeepa Senanayake.
>>>
>>>
>>> On Sun, Mar 9, 2014 at 2:22 PM, Duan Xiudong <[email protected]>wrote:
>>>
>>>> Hello   Pradeepa,
>>>>
>>>>      I am a student form China. I'm trying to get some data  using USB
>>>>  from a board based on STM32F4xx chips. Right now I'm trying it on  a
>>>> STM32F4discovery  board.
>>>>
>>>>     On  the  device side,  I  implement a  Virtual COM Port project
>>>> form ST firmware.It can work well as a COM port with PC.
>>>>
>>>>     And now I download  libusb-win32-1.2.6 , generate and install the
>>>> drivers (INF file) as  it requires. Then I  test  it on VS  using the
>>>> example code from the official  website. It seems  that PC can get the
>>>> configuration information correctly,  but can not execute  any bulk_read
>>>> operation. When it runs to * usb_bulk_read()* or *usb_submit_async()*
>>>> function, the program ends with error.
>>>>
>>>>     I  don't  know where the problem is.  Is there any problem  on PC
>>>> side codes?  OR something  wrong  with device firmware? It puzzled me a lot.
>>>>
>>>>        I  learned  you had done similar works from here
>>>>
>>>> https://sourceforge.net/p/libusb-win32/mailman/libusb-win32-devel/thread/CA+1tQ71CeMubpzV2rBHPnWQ5Zcnihx1e24_1wqFHicofGqsi0Q@mail.gmail.com/
>>>>
>>>>       I hope you can give me some instructions. If you're kindly  to
>>>> offer some help, I will give more details.
>>>>       Thank you very much!  Hope  for  your  reply.
>>>>
>>>> --
>>>> Daniel
>>>>
>>>
>>>
>>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

_______________________________________________
Libusb-win32-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.