PDA

View Full Version : Qt5 & STM32F407 Discovery Board



VeronicaPKTEC
4th March 2015, 16:54
Hi,
I would like to know, if someone did a Qt Gui for the discovery STM32F407 Board and can help me. I want to do a USB OTG FS communication between PC and the microcontroller. With Coocox IDE I could build an example to push the blau Botton and activate/disactivate a LED. Now I would like to show it in the GUI, but I don't find an easy example, where I can start to understand how to do it.

I start with a Qt5 in Windows 8.1. I saw in Internet I have to install for example libus-win32. I could downloaded it, and try to use Zadig to install it, but I do not have the Vendor/Product ID (I found 4 examples with 4 different numbers)..... For this reason I can not install it. That is the first problem. Someone could help me???
I copied the file libusb0.dll in C:\Windows\System32 and the file libusb0.sys in C:\Windows\System32\drivers.
Then I try to use an example in Qt C++ with the file usbd_cdc_ucp.c, but the example was not completed and of course I got a lot of errors.

I only want to understad how I can get a communication between PC (GUI Qt) <-> STM32F4.
Thank you in advance for your help.
Regards
Vero

anda_skoa
5th March 2015, 08:10
Which programming language did you use before, which libraries did that use?

Cheers,
_

VeronicaPKTEC
10th March 2015, 08:25
Hi anda_skoa,
I do not understand your question. I am beginner and I do not find some information about it.
This will be my first project with usb libraries.
Regards
Vero

anda_skoa
10th March 2015, 11:41
You wrote that you already had a working solution using some IDE.

Depending on what language was used there the same libraries and maybe even code could potentially be used with Qt as well.

Cheers,
_

VeronicaPKTEC
11th March 2015, 13:33
Hi again,
I programm all in C++. In the Coocox program I use some USB libraries to communicate with the USB. If the PC (through the GUI) send for example 0x33, the orange LED on the Discovery Board switch on/off. The MCU works like a VCP and I tested with Hercules (http://www.hw-group.com/products/hercules/index_es.html) and the serial communication works fine.

I also could install the libusb-win32 in Windows 8.1. I see my MCU in manager device :)

I only need to do the part of the GUI in Qt. I found an example in youtube. The person, who did this example, uses threads and I can not see all the code: https://www.youtube.com/watch?v=EoE8QPeApxk

Do you know a tutorial about USB communication with libusb-win32 for Qt5, or an small example where I can learn how to do it?
I want to send for example the 0x33 to activate the led or receive some data for a sensor through the MCU.

Thank you for your help!!!!

Cheers
Vero

anda_skoa
11th March 2015, 13:51
Why not use the libraries for which you already have a working solution?

Any specific reason you want to reimplement the USB communication manually?

Cheers,
_

Lesiok
11th March 2015, 14:01
Qt is not a magic - Qt is C++ library. So take Qt and "some USB libraries" and all.

VeronicaPKTEC
25th March 2015, 08:26
After 3 weeks reading about USB communication, doing Qt tutorials and understanding some examples with libusb library, I finally got the USB communication PC <-> MCU. In the PC I use Qt to do my GUI and in the MCU (STM32F4) I use Coocox. Qt and Coocox are open source software.

For the beginners like me, some tips:

- Qt course from VoidRealms in Youtube: https://youtu.be/6KtOzh0StTc
He has more than 100 video-tutorials. I learnt a lot with this videos!!!!!

- Some examples using libusb and Qt (thanks google to help me to translate them):
1. Japanese tutorial about libusb-win32 and Qt: http://www.cnblogs.com/lknlfy/tag/USB%E5%AD%A6%E4%B9%A0/
2. Russian tutorial also about libusb-win32 and Qt. You can download the files and see how they read signals from MCU: http://we.easyelectronics.ru/khomin/stm32-usb-qt-libusb-shablon-proekta.html
3. Example "STM32 LibUSB & Qt example" in youtube. It is only to understand the concept, but you do not have all the code: https://youtu.be/EoE8QPeApxk
4. The example from the libusb-win32 library, bulk.c.

- About USB Theory, there are a lot of information in Internet. My recommendation:
1. Embedded USB, a brief tutorial: http://www.computer-solutions.co.uk/info/Embedded_tutorials/usb_tutorial.htm
2. USB made simple: http://www.usbmadesimple.co.uk/
3. USB in a NutShell: http://www.beyondlogic.org/usbnutshell/usb1.shtml
4. USB Standard Site: http://www.usb.org/home

- I've got a couple of books from the library (sorry, in German):
1 . Messen und Steuern, USB und C++ (with some Qt examples)
2. USB 2.0, Handbuch für Entwickler.

Note:
@anka_skoa. Thanks for your help. The problem was, I did not know, how to implement the libraries with a USB solution. But now I know how to do it. You can close the post.
@Lesiok , I know Qt is not a magic. I only needed some help to start with it, because I am a beginner not an advanced user like you :p

Regards,
Vero

VeronicaPKTEC
25th March 2015, 08:48
Hi Lesiok,
I know Qt is not a magic, but I am a beginner and not an advanced user like you. I only needed some help to understand how Qt is working with the USB libraries.
Now I got it, after 3 weeks looking for the information in internet, doing some Qt video tutorials and reading some USB communication books.
I would like to tell you thank you, but you were not helping me.

USB communication is not easy and there are not a lot of examples for the beginners like me. The USB 2.0 specification has 650 pages!!!!
There are also not information how to get working the USB libraries inside Qt.

My recommendations to help someone are:

- Video-Tutorials in youtube to learn Qt: https://youtu.be/6KtOzh0StTc

- Examples to work with Qt and libusb (thanks google to help me to translate them!!!):
1. Japanese tutorial: http://www.cnblogs.com/lknlfy/tag/USB%E5%AD%A6%E4%B9%A0/
2. Russian tutorial with Code: http://we.easyelectronics.ru/khomin/stm32-usb-qt-libusb-shablon-proekta.html
3. Video example STM32, libusb & Qt (it is not complete, because you do not have all the code. But you can have the idea, how is working): https://youtu.be/EoE8QPeApxk

- Internet USB Information:
1. USB made simple: http://www.usbmadesimple.co.uk/
2. Embedded USB - a brief tutorial : http://www.computer-solutions.co.uk/info/Embedded_tutorials/usb_tutorial.htm
3. USB in a Nutshell: http://www.beyondlogic.org/usbnutshell/usb1.shtml

- I read some german books about USB:
1. Messen und Steuern mit USB und C++ (with some Qt examples).
2. USB 2.0, Handbuch für Entwickler.

Regards
Vero