Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double Buffering doesn't work on STM32G0B1RE #9

Closed
insolace opened this issue Oct 18, 2023 · 6 comments
Closed

Double Buffering doesn't work on STM32G0B1RE #9

insolace opened this issue Oct 18, 2023 · 6 comments

Comments

@insolace
Copy link

It seems that USB Bulk Endpoint double buffering has some issues, at least with the G0 HAL driver that I'm using.

I've made the below modifications which result in the code using the double buffer method to write to the PMA, but then USBD_MIDI_DataIn() is never called which means USBD_MIDI_GetState(&hUsbDeviceFS) never returns to MIDI_IDLE.

In STMCube I've set USB_DRD_FS->Parameter Settings->bulk double buffer = Enabled

In usbd_conf.c I've modified the PMAConfig for double buffers:
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_DBL_BUF, 0xC0);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_DBL_BUF, 0x100);

In stm32g0xx_ll_usb.c I've added:
#include "stm32g0xx_ll_usb.h"
#define USE_USB_DOUBLE_BUFFER 1

@Hypnotriod
Copy link
Owner

Can you try to change 0xC0 address with 0x180 for the 0x01 endpoint, to see if that helps?

@insolace
Copy link
Author

insolace commented Oct 28, 2023 via email

@Hypnotriod
Copy link
Owner

I guess it has only 256 half words of pma. And as always I cannot find any sutable information about pma mapping in g0 mcu. Do you have any documentation which says that this device family have or have not pma onboard?

@insolace
Copy link
Author

insolace commented Oct 28, 2023 via email

@Hypnotriod
Copy link
Owner

Hypnotriod commented Oct 29, 2023

So 0x0180 address is not "out of bounds" than... But 0xC0 should work as well.
Anyway I'm not sure that such kind of device needs a double buffer at 12Mbit.
You can make a speed test to see how many messages you can squeeze. Just make sure that your are sending 16 of them each transaction.

@insolace
Copy link
Author

insolace commented Oct 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants