Skip to content

STM32F7: Add support of the new USB Device API #8688

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

Conversation

bcostm
Copy link
Contributor

@bcostm bcostm commented Nov 9, 2018

Description

Enable new USB Device API on the following STM32F7 platforms:

  • NUCLEO_F746ZG
  • NUCLEO_F756ZG
  • NUCLEO_F767ZI
  • DISCO_F746NG (HS + FS)
  • DISCO_F769NI

The same USB HAL patch as done for STM32F2, STM32F4 and STM32L4 has been applied (see PRs #7322
#8583 #8665)

Tests

  • tests-usb_device-basic tests are OK on ARM, IAR and GCC_ARM
  • tests-usb_device-serial tests are FAIL

Pull request type

[ ] Fix
[ ] Refactor
[X] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

pin_function(PA_10, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)); // ID
pin_function(PA_8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS)); // SOF
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();

#elif defined(TARGET_DISCO_F429ZI)
__HAL_RCC_GPIOB_CLK_ENABLE();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to F7 ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this means you should test again F429 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit removed. Discussion closed...

@bcostm bcostm force-pushed the F7_feature-hal-spec-usb-device branch from 21a6b61 to 4c300e7 Compare November 9, 2018 13:17
@adbridge
Copy link
Contributor

@c1728p9 This has been waiting review for 5 days could you please take a look asap?

