Skip to content

CDC implementation without any timers #1

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

Closed
wants to merge 32 commits into from

Conversation

makarenya
Copy link

CDC implementation without any timers and with reduced count of memory copy operations.

I tried to achieve the following goals: remove the dependency on the timer, and reduce the number of memcpy operations.

For example, the STM32F103C8T6 doesn't have so many timers, and using one of them for the CDC, is not so good.

And memcpy operations.
In fact, they occur too often. First, in the USBSerial::write method the data is copied from the caller buffer into the UserTxBuffer, then the CDC_TIM_PeriodElapsedCallback the same data is copied into the StackTxBuffer, this data is transferred to USBD_CDC_SetTxBuffer without copying, and from where they are copied to PMA. 3 copy operations, and I managed two.

Same situation with the receive.

fpistm and others added 30 commits December 20, 2018 09:23
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Below switch already define in usb_def.h, if not defined:
USBD_MAX_NUM_CONFIGURATION
USBD_SUPPORT_USER_STRING
USBD_SELF_POWERED

Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
GPIO config will be handle thanks Peripherals Pins

Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Added fixes as advised by @ktand

* If the USB packet to be sent is equal to the USB buffer size
  (64 bytes), a Zero Length Packet must be sent. Otherwise the
  USB CDC connection will fail.
* Add check for linestate in CDC_Flush and in
  CDC_TIM_PeriodElapsedCallback to ignore transmission if the
  device is disconnected.
Add USB menu for Generic F4
Change PID to 0x0483

Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm
Copy link
Owner

fpistm commented Dec 27, 2018

Hi @makarenya
thanks a lot. I will test it when I will back from vacation.

@fpistm fpistm force-pushed the USB branch 5 times, most recently from 5c3d321 to eabb1b9 Compare January 11, 2019 08:47
@fpistm fpistm closed this Jan 12, 2019
fpistm pushed a commit that referenced this pull request Jan 31, 2019
Fix BLUEPILL_F103C6 definition
@makarenya makarenya deleted the USB_notimer branch March 8, 2019 18:22
fpistm pushed a commit that referenced this pull request Aug 26, 2019
fpistm pushed a commit that referenced this pull request May 14, 2020
fpistm pushed a commit that referenced this pull request May 6, 2022
fix: variant declaration
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

Successfully merging this pull request may close these issues.

3 participants