STM32G4 USB Link Power Management - usb

I want to use the USB 2.0 Port on an STM32G431CB as Virtual Com Port (VCP). The Device is self powered, so I need to enable the USB Link Power Management, to detect when the USB Cable is plugged in. The STM32G431 has no dedicated VBUS Pin, so according to this document [1] any 5 Volt tolerant pin with EXTI capabilities should be able to fullfill that role.
So far so good, but how do I reset the USB statemachine, when I detect, that the USB Power has been connected / the USB cable has been plugged in? I looked through several documents, but I could not find any hint, how I caould reset the USB Statemachine, when this Interrupt occurs. Is there any HAL function or something similar?
But it's even more confusing, that I can enable the Link Power Management in CubeMX, but there are no further parameters, like which Pin I'd like to use, or callback functions, etc. It's just an "enabled" or "disabled" - even the tooltip / online help is empty.
can anyone point me in the right direction?
[1] Link: https://community.st.com/s/article/FAQ-Management-of-VBUS-sensing-for-USB-device-design

Related

STM32 F407 Discovery Joystick Thrustmaster T-Flight Hotas X

I am trying to use the Thrustmaster T-Flight Hotas X joystick with my STM32 f407 Discovery board. As you know, the joystick has a USB connection, but actually I do not know how it transmits data and I do not know what kind of protocol it uses...do you have any advice?
Is there a way to connect the joystick to the board?
Yes, you can use the USB OTG port in host mode to connect your joystick.
The joystick will use USB HID protocol - this is documented in detail at usb.org. Short version: The device tells you in its "report descriptor" how the data is formatted. The data itself is transmitted via interrupt endpoint.
Unfortunately, the software side is non-trivial, as you need host mode on the MCU. Parsing the report descriptor is not required if you only ever use the same joystick model - which can be identified using the VID:PID in the device descriptor.
There should be an appnote with some example code for USB host mode on the STM website, but in order to support your joystick you probably have to make some modifications - which are rather difficult for beginners.

Read Data Across USB Port

I'm playing around with an old Trackball I purchased from Sparkfun. My trackball powers on, but it doesn't actually work. All the lights flash, and it indicates that I've left and right clicked, but the mouse on my screen does nothing.
I want to monitor the input values of the trackball across a USB port so I can track down the problem. I've looked for code I can run on Netbeans, but came up empty handed.
Please advise
You didn't specified what OS are you using. You need dedicated driver for this device. In case of Linux you would need to write your own driver for the kernel. But first you need to have specification of protocol which this device is using over usb and also usb protocol itself. It is quite sophisticated task to do...
In case of Windows there are some programs for dumping transmission between usb host (PC) and device (trackball), but at the moment I can't give you any name of such program. In case of Linux you can dump the transmission using tcpdump or wireshark commands.

Accessing specific USB ports for VB.net

New to VB.NET here.
I was wondering if there is a way to determine if there is something connected to a specific USB port. For example, I noticed that in the Device Manager under Universal Serial Bus controllers, there are Generic USB Hubs. For one of them, the Location is Port_#0001.Hub_#0003.
For what I am doing, I just want to know if something is connected to that specific USB port. It doesn't matter if it is a flash drive, USB HID, or even a microcontroller.
Thanks

External USB device interface with Xilinx Atlys board

I'm trying to interface the Mindwave (http://store.neurosky.com/products/mindwave-1) with my Altys board, through the USB UART port. The dongle I'm trying to connect is basically a wireless reciever that outputs serial data stream on the USB connection. I'm trying to read in this serial stream on the FPGA.
The problem I'm seeing is that when I try to Chipscope the UartRx pin (A16), I see no activity on it even though the dongle is supposed to send 0xAA in standby mode.
Since the FPGA does not power the dongle, I have it connected to an external power USB hub and then connect the hub to the FPGA. However I don't see any activity.
Do I need to convert the signals to another level, or invert them? I thought the EXAR chip takes care of it.
Did you try swapping RX and TX?
Did you have acces to a scope? To check you can repeatly send 'U's (0x55) and look with a scope to see which line is RX and which is TX. You can also check the speed of the interface with this method.

USB HID device detection

I am trying to access an USB HID device under Ubuntu(kernel-3.0). I want to write a program which could notify me whenever an USB device is attached to the bus i.e is there any event generated whenever an USB device is plugged in which I can monitor. I have looked into DBus and HAL without any success. But I don't want linux to load its current modules(USBHID and HID) when the device is plugged in. I also want to ask if the mentioned modules are also the device drivers used for HID devices.
My sole purpose is to run a script whenever an USB device is plugged into the bus which will indirectly call the above mentioned modules.
I am writing my code in C. I am quite new to linux. So it would be of great help if anyone could point me in the right direction.
Thanks..
The UDisks deamon will send the D-Bus signal "DeviceAdded" when a USB drive is inserted, and probably another "DeviceAdded" for each partition on the drive. If you have automount you would also get a "DeviceChanged" signal when the partition(s) are mounted. You can then query the UDisks interface, as well as individual devices about their properties, for example. You can find more info on the UDisks interface here: http://hal.freedesktop.org/docs/udisks/UDisks.html
One way to get more familiar with what goes on with block devices (or whatever) on D-Bus, is to install and use D-Feet to inspect the bus. UDisks appear on the System bus. You can see what is there and inspect the properties for individual devices as well as the UDisks interface itself.
Another way, which would also allow you to see what signals are transmitted on the bus, is to run dbus-monitor from the command line.