Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 11 months ago.
Android erases Nucleo Flash -- Is this an ST/LINK Bug?
I am attempting to connect to the Nucleo-F303RE board from my Android phone via USB CDC. However, when I plug the Nucleo into the USB OTG connector, the Nucleo is mounted as a mass storage device, the COM/LD1 LED flashes briefly, and then my firmware is erased. My program is no longer running on the MCU.
The phone recognizes and connects to the USB CDC device, but by this time, there is no program running on the Nucleo board to talk to.
I have to unplug the Nucleo device from the phone and reprogram it. I have tried to upload my firmware from Android, but that does not work either.
Is this a know issue? Is there a fix or work-around for this problem?
There does not seem to be any way to prevent my phone, which is running Android 6.0, from mounting the mass storage device. It happens automatically every time it is plugged in.
Question relating to:
1 Answer
8 years, 11 months ago.
Hello, This is a side effect of android automatically writting to any mass storage device you connect to it. The STLink provides 3 interface CDC, debug and mass storage. The mass storage interface is non-standard by the fact that what is written into it will be flashed into the STM32 memory. This is how the drag and drop flashing has been implemented for mbed online compiler.
Android is writing something onto the mass storage interface, and unfortunately this something erases your program...
Is there a way to disable the mass storage device or prevent the STLink from erasing the program while leaving the CDC device functional? I have tried removing the two jumpers from CN2, but that affects all connectivity between the STLink and the Nucleo.
Otherwise, is there a way to reflash the program while plugged into the Android device? I copied the firmware file to the phone and then attempted to copy it to the STLink device. Unfortunately, nothing happens after the firmware is erased.
posted by 07 Jan 2016Removing CN2 jumpers before plugging the nucleo board seems to work on windows 7.
The CDC is still operating correctly with the jumpers removed.
I used a printf loop in the MCU for my test.
The mass storage device is still present but contails detail.txt and fail.txt error message files.
I suppose there might be something wrong on android side
Interesting.
Upon inspection, it appears that NRST is held low when CN2 is removed on the two F303REs that I have. That occurs whether the TNC is plugged into my computer or the Android device. Is that to be expected?
Putting a jumper across NRST and 3V3 allows the program to run. This jumper also prevents the TNC from being erased when CN2 is installed.
Serial port speed appears to be locked at 9600 baud on Android. Not yet sure what is causing that. But at least the serial port is somewhat working now. That's progress.
posted by 08 Jan 2016