This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Composite USB device MSC+CDC does not work

I'm using a Keil MCB1700 evaluation board. The Mass Storage USB device demo works fine, the Virtual COM also works fine but combining them results in a driver failure. Below a detailed list of what I did, any pointer to what I do wrong would be appreciated! It is a long report, skip to the end if you are not interested in what did work :-)

Tool Version Numbers:

Toolchain:        MDK Plus 5.28 (Flex)  Version: 5.28.0.0

Toolchain Path:    C:\Keil_v5\ARM\ARMCC\Bin

C Compiler:         Armcc.exe        V5.06 update 6 (build 750)

Assembler:          Armasm.exe        V5.06 update 6 (build 750)

Linker/Locator:     ArmLink.exe        V5.06 update 6 (build 750)

Library Manager:    ArmAr.exe        V5.06 update 6 (build 750)

Hex Converter:      FromElf.exe        V5.06 update 6 (build 750)

CPU DLL:               SARMCM3.DLL          V5.28.0.0

Dialog DLL:         TARMP1.DLL           V1.26.0.0

Target DLL:             UL2CM3.DLL           V1.162.16.0

Dialog DLL:         TARMP1.DLL           V1.26.0.0

 

The PC I'm using is a Windows 10, 64 bits, x64 processor machine.

 

I start uVision 5, I open the Packet Installer, select the LPC1768 from NXP, click Examples and copy the USB Device Mass Storage and the USB Device Virtual COM examples in a folder called CompositeUSB. The board is a Keil MCB1700 and the support pack is LPC1700_DFP version 2.5.0

 

In the folder CompositeUSB I copy the folder MassStorage and rename this folder into Composite. In this folder I rename all MassStorage.* files into Composite.*, I start a new Multi Project Workspace and add all three projects. In the Composite project I remove in the Source folder the file MassStorage.c and I add the Composite.c file.

 

 

Mass Storage Project

 

I make the MassStorage project the active one, the USB folder contains two files that are marked outdated. USB_Config_0.c is version 5.0.4 but a newer version 5.2.0 exists, USB_Config_MSC_0.h is version 5.0.4 but a newer version 5.1.1 exists. I do NOT upgrade the files for now.

 

In the Manage Run-Time environment menu I select the MDK-Plus version for the File System and for the USB components. Then using Project, Rebuild All I recompile, no error or warning. When I execute the program and plug in the USB it detects a mass storage device, it assigns a drive and I can access the content on the SD-card that is mounted in the MCB1700 board.

 

I stop the program, open the USBD_Config_MSC_0.h file, click on the Configuration Wizard and set Bulk IN and the OUT Endpoint Number to 5 which, according to the spec of the LPC1768 is a BULK endpoint. I recompile and start the program, all works fine.

 

Then I click on USBD_Config_0.c and select the Update Config file option, same for USBD_Config_MSC_0.h. I reopen the last, the Bulk IN and OUT Endpoint are set to 1 (which will not work since this is an Interrupt Endpoint) and change both Endpoints to 5 again. In the Manage Run-Time environment menu I select the MDK-Plus version for the USB System, Rebuild All, start the program, all works fine.

 

I stop the program, in the Device Manager from Windows I check the View, Show Hidden Files option, select the USB Mass Storage Device, right click and select the Uninstall Device option.

 

 

VirtualCOM Project

 

I make the VirtualCOM project the active one, here the USB_Config_0.c is version 5.0.0 (not 5.0.4) but a newer version 5.2.0 exists, USB_Config_CDC_0.h is version 5.1.2 but a newer version 5.2.0 exists. I do NOT upgrade the files for now.

 

In the Manage Run-Time environment menu I select the MDK-Plus version for the File System and for the USB components. Then using Project, Rebuild All I recompile, no error or warning. When I execute the program and plug in the USB it detects a serial device and assigns a COM port. All works fine.

 

I stop the program, click on USBD_Config_0.c and select the Update Config file option, same for USBD_Config_CDC_0.h. I reopen the last, Interrupt Endpoint is set to 1, the Bulk Endpoint to 2 so OK. In the Manage Run-Time environment menu I check that all versions are set to MDK-Plus, Rebuild All, start the program, all works fine. I do notice that a new Serial Device was added instead of re-using the previous one, I guess the VID/PID combo is different in the newer version of the drivers, no problem.

 

I stop the program, in the Device Manager from Windows I uninstall the drivers for both Serial Devices.

 

 

Composite Project

 

I make the Composite project the active one. Since this is a copy of the Mass Storage, USB_Config_0.c is version 5.0.4 but a newer version 5.2.0 exists, USB_Config_MSC_0.h is version 5.0.4 but a newer version 5.1.1 exists. I do NOT upgrade the files for now.

 

In the Manage Run-Time environment menu I select the MDK-Plus version for the File System and for the USB components.  I open the USBD_Config_MSC_0.h file and set the IN and the OUT Endpoint Number to 5, rebuild the project, start the program, all works fine. I stop the program and Uninstall the Mass Storage device in the Windows Device Manager.

 

In the Manage Run-time Environment I select USB, Device and add a CDC device by setting the value to 1. It adds a USBD_Config_CDC_0.h file version 5.2.0. Since the bulk endpoint for the Mass Storage Device is already changed to 5 the bulk endpoint for the CDC device can remain at 2. The Configuration Wizard confirms the Interrupt Endpoint is 1, the Bulk Endpoint is 2.

 

I rebuild the project, start it and plug in the device to USB. Nothing happens, no beep, no change in the Device Manager.

 

I stop the program and update both USBD_Config_0.c and USBD_Config_MSC_0.h. I set the BULK endpoint to 5, rebuild, start, plug-in, again nothing happens.

 

In the Manage Run-Time environment I than set the variant of the USB, CORE to Debug. A validation error is shown, click Resolve and click OK. A file USB_Debug.c is added, I open it and in the Configuration Wizard I enable the USB Device Debug option. I set Core, Driver, CDC and MSC to All events and the rest to Off.

 

In the file Composite.c I add the header file #include "EventRecorder.h" and I add the call to EventRecorderInitialize (EventRecordAll, 1); at the first line in the main function before anything else is done. I open an event record view by selecting View, Analysis Windows, Event Record.

 

I rebuild the project and start it, below a screenshot of the Event Recorder. It seems to go wrong on an InitializeFailed call to USBD_MSC.

 

Any support on how to fix this would be appreciated.

 

 

Parents
  • I finally got the application to work, what needs to be done is to increase the number of user threads to 8, increase the number of threads with user-provided stack size to 3 and increase the total stack size for user-provided stack size to 2048. All these settings are made in RTX_Conf_CM.c 

Reply
  • I finally got the application to work, what needs to be done is to increase the number of user threads to 8, increase the number of threads with user-provided stack size to 3 and increase the total stack size for user-provided stack size to 2048. All these settings are made in RTX_Conf_CM.c 

Children
No data