-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
@mprse, thank you for your changes. |
There was a problem hiding this 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 ?
targets/targets.json
Outdated
@@ -2622,6 +2622,9 @@ | |||
"FLASH", | |||
"MPU" | |||
], | |||
"device_has_remove": [ | |||
"SPI_ASYNCH" |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
mbed-os/TESTS/mbed_hal_fpga_ci_test_shield/gpio/main.cpp
Lines 67 to 72 in df79609
// 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 👍 Thank you for checking this. I added a related comment in PR #11713 : #11713 (comment). |
f520ebc
to
164286c
Compare
Dropped commit which disables SPI async mode for |
Please review @maciejbocianski @0xc0170 @jamesbeyond . |
There was a problem hiding this 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); | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
164286c
to
48fa594
Compare
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. |
Test run: FAILEDSummary: 3 of 4 test jobs failed Failed test jobs:
|
Not sure but it looks like some CI issue. Few boards in Jenkins are marked with an exclamation mark with info |
…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.
Fix pwm nrf
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.
48fa594
to
766c364
Compare
Rebased to solve conflicts. Ready for CI (last time some problems were encountered during CI). |
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.
… unsupported features
@0xc0170 I added Can we start CI? |
There was a problem hiding this 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 !
@0xc0170 Can we start CI? |
CI started |
Test run: SUCCESSSummary: 12 of 12 test jobs passed |
Set this to 6.0 (will be checked again and might get earlier in the feature release). |
Description
I run the FPGA tests on potential CI targets and got the following results:
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 asanalogin
. I removed it from the pinmap table. Is this an acceptable solution?Pull request type
Reviewers
@maciejbocianski @fkjagodzinski
@0xc0170 @jamesbeyond