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.
10 years, 4 months ago.
Wiring and frequency
Hi,
I have ST Nucleo F401 RE and I try to make simple USB HID program. My program looks like this:
#include "mbed.h" #include "USBHID.h" DigitalOut myled(LED1); USBHID hid(1, 1, 0x1234, 0x0006, 0x0001, false); int main() { myled = 1; wait(1.0); hid.connect(true); while(1) { myled = !myled; wait(1.0); // 1 sec } }
Dev board is connected to computer via two cables see image:
But program stuck in connection. I debug little bit and it seems, device (in USBDevice) is in state POWERED (default state), but not in state connected. Can you help me? Is my wiring insufficient?
Question relating to:
1 Answer
10 years, 4 months ago.
Hi Michal,
Connecting the USB power pin to PA9 might be required for USB functionality to work. Does USBSerial work properly?
I just checked and it looks like there is no need to change any clock settings if the latest mbed library build is used. I also tested the USBMouse example and it works so there should not be any problems with USBHid.
posted by 07 Jul 2014I haven't got this one myself, but isn't it running by default on the internal oscillator? It might be accurate enough in your sample, but not guaranteed. I believe you can let it get a clock from the ST link. But as I said, don't got it myself, and maybe that already is the default.
posted by 07 Jul 2014
I also change frequency of build in oscillator as proposed.
posted by Michal Stehlik 06 Jul 2014A ground connection may help. You'll be getting one to the PC through the debug USB port but the USB device ground should also be connected.
posted by Andy A 07 Jul 2014Hi, I am facing the same issue as above. I connected ground pin (to PA_10) and power pin to PA_9. and also did the clock modifications suggested in mbed-src. However still I am getting stuck in Device intialization (ie:- USB examples for mouse/keboard/ above USB HAL #connect is not working unfortunately). I wonder whether I am missing something here, I tried with/without power/GND pin as well. Do we need to modify pin configuration in code in someway ? Any feedback/suggestions are much appreciated.
Thanks
posted by uwick. W 26 Nov 2014