The USB_PROP_IS_RAM did not work!
I did define in main.c:
Code: Select all
int usbDescriptorStringSerialNumber[] = {
USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),
USB_CFG_SERIAL_NUMBER
};
And in the usbconfig.h file:
Code: Select all
#define USB_CFG_SERIAL_NUMBER 'P','E','0','F','K','O','-','2','.','0'
#define USB_CFG_SERIAL_NUMBER_LEN 10
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER (USB_PROP_IS_RAM | USB_PROP_LENGTH(USB_CFG_SERIAL_NUMBER_LEN))
This source change alone was not sufficient to make the firmware running!
I did found it had something to do with the length and changed the macro GET_DESCRIPTOR(..) in the source file usbdrv.c according the next code.
Code: Select all
//+PE0FKO
#if 1
#define GET_DESCRIPTOR(cfgProp, staticName) \
if(cfgProp){ \
if((cfgProp) & USB_PROP_IS_DYNAMIC){ \
len = usbFunctionDescriptor(rq); \
}else{ \
len = USB_PROP_LENGTH(cfgProp); \
usbMsgPtr = (uchar *)(staticName); \
} \
if((cfgProp) & USB_PROP_IS_RAM) \
{ flags = 0; len = len*2+2; } \
}
#else
#define GET_DESCRIPTOR(cfgProp, staticName) \
if(cfgProp){ \
if((cfgProp) & USB_PROP_IS_RAM) \
flags = 0; \
if((cfgProp) & USB_PROP_IS_DYNAMIC){ \
len = usbFunctionDescriptor(rq); \
}else{ \
len = USB_PROP_LENGTH(cfgProp); \
usbMsgPtr = (uchar *)(staticName); \
} \
}
#endif
//-PE0FKO
The length was not correct because the code #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber) in the same usbdrv.c source file was not compiled in the next code part.
Code: Select all
#if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN
#undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER sizeof(usbDescriptorStringSerialNumber)
PROGMEM int usbDescriptorStringSerialNumber[] = {
USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),
USB_CFG_SERIAL_NUMBER
};
#endif
By changing the macro GET_DESCRIPTOR(..) I did get the code running
Fred Krom
PE0FKO