I'm having issues getting the MQX CDC Device example (i.e., virtual_comm) running on my custom board. I'm simply trying to use our MCU's USB as a device in FS mode without OTG. I'm able to get the code working with the k60f120 tower board just not with my custom hardware. My MCU is the MK60FX512VLQ12 running with the following clock settings:
Core clock = 96 MHz
- Bus clock = 48 MHz
- External bus Clock = 48 MHz
- Flash Clock = 24 MHz
I'm using a 12 MHz crystal going into XTAL1 and EXTAL1 to generate all of the clocks.
My custom board and the k60f120 demo board are both running MQX 4.0.1 RTOS. The next 2 screenshots are from processor expert where I have imported the BSP so that I could make changes, BTW I'm pretty confident that the BSP was ported into PE properly because I went through a long process to do so with the help from a freescale tech support.
There is more to read after the screenshots so please continue.
The following 3 images are relevant screenshot from the schematic of my custom board.
One interesting thing to note is that we are configuring our device hardware to be a "self powered" device, i.e., we plug in our own 5 volts into the VREGIN and then use the internal USB regulator to power our chip by connecting Vout33 to the MCU's VDD. The USB VREG module outputs up to 120 mA and at the moment we are well under 120 mA so I don't think that I'm at the maximum amount of output current.
The image below shows where USB DP and DM are being connected to the MCU. Please note that we are currently not doing anything with the PTE12/USB_VBUS pin shown below.
The virtual_comm.c, virtual_comm.h, usb_descriptor.c, and the usb_descriptor.h have not really been changed at all. The files were directly from Freescale's example and work just fine with the k60 tower just not with my custom board. It is important to say that I do have 2 different BSP's when testing this. One BSP is for the k60 tower and the other is for my custom hardware, but the application layer code is identical. My application layer code is interfacing with the RTOS via the run time libraries.
Our USB signals are coming in properly so I don't think that we have our wiring anything wrong. I have put a logic analyzer on USB0_DP and USB0_DM right before going into the MCU pins and I do see J,K, and SE0 signals coming in.
The exact error shown in windows can be seen in the screenshot shown below.
When I run the same code on the k60 tower the descriptor data goes across, which tells me it successfully enumerated. The only error I get from windows is that the driver is missing, which is ok.
I have a few questions which could perhaps lead me to the answer:
1. Do I have to setup a particular pin for VBUS_detect?
2. If I'm using the USB module on my custom hardware as a self powered (i.e., vregin is always connected to my power supply and NOT VBUS) do I need to worry about setting up a pin for detecting vbus?