USB Endpoint Stalled Error - usb

I am getting "endpoint stalled error" in my CDC device. The usb stack is detecting the cable. The state is set as running but the errorcode is set as 0x11 which indicates 'USB_ENDPOINT_STALLED'. I verified and found that the endpoints has been assigned properly.
What would be scenarios when "endpoint stalled error" would be reported?
How to handle this?
Please advise!

STALL is a very common error and there is no general answer on this. You can reset the pipe , but i doubt it will help, probably your device is returning stall because your are not operating the device correctly.
Do you have an USB bus analyzer ? If yes please post the log so we can assist you better if not you can use a software bus analyzers like usb snoop.

Related

How to block USB storage device using EndPoint Security?

I am working on EndPoint Security. I was trying to control and block the USB storage device using the same. I used the event ES_EVENT_TYPE_AUTH_IOKIT_OPEN.
How can I get info about the device? for instance: Name Vendor Type etc...
Also when I just tried to block all the devices in the IOkit by just returning ES_AUTH_RESULT_DENY, still I was able to access the USB storage device after running the code in terminal. Could anyone guide and tell me what am I missing or where am I getting wrong?

Usb hub stalls when asking for descriptors

I have started with an Atmel Start project:
My goal is to have a usb hub connected to this demo board:
SAM V71 Xplained Ultra Evaluation Kit
The problem is atmel doesn't supply a hub driver, and they haven't responded to our questions about this. So I have been attempting to write one based upon the msc and other drivers they do provide.
Currently I'm having an issue when I connect the USB hub. It is returning a STALL when I send a GET_DESCRIPTOR request with the type DEVICE. This seems odd to me because other USB devices such as a flash drive or USB to serial converter do not reply STALL to the same request. In fact the Flash drive goes through the entire enumeration process and msc installation so that I can successfully read and write to the drive.
I am detecting the stall via a single break point set in the STALL handling section of the pipe handler.
I have been reading the Universal Serial Bus
Specification Rev 2.0 but I can't find any differences between the way to read descriptors from hubs vs other devices. And I don't understand why a STALL would ever be sent in reply to a GET_DESCRIPTOR request.
Thanks
Just in case this is useful for anyone else. The issue I was having was apparently caused by the compiler optimization settings. Specifically I had change this setting to: "None (-O0)", after changing this back to the default I have had no problems enumerating USB devices. Picture of Optimization configuration
My colleague discovered this because of a seemingly unrelated problem which was causing Hard faults and Bus faults on the chip, these were also fixed by switching back to -O1. It seems -O0 needs to be used with a grain a salt or not at all on this chip.

Dump the current firmware from an STM32 microcontroller

I'm working with a commercial device which uses a STM32F103RBT6 microcontroller. I need to replace the firmware to customize some functionalities, but before I would like to dump the current one to be able to restore it if it's needed.
I connected properly the board to my ST-Link v2 programmer, the device is powered by the programmer and in fact when I plug it on the USB the device starts correctly. The problem is that I don't manage to connect to the microcontroller using the ST-Link utility, I always get a "can't connect" error (error message), trying with different settings.
I need to reset the chip before? How?
Thanks!!
Please check you have connected the JTAG/SWD signals from ST-Link debugger to correct pins on the target.
Also ensure the board is power.
Then check settings in ST-Link utility, check JTAG/SWD connection, speed and connect under reset which assert the NRST pin on the target in order to allow connection on JTAG/SWD pins.
If this doesn't work then it can be also the case that the MCU is protected against reading by setting an option byte (look for RDP2 in reference manual). If this bit is set then you won't be able to connect.

How to power off USB device from Windows using batch or any API

For testing purposes I need to power off a USB device from my computer programmatically. The microprocessor in the USB device is ARM Cortex M4.
I have tried using Devcon, although the device was disabled, power was still provided to the device.
I have also tried to disable the USB root hubs ,that also didn't work.
I have read some other posts indicating that a SSR could be used, this option is not desired. I would rather choose the software solution(if there is one of course).
Some other answers have indicated that this is an OS issue, and some others a chip-set architecture issue.
So my question is what options are there available. And also is this purely something dependent on the computer side or do we need to implement something on the USB device side as well.
Thank you in advance.

Detect Red5 Broadcaster disconnection by network failure

How can i detect that a broadcaster has a network failure and disconnected from Red5 server? streamBroadcastClose method doesnt help me. I looked at the red5 reference but couldnt find any event that detects the broadcaster disconnection.
If there's a network disconnect, you're more likely to get a socket or write exception; there is no Flash NetConnection event specific to this type of failure that I know of.