Description
Description of defect
I tried to activate USBDevice on a custom target with Devebox H743 board. The USB code compiles for this target, but the host does not get a valid USB device information. The same issue is observed on a Nucleo H743ZI2 board and reported in the forum:
https://forums.mbed.com/t/mbed-nucleo-h7743zi2-doesnt-support-usbdevice/8241/7
So it does not look target hardware specific.
Tests with different sources for USB clock (HSI48, PLL3Q) were not successfull. So I tried to set breakpoints in the HAL_USB callbacks. These breakpoints were not hit. Only when I set a breakpoint in USBPhyHw::_usbisr(void) the target stops and after continue, also the bp in the SOF callback is reached.
Next step was to add tr_info() calls and enable mbed_trace. This did not work also. An initial printf("hello world\n") is printed, followed by a 0xff hex.
A test with the same program and modified USBPhy_STM32.cpp on a F401 MCU is working as expected. The USBMidi is recognized by the windows host and midi output from the sample code is generated. The trace outputs from the callbacks are pinted as well.
Don't know it it maybe related to this H743 issue:
#11422
Target(s) affected by this defect ?
STM32H743xI
NUCLEO_H743ZI2
Toolchain(s) (name and version) displaying this defect ?
GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025
What version of Mbed-os are you using (tag or sha) ?
mbed-os-6.3.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed-cli
How is this defect reproduced ?
- use a simple USBDevice test program
#include "mbed.h"
#include "USBMIDI.h"
#include "mbed_trace.h"
DigitalOut led1(LED1);
int main() {
mbed_trace_init();
sleep_manager_lock_deep_sleep();
printf("hello world\n");
USBMIDI midi(false);
midi.connect();
while (1) {
for(int i=48; i<83; i++) { // send some messages!
led1 = !led1;
if (midi.ready())
midi.write(MIDIMessage::NoteOn(i));
ThisThread::sleep_for(250ms);
if (midi.ready())
midi.write(MIDIMessage::NoteOff(i));
ThisThread::sleep_for(500ms);
}
}
}
An updated USBPHy_STM32.cpp with test traces can be found in this branch:
https://github.com/JojoS62/mbed-os/tree/test-USB-H743