lpcware

LPC4337 and programming flash in work(IAP)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by snovik on Wed Apr 02 23:45:43 MST 2014
Hello.

I do realization card reader through usb.
In the process work, I need to change the data in the firmware (usb descriptors). I understand this is done through the IAP (In-Application Programming).

How do I do this?

Example of what needs to change:

USB_Descriptor_Device_t MassStorageDeviceDescriptor = {
.Header                 = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},

.USBSpecification       = VERSION_BCD(02.00),
.Class                  = USB_CSCP_NoDeviceClass,
.SubClass               = USB_CSCP_NoDeviceSubclass,
.Protocol               = USB_CSCP_NoDeviceProtocol,

.Endpoint0Size          = FIXED_CONTROL_ENDPOINT_SIZE,

.VendorID               = 0x1111,/* TEST!!! */
.ProductID              = 0x2222,
.ReleaseNumber          = VERSION_BCD(01.00),

.ManufacturerStrIndex   = 0x01,
.ProductStrIndex        = 0x02,
.SerialNumStrIndex      = USE_INTERNAL_SERIAL,

.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};


/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
*  the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
*  via the language ID table available at USB.org what languages the device supports for its string descriptors.
*/
uint8_t MassStorageLanguageString[] = {
USB_STRING_LEN(1),
DTYPE_String,
WBVAL(LANGUAGE_ID_ENG),
};
USB_Descriptor_String_t *MassStorageLanguageStringPtr = (USB_Descriptor_String_t *) MassStorageLanguageString;

/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
*  form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
*  Descriptor.
*/
uint8_t MassStorageManufacturerString[] = {
USB_STRING_LEN(3),
DTYPE_String,
WBVAL('T'),
WBVAL('T'),
WBVAL('T'),
};
USB_Descriptor_String_t *MassStorageManufacturerStringPtr = (USB_Descriptor_String_t *) MassStorageManufacturerString;

/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
*  and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
*  Descriptor.
*/
uint8_t MassStorageProductString[] = {
USB_STRING_LEN(21),
DTYPE_String,
WBVAL('T'),
WBVAL('T'),
WBVAL('T'),
WBVAL(' '),
WBVAL('M'),
WBVAL('a'),
WBVAL('s'),
WBVAL('s'),
WBVAL(' '),
WBVAL('S'),
WBVAL('t'),
WBVAL('o'),
WBVAL('r'),
WBVAL('a'),
WBVAL('g'),
WBVAL('e'),
WBVAL(' '),
WBVAL('D'),
WBVAL('e'),
WBVAL('m'),
WBVAL('o'),
};
USB_Descriptor_String_t *MassStorageProductStringPtr = (USB_Descriptor_String_t *) MassStorageProductString;


Thanks.

Outcomes