@@ -300,10 +302,10 @@ __weak void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
*/
HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd)
{
__HAL_LOCK(hpcd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the lock removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been removed in the F4 (and L4 I think too) so I just did the same. Do you think it can cause a problem ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it being removed in the F4. Can you link to the PR which did this? If there isn't a good reason for removing this I would recommend leaving the lock in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will double-check the PCD Init,Start, Stop functions between the F2, F4, F7 and L4 devices and align them. I will send this change in a separate PR.

@@ -148,8 +149,9 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
{
/* Allocate lock resource and initialize it */
hpcd->Lock = HAL_UNLOCKED;
for (i = 0; i < hpcd->Init.dev_endpoints ; i++)
hpcd->EPLock[i].Lock = HAL_UNLOCKED;
for (i = 0; i < hpcd->Init.dev_endpoints ; i++) { // MBED PATCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see this change in the other PRs. Is this just cosmetic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes just cosmetic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change going to be upstreamed into the cube library? If not you may just want to leave this how it was to minimize the difference between the the cube library and the mbed fork.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 16, 2018

Info: This PR has been re-bundled into a new rollup PR (#8768).

No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged.
If any more commits are made in this PR, this PR will remain open and have to go through CI on its own.

@cmonr
Copy link
Contributor

cmonr commented Nov 16, 2018

@bcostm It looks like both PRs in the last rollup PR had issues. Please take a look at the F7-related build failures: #8768 (comment)

@bcostm bcostm force-pushed the F7_feature-hal-spec-usb-device branch from 4c300e7 to 9039079 Compare November 20, 2018 09:23
@bcostm
Copy link
Contributor Author

bcostm commented Nov 20, 2018

I have rebased and added the NUCLEO_F756ZG board to fix the build error seen on this board during the Rollup PR.

@cmonr
Copy link
Contributor

cmonr commented Nov 22, 2018

Starting CI

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 22, 2018

I stoped the job, there are few other items that have dependency on features for 5.11, this will be restarted later (might take few days if that is OK, as we are close to the weekend)

@OPpuolitaival
Copy link
Contributor

OPpuolitaival commented Nov 22, 2018

.tests-usb_device-serial.CDC USB reconnect test is only one which fails in multiple boards.. seems that this PR is related to that area. Please check what is root cause

Test Result (15 failures / +15)
ARCH_PRO iar_arm / ARCH_PRO-IAR.tests-usb_device-serial.CDC USB reconnect
ARCH_PRO armcc / ARCH_PRO-ARM.tests-usb_device-serial.CDC USB reconnect
ARCH_PRO arm-none-eabi-gcc / ARCH_PRO-GCC_ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F207ZG iar_arm / NUCLEO_F207ZG-IAR.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F207ZG armcc / NUCLEO_F207ZG-ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F746ZG iar_arm / NUCLEO_F746ZG-IAR.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F207ZG arm-none-eabi-gcc / NUCLEO_F207ZG-GCC_ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F746ZG armcc / NUCLEO_F746ZG-ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F746ZG arm-none-eabi-gcc / NUCLEO_F746ZG-GCC_ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F429ZI arm-none-eabi-gcc / NUCLEO_F429ZI-GCC_ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F429ZI armcc / NUCLEO_F429ZI-ARM.tests-usb_device-serial.CDC USB reconnect
NUCLEO_F429ZI iar_arm / NUCLEO_F429ZI-IAR.tests-usb_device-serial.CDC USB reconnect
K64F iar_arm / K64F-IAR.tests-usb_device-serial.CDC USB reconnect
K64F armcc / K64F-ARM.tests-usb_device-serial.CDC USB reconnect
K64F arm-none-eabi-gcc / K64F-GCC_ARM.tests-usb_device-serial.CDC USB reconnect

@bcostm
Copy link
Contributor Author

bcostm commented Nov 22, 2018

I only ran tests-usb_device-basic tests. There is maybe additional work to do for the Serial tests to PASS... @c1728p9 did you run the Serial tests on the NUCLEO_F207ZG board when you did the PR #7322 ?

@cmonr
Copy link
Contributor

cmonr commented Dec 10, 2018

@c1728p9 Mind helping out?

@bcostm bcostm force-pushed the F7_feature-hal-spec-usb-device branch from 5e4890d to 6bfe9ea Compare December 12, 2018 16:24
@c1728p9 c1728p9 force-pushed the feature-hal-spec-usb-device branch from 65d71bb to 0e5dd39 Compare December 19, 2018 21:27
@c1728p9
Copy link
Contributor

c1728p9 commented Dec 19, 2018

Hi @bcostm I rebased the USB feature branch to bring in a fix for the serial test when running with IAR. Because of this you'll need to rebase this PR.

@c1728p9 did you run the Serial tests on the NUCLEO_F207ZG board when you did the PR #7322 ?

Nope, the serial test wasn't written at that time. I did run it as part of the feature branch rebase. It passed all the USB tests - serial and basic:

mbedgt: test suite report:
| target            | platform_name | test suite              | result | elapsed_time (sec) | copy_method |
|-------------------|---------------|-------------------------|--------|--------------------|-------------|
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | OK     | 84.42              | default     |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | OK     | 51.34              | default     |
mbedgt: test suite results: 2 OK
mbedgt: test case report:
| target            | platform_name | test suite              | test case                                  | passed | failed | result | elapsed_time (sec) |
|-------------------|---------------|-------------------------|--------------------------------------------|--------|--------|--------|--------------------|
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test abort                        | 1      | 0      | OK     | 16.63              |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test data correctness             | 1      | 0      | OK     | 1.37               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test data toggle reset            | 1      | 0      | OK     | 0.68               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test halt                         | 1      | 0      | OK     | 10.26              |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test parallel transfers           | 1      | 0      | OK     | 4.72               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | endpoint test parallel transfers ctrl      | 1      | 0      | OK     | 5.05               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb control basic test                     | 1      | 0      | OK     | 0.76               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb control sizes test                     | 1      | 0      | OK     | 0.69               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb control stall test                     | 1      | 0      | OK     | 0.66               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb control stress test                    | 1      | 0      | OK     | 0.9                |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb device reset test                      | 1      | 0      | OK     | 2.48               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb repeated construction destruction test | 1      | 0      | OK     | 2.99               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-basic  | usb soft reconnection test                 | 1      | 0      | OK     | 2.55               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC RX multiple bytes                      | 1      | 0      | OK     | 3.06               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC RX multiple bytes concurrent           | 1      | 0      | OK     | 3.7                |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC RX single bytes                        | 1      | 0      | OK     | 0.54               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC RX single bytes concurrent             | 1      | 0      | OK     | 0.72               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC USB reconnect                          | 1      | 0      | OK     | 1.71               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | CDC loopback                               | 1      | 0      | OK     | 1.52               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | Serial USB reconnect                       | 1      | 0      | OK     | 1.78               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | Serial getc                                | 1      | 0      | OK     | 0.64               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | Serial line coding change                  | 1      | 0      | OK     | 1.07               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | Serial printf/scanf                        | 1      | 0      | OK     | 2.05               |
| NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-usb_device-serial | Serial terminal reopen                     | 1      | 0      | OK     | 0.92               |
mbedgt: test case results: 24 OK
mbedgt: completed in 141.11 sec

@bcostm bcostm force-pushed the F7_feature-hal-spec-usb-device branch from 6bfe9ea to 3253654 Compare December 20, 2018 11:59
@bcostm
Copy link
Contributor Author

bcostm commented Dec 20, 2018

Thanks @c1728p9
I have rebased my branch but Serial tests are still fail (tested on DISCO_F769NI platform). Basic USB tests are OK.

I have tested the NUCLEO_F207ZG/ARM and the Serial tests are also FAIL while they are PASS for you. Humm something's wrong with my setup 😕

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 17, 2019

We will start CI for this feature branch addition (to my understanding this is all fine for the feature branch)

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 17, 2019

CI started

@c1728p9 c1728p9 force-pushed the feature-hal-spec-usb-device branch from 8b6fffb to 15f9389 Compare January 17, 2019 21:16
@mbed-ci
Copy link

mbed-ci commented Jan 17, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 4
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_dynamic-memory-usage

@cmonr
Copy link
Contributor

cmonr commented Jan 18, 2019

CI job restarted: jenkins-ci/mbed-os-ci_dynamic-memory-usage

(Evne thought this still needs a rebase)

@bcostm bcostm force-pushed the F7_feature-hal-spec-usb-device branch from 3253654 to ce6834f Compare January 18, 2019 09:23
@bcostm
Copy link
Contributor Author

bcostm commented Jan 18, 2019

Rebased

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 18, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 19, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 5
Build artifacts

@0xc0170 0xc0170 merged commit ab4f5e3 into ARMmbed:feature-hal-spec-usb-device Jan 21, 2019
@bcostm bcostm deleted the F7_feature-hal-spec-usb-device branch January 22, 2019 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants