cancel
Showing results for 
Search instead for 
Did you mean: 

Help transfering data to PC

pumzele
Associate II
Posted on December 12, 2011 at 08:47

Hello there,

I desperatly need help getting data from my stm32f4 to my pc.

I was thinking of using the OTG and set it up as a keyboard and transfer the data accross like that but it seems like a huge mission to transfer data. On older chips they just had an FTDI chip which was very easy to set up and use. Does anyone maybe know of an easier way to transfer data over to my Computer using the built in micro usb? Some sample code will also help a lot as the otg seems very complex

#transfer-data-using-usb #stm32f4discovery-usart-serial-us #vcp(virtual-com-port)-stm32f4 #stm32f4-usb-cdc
26 REPLIES 26
rm23
Associate II
Posted on December 12, 2011 at 11:26

You are not alone.   I have been trying for over 2 weeks now.   I have got a HID USB support example in Delphi from which you can see the STM USB mouse emulation.  

I am using EWARM kickstart on the STM side.

If I try to change the STM  HID_MOUSE_ReportDesc   (in usbd_hid_core.c) to something else - a different device page from 'Generic'-01 so that the pc system dosnt knab it as a mouse, then the Delphi prog based on JvHidControllerClass.pas dosnt see it, although the PC has it logged as a HID device that 'wont start'.

Has ANYONE modified the HID mouse emulation to a HID device that they use to communicate date to/from a PC???????????????????????????????

I have tried 3 ways to contact STMdiscovery support, but have so far been let down.

christoph_fritz
Associate II
Posted on December 12, 2011 at 13:11

You can use libusb even for windows.

pumzele
Associate II
Posted on December 12, 2011 at 13:55

What exactly do you mean?

christoph_fritz
Associate II
Posted on December 12, 2011 at 14:46

You want to know exactly what 

http://lmgtfy.com/?q=libusb

 is?

pumzele
Associate II
Posted on December 12, 2011 at 15:07

I'm currently still studying engineering and I need to know how to send data across to my pc via the usb. This is my first time using USB as communication the other micro controllers I have used use serial communication via an FTDI chip. So I am not sure what you mean... I would like some example code and which libaries I need to make it work. Like I said first time ever working with USB and first time ever using a STM chip. I basically need to capture data from ADC use the fourier transform on it and send it via usb so I can interpretd the signal in mathlab. I have done everything else but still struggeling trying to figure out how I can send a few thousand bytes via USB to my PC. I don't know where to start. Tried modifing the demo code (which uses a mose) but no luck there... Could you maybe list a few points as to what exactly I need to do to get it working? Please I am really stuck been surfing the net for answers for a few days now...

rm23
Associate II
Posted on December 13, 2011 at 01:12

Here here.   Yes Ive tried 'tinkering' with the mouse.

I have tried changing bits of the 'HID usage report'  - page/and usage to, for example

try to fool windows that I have a game controller, not a mouse.

Windows accepts that there is a HID device thats not a mouse, but says it

filed to start it error $10?!!

So my trusted? JvHidControllerClass.pas dosnt seem to recognise it - maybe this is because windows sees there is an error and refuses to pass on a trusted new HID plugin change message.

Somehow, I think that the Sirs at ST ought to help us guys (and gals?).

dreschel
Associate II
Posted on December 14, 2011 at 01:19

http://hackaday.com/tag/stm32/

http://www.micromouseonline.com/2009/12/31/stm32-usart-basics/#axzz1gSnTBtbG

http://shop.moderndevice.com/products/bub_ii

Might want to consider this approach: USART to USB-serial adaptor on the PC side. The USB-BUB is only $14. Could save a lot of grief...

Andrew Neil
Evangelist
Posted on December 14, 2011 at 02:12

''On older chips they just had an FTDI chip which was very easy to set up and use''

 

There's nothing to stop you using an FTDI chip (or equivalent)in exactly the same manner!

Or one of their ready-made cables that provide a direct, logic-level connection:

http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm

If speed and ease of implementation are your key concerns, then this may well be your best option.

USB development is

not

trivial: you need to budget significant time & study effort to gaining familiarity with USB in general, gaining familiarity with the STM32F4's specific USB implementation, and developing & debugging your own code.

pumzele
Associate II
Posted on December 14, 2011 at 07:55

Unfortunately I have to use the USB interface not only because speed is a big issue but also because my boss wants me to only use the peripherials on the chip and nothing else . So Usart is not an option. If I do find an answer I will post it up here. Thank you anyways