Serial number from runtime

Discussion of the PSoC CY8C24x94 and other PSoC like USB parts from Cypress should be discussed here. This forum is limited to the discussion of USB portion of those parts. Other forums should still be used to discuss the non USB features of these parts.

Moderator: ericb

Serial number from runtime

Postby Fabrizio » Mon Nov 12, 2012 3:35 am

Hi everyone,
I use a PSOC 5 and I would like to set serial number descriptor runtime from source.
From TopDesign the "Serial Number String" is set to "User Call Back".

I try the below source:

Code: Select all
    uint8 TestSN[] = {
    /* Descriptor Length                       */ 0x08u,
    /* DescriptorType: STRING                  */ 0x03u,
    '1', 0,'2', 0,'3', 0
    };
   
    USBFS_SerialNumString( (uint8 *)&TestSN[0u]);
   
    /* Start USBFS Operation for the DEVICE_ID and with 5V operation  */
    USBFS_Start(0, USBFS_DWR_VDDD_OPERATION);


The result is to find out only odd chars on the serial number.

Thanks in advance.
Fabrizio
Fabrizio
Newbie
Newbie
 
Posts: 2
Joined: Mon Nov 12, 2012 1:04 am

Re: Serial number from runtime

Postby orob » Tue Nov 13, 2012 4:38 pm

Code: Select all
        uint8 TestSN[] = {
        /* Descriptor Length                       */ 0x08u,
        /* DescriptorType: STRING                  */ 0x03u,
        '1', 0,'2', 0,'3', 0
        };
       
        USBFS_SerialNumString( (uint8 *)&TestSN[0u]);
       
        /* Start USBFS Operation for the DEVICE_ID and with 5V operation  */
        USBFS_Start(0, USBFS_DWR_VDDD_OPERATION);


do you mean only the 1 2 & 3 worked or only the 1 and 3 show up?

if you want the zeros to show, put them in ' ' like '0'
I'm not sure if you need the serial number formatted in unicode where you would have 0001 0000 0002 0000 0003. Unicode uses 4 characters.

Just some random thoughts that may be helpful.
orob
The Big Cheese
The Big Cheese
 
Posts: 606
Joined: Wed Sep 26, 2007 9:06 am
Location: US

Re: Serial number from runtime

Postby Fabrizio » Wed Nov 14, 2012 3:31 am

I've solve the problem!

My mistake was to pass a local variable to the function _SerialNumString.

Thank for helps

Fabrizio
Fabrizio
Newbie
Newbie
 
Posts: 2
Joined: Mon Nov 12, 2012 1:04 am


Return to “%s” USB

Who is online

Users browsing this forum: No registered users and 1 guest

cron