Skip to content

CDC implementation without any timers. #399

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
Contributor

Changed version of #388 pull request, without timers and with reduced count on copy memory 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
Member

fpistm commented Dec 27, 2018

I guess this is the same PR than fpistm#1
Build failed due to missing switch protection.

@fpistm fpistm self-requested a review January 17, 2019 15:23
@fpistm fpistm added the enhancement New feature or request label Jan 17, 2019
@fpistm fpistm added this to the 1.5.0 milestone Jan 17, 2019
@fpistm
Copy link
Member

fpistm commented Jan 18, 2019

I will provide soon a rebase of this PR including some fixes (typo, clean,...).
Tested and works fine. Thanks @makarenya very nice implementation.

Edit: Not functional with USB HS.

@fpistm
Copy link
Member

fpistm commented Jan 18, 2019

About HS not working (Discovery F746NG and Win10):

  • Device well recognized
  • analogReadSerial test show nothing
  • Try to disable I_CACHE and D_CACHE without success
  • USB receive test bench result:
port COM14 opened
ignoring startup buffering...
ignoring startup buffering...
ignoring startup buffering...
ignoring startup buffering...
ignoring startup buffering...
Bytes per second = 1
Bytes per second = 3838772
Bytes per second = 1
Bytes per second = 3840000
Bytes per second = 1
Bytes per second = 1
Bytes per second = 3840246
Bytes per second = 1
Bytes per second = 3840000
Bytes per second = 1
Bytes per second = 1
Bytes per second = 3839754
Bytes per second = 1
Bytes per second = 3840737
Bytes per second = 9220839
Average bytes per second = 1

@makarenya
Copy link
Contributor Author

Closed in favor of #410

@makarenya makarenya closed this Jan 21, 2019
@makarenya makarenya deleted the USB_notimer branch March 8, 2019 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants