 Okay so now we switch to USB descriptors maybe I propose to show you again the traces we have seen before together just to have a look in it and maybe you will better understand it right now okay it's still there so it was just now we know how to to check this so here it's typically a get descriptors we will just explain after what is it get descriptors and things like that but you see that it was a setup transfer transfer again so address 0 and point 0 so here that means it's something that I've plugged the traces I've done I've just plugged my board which is a VCP we don't care so is it just the first transaction just started we've got a setup some data 0 who say okay get the descriptors I will say get information from him and then I will receive in token in token from those point of view it's something that coming from the device to the host with some information on it okay so here you've got the answer from the device and then here we've got I will say the part of the statement to say if it was okay or not and then we can see that the transition is okay we've got a how and we send some data that just now you should have in mind how to read such kind of thing the level of transaction the different packet the token some information that coming from the device data and always and shake okay do you feel more comfortable with this now I think now if I just put you in front of him this kind of code you can understand what's happened and keep in mind it's the best way to debug when you've got an issue with the device plug in such kind of thing you can see what are the transfer between because mainly the problem when you are using a PC you are using some drivers delivered by windows or by anything else you don't know what they are doing so you can just check what are the traffic is it normal why it doesn't answer the descriptors or things like that so you have to check what is a traffic inside okay so that was just a short example and now we go on desk crypto so let's go on the descriptors so the host will use this information to know the capability of the device so it's really something that he will need and we'll see what is inside these descriptors okay so we've got on the top of the structure a device descriptors I will say that mainly describe everything but it will point on other structures that device everything the device descriptor with point on some string descriptors I will say some information what is the manufacturers the product and the serial numbers it just the things that you can see in the drivers you know in the windows when you connect something you can see okay it's some things by this company and this kind of product this information you can have in the window very easily then you've got configuration descriptor that means we could have a device with many configuration in parallel that's mean that have different capabilities and then it could have several interfaces that's mean for example we are commonly use just a USB key but I don't know if you are familiar with STM32 when you plug it on your PC what kind of USB device are you seeing have you already checked no no you when you plug a you STM32 a nuclear have you seen some okay so if you do it you will see a mass storage you will see a virtual comport and you will see a ST link you will see three device USB you are in front of what we call a composite device that means a device could have several I will say rule at the same time it could be seen as a USB key and use it that way you can use the debugger at the same time it just different on point and different interfaces that are described it's okay for you this is what we call the composites when we deliver for us we just deliver in the stack some preconfigured I will say standard interfaces for the master age for the VCP so the virtual comport the other one the HID and think like that but not the composable if you want to do a composite you have to do some development with our stack just some adaptation to do by yourself so how it's maybe I go too fast so each interfaces should have the on point descriptors so we already told you this before when you address you talk to one on point and this on point have some characterization is it an interact one asynchronous or back one and that's it or it's a zero but zero if for the setup so we already receive always keep in mind you only what have one configuration activated at the time you can't have two configuration but in the configuration you can have several interface descriptors that mean different class that just show you how it's often started the enumeration process I say often because the USB specification don't specify exactly this order so it's a one that you can observe with windows but it could be a little bit different sometimes depending on your host so first the USB reset then we read the default address that mean we're on the address zero we get the get device descriptor with the address zero remember I saw you the trust before with the setup foundation with the address zero it will be this one so get descriptor setup and then we see okay we do a reset and we set the device address and after this we get the get the device descriptors then we get the device califer descriptors this is needed for the high speed just to know if your device have got high speed capabilities if you have got some high speed capabilities you will need some additional information about those on point in high speed or the high speed configuration then we get the configuration descriptor nine byte and all the bytes then once you receive all this time then the host will set one configuration and say I will use this configuration and we can switch from one configuration to the other but I say before you can only have one configuration activated at the time I will say one way of working of your device okay so let's go more in detail so you remember we are in the setup foundation with a setup stage data stage the setup stage will say okay I will quest direction device to host standard device there is a get descriptors and then we say what kind of descriptors we want to see first we will request the device one then we will request all the other one the strings associated to the device on such kind of thing then the configuration the interface and the on point now you better understand all the setup transition you will get the descriptor of the device then the different element of the structures and at the end the host got all the information of the device configuration possible so reading the device descriptor so this setup transition first and then we receive such kind of information so okay don't focus a lot of the structures what is important to see the number of configuration there's and you can see it's a device the vendor ID the product ID so this is important because from the host point of view it's a way to know what I'm talking on what kind of driver should I load on my side to discuss with this this is a really important point the product ID on the vendor ID so vendor ID is pro is a provided you have to pay to get one if you want to have the one of your company to the usb.org and the product ID you can request ST can provide you for free if you just send us information but you will have to use our vendor ID and regarding dates that you can put the logo USB on your device if you want to set it on the market so the device descriptors we got the number of configuration that we can request we've got also the manufacturers information that we can request so you can see how receiving this then we can request the other part of the structures so device qualify qualified descriptors I told you before it was the one that is needed for the high speed it's when you need to have if you want if you need if you have got the capability to do some high speed sorry you will have to describe the way to use it so you have some additional structures for that just keep this in mind about the configuration descriptors so we've got the configuration inside the interfaces and class specific descriptors what is a class class is a master wage actually human interfaces master wage human interfaces help me MTP for example GFU I don't know if you know this one device firmware update it's a class that allow you to download some firmware on update your firmware we'll see some hands-on with this one also only we can have all this one on the different interfaces so now we have seen the device descriptors the configuration descriptors and as I said you've got different descriptors possible but only one could be activated at the time so we could imagine that in some case you need the master wage on the ST link at the same time but suddenly on your PC okay I'm deactivated the ST link I don't want to use it anymore you can say to the device okay forget this part and switch to this configuration without this on point okay configuration descriptors okay so always the structures so it will contain the number of interfaces that you will have to request the length of all the information that you are supposed to receive so now I can use only the configuration one so you can switch from one configuration to the others so you just send from the device descriptors set configuration configuration one again it's a setup transaction think about it this will be a very simple one just without any data just send a setup token a data out acknowledgement and then again in token to receive it's a hack so an empty packet data and then okay you've got in mind all this I will say traffic now what kind of different packets inside this transaction okay interface descriptors okay some subtlety I will say inside the configuration descriptors you can have some alternate setting for one interfaces it just a capability to define one and activated switch from this one to this one dynamically from the host point of view so we just to say okay finally I just want to send this one to this one this is a possibility the endpoint descriptors so characterization is in which way it's out or in direction you can find the tip of transfer synchronization tip is a chronos is a conus transferred and tip of transfer is it a bulk interrupt or such kind of things on the packet the pulling interfaces that could be used for the pulling one so here it's really the description of the on points that attributes the transaction tip bulk is a chronos and interrupt you don't need to take setup because setup is associated to the endpoint zero for sure and the interval it's how you will I will say pulling the data always think it's host centrics it's host that's cadencing the traffic string descriptors it's a way to send the string no so much complicated there example of enumeration we already seen it and this is what I already said to you so here we can see a reset I'm not sure you can see it you manage to read it or maybe you you've got the slide if you if you don't it was just like 101 you can see a reset first to get descriptors with the address 0 on point 0 then a reset so it's really what we have seen before what's happened at the beginning the first thing is a set address and after this transaction so always think it's a transaction you got it right now it's a setup with the data stage plus acknowledgement stage and then after you can see the address of the on point is 14 so it had been set the address then we started to get the get the device descriptor there's a configuration descriptors and it requires a different string value the device qualifier to know if it's able to what is the configuration for the ice field then the device type configuration and such kind of things so you've got a full example of an enumeration just catch with a USB analyzer