Content originally posted in LPCWare by BPC on Thu May 30 08:46:46 MST 2013
Quick update / more questions.
After reading some posts, I noticed that the ROM_USB_cdc example uses the following settings:
usb_param.mem_base = 0x10001000;
usb_param.mem_size = 0x1000;
Looking at UM10524, shouldn't this be:
usb_param.mem_base = 0x20004000;
usb_param.mem_size = 0x0800;
Memory location 0x10001000 specifies the lower 4k of SRAM0??? I wonder why the example doesn't have this set to the 2kB USB SRAM as shown above.
Secondly, I also noticed in the example that:
cdc_param.mem_base = usb_param.mem_base;
cdc_param.mem_size = usb_param.mem_size;
Whereas app_usbd_cfg.h shows:
#define CDC_MEM_BASE 0x20000000
#define CDC_MEM_SIZE 0x00001000 <--this runs into "reserved" (i think size should be 0x800)
In summary, I have changed my code to these new values and the Hard Fault upon COM port closing has "gone away". However, I noticed my responses to Set Line Coding were corrupt (i.e. instead of 9600bps, the response was 293874981734261 bps).
After some more reading, I've changed back to:
usb_param.mem_base = 0x10001000;
usb_param.mem_size = 0x1000;
which fixed the corrupt Line Coding responses and I've now changed to:
cdc_param.mem_base = 0x20000000;
cdc_param.mem_size = 0x0800; <--no longer goes into "reserved"
Seems like alot of trial and error to me, but Hard Faults are gone and Set Line Coding responses are correct.
If anyone can confirm this or point me in the right direction I would really appreciate it.