PDA

View Full Version : QT and USB



giorgik
22nd July 2012, 18:26
Hello everyone!
I have a device controlled by a microcontroller PIC18F4550 that has USB and I can manage it via a GUI made ​​with Qt 4.8.2.
How can I write a GUI program with Qt to read and write bytes vattraverso USB ?

kuzulis
23rd July 2012, 18:36
In Qt, there are no classes to support USB. Plug and use libusb.

giorgik
23rd July 2012, 19:14
kuzulis, the code written in "Windows USB example" of gavagai is a viable alternative?

kuzulis
24th July 2012, 07:58
Perhaps, but on condition that your USB device is well-defined system, ie has installed the driver.

giorgik
24th July 2012, 11:36
Yes kuzulis, I should have the driver, I use the Microchip PIC18F4550 which provides the framework IDE for the C18.

giorgik
24th July 2012, 18:10
I do not know where to start :(
I have several circuits with the Microchip PIC18F4550 found on the internet, but are incomplete because of missing firmware for the PIC or how to write the code under Windows XP using Qt interface via USB to PIC.
Can anyone give me a help to build a simple example ?
I can provide circuit diagrams with PIC (PIC as a compiler from the use Microchip C18). On the PC I have Windows XP and how to use Qt Creator IDE 2.5.0

gavagai
2nd August 2012, 23:56
- Download the Microchip application libraries (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en547784) from Microchip site. There you find a lot of USB firmwares examples for PIC18
- Set the firmware to work like HID device
- Use my "Windows USB example" to interface to Qt libraries.

giorgik
3rd August 2012, 12:12
Hello,
So I partially solved using the framework as you said Microchip Microchip Solutions v2012-04-03 and then I followed what had been written using this site Building_a_PIC18F_USB_device.htm its firmware for the PIC18F4550. This site, however, use is made dell'mbiente Visual Studio 2010 Express using C #. Then I thought of using your code, or the one written by SteveH Source.zip you replied in your post "Windows USB example".
In your opinion which is better than Qt Software?

giorgik
19th August 2012, 17:43
Ok guys :D I solved everything by using the project:
C:\Microchip Solutions v2012-07-18\USB\Device - HID - Custom Demos\Firmware\MPLAB.X
in addition to the firmware of PIC18F4550 (which I have set myself) platform PICDEM FSUSB, I also found the project environment for Qt in C:\Microchip Solutions v2012-07-18\USB\Device - HID - Custom Demos\PnP Demo - Cross Platform Software\HID_PnP_Demo.

sHs
11th October 2012, 17:21
Hi!
I found this thread googling. I have a problem which is similar but not exactly the same.

I have a PIC18F14K50 which has an attached USB Controller. The USB Controller gets Data from an EEPROM and has to send 64 byte packages to a PC using a USB Cable. The Device is supposed to be recognized as a COM Device. So here I dont need a HID driver but a CDC driver. Luckily, the USB Controller is already programmed and is fully functional. It waits for a certain signal and then sends its data.

There is already an existing GUI made with Java which works but isnt as stable as it should be and I want to reprogram the whole thing in C++ using Qt.
For the Java GUI they used the library called RXTX-2.2pre2

Im searching the same thing but for C/C++.
I never did something like this before, so I dont really know what I need to get access to the USB Controller. I need functions like send(...), receive(...), open(), close().
I downloaded the whole Microchip application libraries and browsed them for anything useful. I was hoping for some headers and .cpp's that include the functionality that I need. That might have been a bit naive... I know...

Does anyone know how to find classes that implement the functions I need?

Thanks for reading! :)
shs

Lesiok
11th October 2012, 17:41
Since the device is seen as a COM not think of it as a USB but the RS-232 and use RS-232 library ie. qextserialport/ (http://code.google.com/p/qextserialport/)

sHs
11th October 2012, 22:54
Thanks!
That might be the thing I was looking for, I just have to check if the communication is going to work.
So, I will update this thread asap.

sHs
13th November 2012, 21:35
So, Im currently trying to get QextSerialPort to run. I am really confident that this is the right thing.
The problem thread is here (http://www.qtcentre.org/threads/52020-QextSerialPort-installation-on-Win7-fails-%28Linker-errors%29?p=232839#post232839). Maybe someone has a solution.

honestapple
2nd April 2013, 15:10
I am doing a similar thing——a DAQ system using STM32. I use the CDC driver provided by ST which simulate the USB port as a serial port, So I can recognize the device as if it is connected to serial port. I am programming for the PC GUI which responsible for displaying wave,doing FFT, etc using QT4.8.6+QWT6.0.2 on Windows.I did not find any useful code on the web. I am using the QSerialPort library which can communicate with the device, but I still confuse with the way to retrieve data and plot wave in real time. If someone know a better solution or some useful resource, please recommend it to me. Thank you very much.