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

Make FPGA tests to pass on CI targets (SPI, analogIn, PWM) #11682

Merged
merged 6 commits into from
Nov 7, 2019

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Oct 14, 2019

Description

I run the FPGA tests on potential CI targets and got the following results:

  GPIO GPIO_IRQ AnalogIn PWM I2C SPI UART
NUCLEO_F429ZI OK OK OK OK OK OK OK
K64F OK OK OK OK OK OK OK
NUCLEO_F411RE OK OK FAIL: D13 pin not supported OK FAIL TIMEOUT: SPI async issue(lp-ticker ISR execution is too long) OK
DISCO_L475VG_IOT01A FAIL OK OK OK OK OK FAIL
NRF52840_DK OK FAIL OK FAIL: Driver bug/hw limitation FAIL TIMEOUT: 16 bit symbol not supported TIMEOUT
NUCLEO_F303RE OK OK FAIL: D13 pin not supported OK OK OK TIMEOUT
LPC55S69_NS FAIL FAIL OK NOT SUPPORTED FAIL OK TIMEOUT
NUCLEO_L073RZ OK OK FAIL: D13 pin not supported OK OK OK OK

This PR should solve the issues with SPI, AnalogIn, PWM tests.

@jeromecoutant @LMESTM
I noticed the problem with the SPI async mode on NUCLEO_F411RE. It looks like the system tick breaks the transmission. Can you take a look? More details in the commit description.
Also, it looks like PA_5 pin can not be used as analogin. I removed it from the pinmap table. Is this an acceptable solution?

Pull request type

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

Reviewers

@maciejbocianski @fkjagodzinski
@0xc0170 @jamesbeyond

@ciarmcom
Copy link
Member

@mprse, thank you for your changes.
@fkjagodzinski @maciejbocianski @jamesbeyond @0xc0170 @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-test please review.

Copy link
Collaborator

@jeromecoutant jeromecoutant left a comment

Choose a reason for hiding this comment

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

Maybe you should separate TESTS update from targets update ?

