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.
Related
Working with the STM32L062 Cortex-M0 and CubeMX the generated USB CDC-ACM code works fine in Windows. With loopback code running on the STM32 and TerraTerm running on Windows characters typed in the terminal window correctly echo back. However, when this same system is then plugged into a laptop running Ubuntu, the device fails to enumerate. Even worse, the system doesn't appear to respond to the connection whatsoever- no new messages appear via dmesg that even a failed enumeration is going on. Given that the code used is generated by CubeMX wizards it is difficult to know what to start to troubleshoot. Any suggestions?
As an aside, this isn't the first issue presented by CDC-ACM drivers. Implementing a USB CDC-ACM stack for a PIC32MM processor, data can be sent to the host but not received from the host, however, if the driver is switched to plain vanilla CDC then data can be sent both ways no problem. So it seems maybe Ubuntu has some issues with the default USB drivers, but either way, it's very odd that the ST driver gets zero response at all from the system.
I have an STM32-discovery board and I am trying to program it with not using any cables.In the place where I am doing my internship, they first wanted me to program STM32-discovery with UART. I was able to do this by making the necessary connections and using the Flash loader demo. Now my next task is to add an ESP-07 wifi module on the STM32-discovery board, connect this module to the same network as my computer, and wirelessly program it from my computer. No other device is wanted in between (like Raspberry). I did some research on this topic but couldn't come to a conclusion. What I found; I can remote program by connecting the card to a Raspberry or a device called Codegrip. Is it possible to do this with only an ESP-07 without these devices? I will be glad if you just tell me what should I look for.
Yes, it's possible to reprogram the STM32 flash wirelessly if the STM32 is running a program that supports this capability. When you programmed the STM32 via the UART there was a program running on the STM32 that:
opened the UART port,
received the new program data via the UART (using some protocol),
and then programmed that new data onto the flash.
To do likewise wirelessly, the STM32 will need to be running a program that:
opens the Wi-Fi port,
receives the new program data via Wi-Fi (using some protocol),
and then programs that new data onto the flash.
You may have used the STM32 internal ROM bootloader to reprogram via the UART. And if so then you used the protocol required by that ROM bootloader. But the ROM bootloader probably does not support Wi-Fi. So you'll probably be creating your own bootloader program that can communicate over Wi-Fi. And you might be defining your own protocol for transferring the program data over Wi-Fi. Or maybe you can apply some established protocol such as FTP. Search for examples of bootloaders that support OTA (over the air) firmware updates.
There are two possible solutions.
Write a custom bootloader for the STM32 - the flash is organised with smaller blocks at the start to support that, so you would move your application to higher memory and have the bootloader either jump to the application to load a new application. The bootloader can then access the Wi-Fi module (and other interfaces) to get updates.
Write custom firmware for the ESP0-07 so that it receives and stores the STM32 image, then transfers it to the STM32 using the existing ROM serial bootloader. In this case you need the details of the bootloader protocol, and it would be useful if the ESP-07 had a GPIO connection to the STM32 reset line so that it can invoke the bootloader without a manual reset.
Either way, you need to write software for one or other of the devices.
You can use any standard bootloader and connect the Wireless module like ESP32 (Bluetooth and Wifi), ESP8266 (Bluetooth and Wifi), BT-05 (Bluetooth), HM-10 (Bluetooth), etc.
Then create the android application or web application and update the Firmware or application.
If you don't want to use the Standard Bootloader, you can implement your own bootloader and add this OTA feature to that.
We have added the Tutorials step by step. Please refer to this if you get time. There we have developed the custom bootloader and updated the Firmware.
I have a project based on a Nucleo H743ZI2 board that communicates with a PC through the USB OTG port on the Nucleo.
Everything is working fine as long as, weirdly enough, I have the STlink USB cabled plugged in (which I have been using to work on the firmware, flash, debug, etc).
However, today I was getting ready to do actual tests with this project and used an external power source to power the H7. I initially tried a 3.3V external source which is available from one of the shields, and then tested a lab PSU at both 3.3V. Thinking it could be PSU related I also tried external 5V with the same results.
Basically, the device is not recognized by the computer operating system, unless the STlink USB is plugged in.
I can't really put my finger on this one; I initially thought it was a PSU related issue (that nucleo board has some restrictions when it comes to using external power sources) but at this point I am fairly confident I am failing to initialize something in my code. Not sure what though.
I'd be happy to share with my code, but wouldn't know where the start. I haven't done much as far as the USB OTG is concerned other than modifying the receive callback to process the data.
Any idea what I might be missing here?
Cheers
This is a problem that I am trying to solve for years, periodically spending 1-2 months on it.
I am using Metrowerks IDE and ColdFire C compiler MCFCCompiler ver 4.0 to build the embedded code that uses the USB module for communication with the host. The product with this hardware has been out for eight years and pretty successful. However, along these years we were getting complaints from the field that occasionally the communication with the host hangs up and the operation is unrecoverable.
I tracked the bug down using USB sniffer and the Coldfire debug hardware and this is condition and the scenario that I find the code in.
The communication break is on the firmware side and not the driver on the host.
The hang-up happens only when sending USB firmware commands from host (windows 7) in rapid-fire from multiple threads. Every firmware command replies back to the host. So there's maximum traffic through the USB port.
I am using the implementation provided by Motorola that is well documented in USB-STAND-ALONE-DRIVER_V03.pdf (google will find it for you). There are two functions that are in my focus point and they should play nicely together: usb_in_service (called by the interrupt handler) and usb_tx_data (that initiates the transfer, which at some point will generate an interrupt).
The usb_tx_data function is implemented such that it bails out if the USB fifo still has data to send to the host. But waiting on the fifo to clear up takes the code into an infinite loop.
No more interrupt occurs after this although the USB module's registers content tells me the interrupts are enabled.
I checked that the USB module did not get reset event and is not suspended either.
The main question is whether the error is in the USB module hardware or in the code. I don't find any errata pointing to this problem. If it's the code, where is that whole in it that the logic is not accounting for?
The hot pursuit in on because we are making a new line of product based on this same firmware and I cannot release it until this is solved.
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.