cancel
Showing results for 
Search instead for 
Did you mean: 

usb buffer descriptor masks in cmsis device h5

mete
Senior

They are defined like this in stm32h563xx.h:

/*Buffer Descriptor Mask*/
#define USB_PMA_TXBD_ADDMSK                        (0xFFFF0000UL)
#define USB_PMA_TXBD_COUNTMSK                      (0x0000FFFFUL)
#define USB_PMA_RXBD_ADDMSK                        (0xFFFF0000UL)
#define USB_PMA_RXBD_COUNTMSK                      (0x03FFFFFFUL)

ADDMSKs are correct, but I was expecting both COUNTMSK to be 0xFC00FFFFUL since both COUNT_TX and COUNT_RX are 10 bits [25:16]. When double buffering is used there is BLSIZE and NUM_BLOCK but I dont see anything about these in the header. Is there a reason the TXBD and RXBD_COUNTMSK are defined like this ?

2 REPLIES 2
STea
ST Employee

Hello @mete ,

i'm checking this out i will come back to you as soon as possible .

BR

Hichem

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
STea
ST Employee

Hello @mete 

after investigation on this matter i have the following informations :

  1. The USB_PMA_TXBD_COUNTMSK clears 16 -> 31 bits including the reserved ones . As the in the USB_CHEP_TXRXBD_n are store in the RAM the clear is doing its intended  function as used in the  usb driver stm32h5xx_ll_usb.h

    #define USB_DRD_SET_CHEP_TX_CNT(USBx,bEpChNum, wCount) \

    do { \

    /* Reset old TX_Count value */ \

    (USB_DRD_PMA_BUFF + (bEpChNum))->TXBD &= USB_PMA_TXBD_COUNTMSK; \

    \

    /* Set the wCount in the dedicated EP_TXBuffer */ \

    (USB_DRD_PMA_BUFF + (bEpChNum))->TXBD |= (uint32_t)((uint32_t)(wCount) << 16U); \

    } while(0)

  2.  The USB_PMA_TXBD_COUNTMSK clears 26 -> 31 and it is not used in the  stm32h5xx_ll_usb.h define for USB_DRD_SET_CHEP_RX_CNT as it's not set as intended this issue this has been escalated internally for further investigation 

Internal ticket number: 165995 (This is an internal tracking number and is not accessible or usable by customers).

this has no effect on the HAL implementation of USB as this mask is not used so using the HAL you shouldn't have any issues .

BR

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.