@@ -2622,6 +2622,9 @@
"FLASH",
"MPU"
],
"device_has_remove": [
"SPI_ASYNCH"
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't see any reason to remove SPI_ASYNC for this specific target...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main reason is that async mode does not work on this target (test case fails).
The best option would be to find why. I will try to do further investigation, but I wanted first to check if maybe you know something about this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -58,7 +58,7 @@ MBED_WEAK const PinMap PinMap_ADC[] = {
// {PA_2, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 // Connected to STDIO_UART_TX
// {PA_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 // Connected to STDIO_UART_RX
{PA_4, ADC_2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1
{PA_5, ADC_2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2 // Connected to LD2 [Green Led]
// {PA_5, ADC_2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2 // Connected to LD2 [Green Led]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe pin should be added to the restricted list ?
To be tested

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 was thinking about this. But it looks like this pin can not be used as Analogin pin (the results are incorrect), so it should be removed from the pinmap table.

@@ -177,9 +177,9 @@ Case cases[] = {
Case("SPI - mode testing (MODE_1)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode1, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
Case("SPI - mode testing (MODE_2)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode2, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
Case("SPI - mode testing (MODE_3)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode3, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),

#if !defined(TARGET_NRF52840_DK)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this test skipped just for the NRF52840? Is this test tied to a defined behavior in the SPI HAL specification? If so users and library may be relying on all targets having this behavior. If this isn't part of the HAL specification then maybe this could be an optional test? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review!
16-bit symbols are not supported on NRF target. On master, specification is not very restrictive since it must be consistent with all targets. We also don't have capabilities like on the SPI feature branch, so I can't run this case conditionally.

I see two options:

  • remove the test case permanently, but it would be good to run this test on targets that support 16-bit symbols.
  • use the preprocessor to disable the test case on the specific target.

I don't like the first option. Let's consider that we are adding the next target which supports only one clock mode. If we choose this approach, then I would have to remove test cases for other modes.

Also on the feature branch, we have nice specification and tests, but it looks like there are no plans to bring new SPI into the master in the nearest future 😞 Maybe it would be good to add spi_get_capabilities() function on the master.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also on the feature branch, we have nice specification and tests, but it looks like there are no plans to bring new SPI into the master in the nearest future 😞 Maybe it would be good to add spi_get_capabilities() function on the master.

How much work it would be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could add WEAK definition for all targets which returns that all SPI capabilities are supported. And then implement a valid version for CI targets and disable unsupported capabilities for each CI target. This way we could also extend the SPI test on the master. I think that this should be easy to implement.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've realized just now this has not yet been fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at the moment. This must be discussed. I'll try to write an email about this. The same problem we have already here:

// Some targets don't support input pull mode.
#if !defined(TARGET_NANO100) && \
!defined(TARGET_NUC472) && \
!defined(TARGET_M451)
// Test GPIO used as an input.
gpio_dir(&gpio, PIN_INPUT);

@ABOSTM
Copy link
Contributor

ABOSTM commented Oct 18, 2019

Hi @mprse ,
I analysed issue with SPI async mode and there is an issue with MBED_TICKLESS
See details in PR #11713
PR #11713 removes MBED_TICKLESS from STM32F4 boards.
With this PR you can revert your commit : "NUCLEO_F411RE: disable spi asynch mode support"

@mprse
Copy link
Contributor Author

mprse commented Oct 21, 2019

@ABOSTM 👍 Thank you for checking this.

I added a related comment in PR #11713 : #11713 (comment).

@mprse mprse force-pushed the fpga_tests_CI_targets branch from f520ebc to 164286c Compare October 23, 2019 06:53
@mprse
Copy link
Contributor Author

mprse commented Oct 23, 2019

Dropped commit which disables SPI async mode for STM F4. SPI async mode fails because of too long execution of lp-ticker ISR. Verified that PR #11713 fixes the problem.

@0xc0170 0xc0170 requested a review from jeromecoutant October 23, 2019 08:26
@mprse
Copy link
Contributor Author

mprse commented Oct 28, 2019

Please review @maciejbocianski @0xc0170 @jamesbeyond .

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Just one cosmetic change needed

@@ -295,9 +295,9 @@ void pwmout_period_us(pwmout_t *obj, int period)
void pwmout_pulsewidth(pwmout_t *obj, float pulse)
{
DEBUG_PRINTF("pwmout_pulsewidt: %f\r\n", pulse);

Copy link
Contributor

Choose a reason for hiding this comment

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

added some spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 28, 2019

Started first CI run.

I also left a comment, what can we do about the nrf target skip test, would not rather to have it there.

@mbed-ci
Copy link

mbed-ci commented Oct 28, 2019

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-IAR

@mprse
Copy link
Contributor Author

mprse commented Oct 29, 2019

Test run: FAILED

Not sure but it looks like some CI issue. Few boards in Jenkins are marked with an exclamation mark with info passed in 0 s, but marked as unstable.

mprse added 4 commits October 30, 2019 14:34
…5) pin.

Analogin test fails on D13(PA_5) pin. When logic one (3.3V) is provided on this pin ADC reads 0.86 value. On other pins we got 0.98.
This is caused because this pin is connected to led2.
Looks like the PWM works fine on NRF52840_DK target, but this target has hardware limitation and the max PWM period is ‭32 767‬ us.
That is why test cases when the period is set 50 ms are failing.
The test will be modified to test the 30 ms period instead of 50 ms, so the test can pass on all CI targets.
@mprse mprse force-pushed the fpga_tests_CI_targets branch from 48fa594 to 766c364 Compare October 30, 2019 14:02
@mprse
Copy link
Contributor Author

mprse commented Oct 30, 2019

Rebased to solve conflicts. Ready for CI (last time some problems were encountered during CI).

mprse added 2 commits November 6, 2019 09:48
Add also default weak version of spi_get_capabilities() which provides default/most common SPI parameters.
This function can be replaced if a specific target has different capabilities.
@mprse
Copy link
Contributor Author

mprse commented Nov 6, 2019

I also left a comment, what can we do about the nrf target skip test, would not rather to have it there.

@0xc0170 I added spi_get_capabilities() to SPI HAL API and used it in the SPI FPGA test to skip unsupported test cases (solution for NRF target). This will also allow us to extend the test. This will be done in the separate PR.

Can we start CI?

Copy link
Contributor

@jamesbeyond jamesbeyond left a comment

Choose a reason for hiding this comment

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

Looks good, well done !

@mprse
Copy link
Contributor Author

mprse commented Nov 7, 2019

@0xc0170 Can we start CI?

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 7, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Nov 7, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 2
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 7, 2019

Set this to 6.0 (will be checked again and might get earlier in the feature release).

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