cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX USB CDC Set_Feature data phase

admin23
Associate II
Posted on October 14, 2015 at 16:41

Hello,

I have to receive some data in a ''set_feature'' command.

It's possible because the packet is:

Offset Field Size Value Description

0 bmRequestType 1 Bit-Map

D7 Data Phase Transfer Direction

0 = Host to Device

1 = Device to Host

D6..5 Type

0 = Standard

1 = Class

2 = Vendor

3 = Reserved

D4..0 Recipient

0 = Device

1 = Interface

2 = Endpoint

3 = Other

4..31 = Reserved

1 bRequest 1 Value

Request

2 wValue 2 Value

Value

4 wIndex 2 Index or Offset

Index

6 wLength 2 Count

Number of bytes to transfer if there is a data phase

I can't find were is the code to read this data but if I respond to the command I can see in the sniffer the data!!

Somewhere the code writes the buffer with the data.

thanks!

#stm32cubemx-cdc-set_feature
1 REPLY 1
admin23
Associate II
Posted on October 15, 2015 at 13:27

I solved it!

I add this code

uint8_t *pdata;

  if(pdev->request.wLength>0)

  {

      USBD_CtlContinueRx (pdev, pdata, pdev->request.wLength);

  }

In the function

USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)

and I have the data