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

Allow MISO/MOSI set to NC during SPI initialisation (fix for issue #12435) #12460

Merged
merged 4 commits into from
Mar 3, 2020

Conversation

mprse
Copy link
Contributor

@mprse mprse commented Feb 18, 2020

Summary of changes

This PR fixes issue #12435.

Static pin-map extension required to use pin_function() and pin_mode() functions instead of pinmap_pinout(). Unfortunately pin_function() does not allow passing NC pin.
The proposition is to call pin_function() and pin_mode() only if MISO/MOSI pin is not NC.

Additionally extended SPI FPGA test to verify all possible pin configurations including MISO and MOSI unconnected.
The idea is to add also similar tests for other peripherals if this proposal will be approved. I think that this should be added for peripherals that use more than one pin and provide the availability to specify at least one pin as NC.

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

| target                | platform_name | test suite                             | result | elapsed_time (sec) | copy_method |
|-----------------------|---------------|----------------------------------------|--------|--------------------|-------------|
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | OK     | 26.39              | default     |
mbedgt: test suite results: 1 OK
mbedgt: test case report:
| target                | platform_name | test suite                             | test case                                                 | passed | failed | result | elapsed_time (sec) |
|-----------------------|---------------|----------------------------------------|-----------------------------------------------------------|--------|--------|--------|--------------------|
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (hw ss)                                  | 1      | 0      | OK     | 0.14               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (sw ss)                                  | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test                                          | 1      | 0      | OK     | 0.38               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test (direct init)                            | 1      | 0      | OK     | 0.37               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write                                         | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write(one sym)                                | 1      | 0      | OK     | 0.21               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx < rx                                     | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx > rx                                     | 1      | 0      | OK     | 0.21               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (2 MHz)                           | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (200 kHz)                         | 1      | 0      | OK     | 0.24               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities max)                | 1      | 0      | OK     | 0.23               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities min)                | 1      | 0      | OK     | 0.24               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling                                | 1      | 0      | OK     | 0.14               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling(block)                         | 1      | 0      | OK     | 0.14               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins                             | 1      | 0      | OK     | 0.54               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC)                  | 1      | 0      | OK     | 0.24               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC, MISO/MOSI == NC) | 1      | 0      | OK     | 0.59               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_1)                               | 1      | 0      | OK     | 0.23               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_2)                               | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_3)                               | 1      | 0      | OK     | 0.22               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (12)                            | 1      | 0      | OK     | 0.29               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (16)                            | 1      | 0      | OK     | 0.24               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (24)                            | 1      | 0      | OK     | 0.28               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (32)                            | 1      | 0      | OK     | 0.29               |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (4)                             | 1      | 0      | OK     | 0.28               |
mbedgt: test case results: 25 OK

| target                      | platform_name       | test suite                             | result | elapsed_time (sec) | copy_method |
|-----------------------------|---------------------|----------------------------------------|--------|--------------------|-------------|
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | OK     | 28.96              | default     |
mbedgt: test suite results: 1 OK
mbedgt: test case report:
| target                      | platform_name       | test suite                             | test case                                                 | passed | failed | result | elapsed_time (sec) |
|-----------------------------|---------------------|----------------------------------------|-----------------------------------------------------------|--------|--------|--------|--------------------|
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (hw ss)                                  | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (sw ss)                                  | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test                                          | 1      | 0      | OK     | 0.27               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test (direct init)                            | 1      | 0      | OK     | 0.27               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write                                         | 1      | 0      | OK     | 0.22               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write(one sym)                                | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx < rx                                     | 1      | 0      | OK     | 0.22               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx > rx                                     | 1      | 0      | OK     | 0.22               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (2 MHz)                           | 1      | 0      | OK     | 0.22               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (200 kHz)                         | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities max)                | 1      | 0      | OK     | 0.24               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities min)                | 1      | 0      | OK     | 0.25               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling                                | 1      | 0      | OK     | 0.24               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling(block)                         | 1      | 0      | OK     | 0.24               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins                             | 1      | 0      | OK     | 0.95               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC)                  | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC, MISO/MOSI == NC) | 1      | 0      | OK     | 0.64               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_1)                               | 1      | 0      | OK     | 0.22               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_2)                               | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_3)                               | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (12)                            | 1      | 0      | OK     | 0.28               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (16)                            | 1      | 0      | OK     | 0.23               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (24)                            | 1      | 0      | OK     | 0.28               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (32)                            | 1      | 0      | OK     | 0.29               |
| DISCO_L475VG_IOT01A-GCC_ARM | DISCO_L475VG_IOT01A | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (4)                             | 1      | 0      | OK     | 0.29               |
mbedgt: test case results: 25 OK


| target              | platform_name | test suite                             | result | elapsed_time (sec) | copy_method |
|---------------------|---------------|----------------------------------------|--------|--------------------|-------------|
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | OK     | 37.77              | default     |
mbedgt: test suite results: 1 OK
mbedgt: test case report:
| target              | platform_name | test suite                             | test case                                                 | passed | failed | result | elapsed_time (sec) |
|---------------------|---------------|----------------------------------------|-----------------------------------------------------------|--------|--------|--------|--------------------|
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test                                          | 1      | 0      | OK     | 0.19               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test (direct init)                            | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write                                         | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write(one sym)                                | 1      | 0      | OK     | 0.19               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx < rx                                     | 1      | 0      | OK     | 0.27               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx > rx                                     | 1      | 0      | OK     | 0.25               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (2 MHz)                           | 1      | 0      | OK     | 0.22               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (200 kHz)                         | 1      | 0      | OK     | 0.22               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities max)                | 1      | 0      | OK     | 0.22               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities min)                | 1      | 0      | OK     | 0.24               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling                                | 1      | 0      | OK     | 0.22               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling(block)                         | 1      | 0      | OK     | 0.23               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins                             | 1      | 0      | OK     | 0.59               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC)                  | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC, MISO/MOSI == NC) | 1      | 0      | OK     | 0.39               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_1)                               | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_2)                               | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_3)                               | 1      | 0      | OK     | 0.22               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (12)                            | 1      | 0      | OK     | 0.28               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (16)                            | 1      | 0      | OK     | 0.21               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (24)                            | 1      | 0      | OK     | 0.26               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (32)                            | 1      | 0      | OK     | 0.27               |
| LPC55S69_NS-GCC_ARM | LPC55S69      | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (4)                             | 1      | 0      | OK     | 0.27               |
mbedgt: test case results: 23 OK

| target       | platform_name | test suite                             | result | elapsed_time (sec) | copy_method |
|--------------|---------------|----------------------------------------|--------|--------------------|-------------|
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | OK     | 32.29              | default     |
mbedgt: test suite results: 1 OK
mbedgt: test case report:
| target       | platform_name | test suite                             | test case                                                 | passed | failed | result | elapsed_time (sec) |
|--------------|---------------|----------------------------------------|-----------------------------------------------------------|--------|--------|--------|--------------------|
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (hw ss)                                  | 1      | 0      | OK     | 0.22               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - async mode (sw ss)                                  | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test                                          | 1      | 0      | OK     | 0.29               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - basic test (direct init)                            | 1      | 0      | OK     | 0.3                |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write                                         | 1      | 0      | OK     | 0.2                |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - block write(one sym)                                | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx < rx                                     | 1      | 0      | OK     | 0.26               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - buffers tx > rx                                     | 1      | 0      | OK     | 0.26               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (2 MHz)                           | 1      | 0      | OK     | 0.22               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (200 kHz)                         | 1      | 0      | OK     | 0.23               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities max)                | 1      | 0      | OK     | 0.22               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - frequency testing (capabilities min)                | 1      | 0      | OK     | 0.25               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling                                | 1      | 0      | OK     | 0.22               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - hardware ss handling(block)                         | 1      | 0      | OK     | 0.23               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins                             | 1      | 0      | OK     | 0.81               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC)                  | 1      | 0      | OK     | 0.52               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - init/free test all pins (CS == NC, MISO/MOSI == NC) | 1      | 0      | OK     | 0.22               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_1)                               | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_2)                               | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - mode testing (MODE_3)                               | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (12)                            | 1      | 0      | OK     | 0.27               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (16)                            | 1      | 0      | OK     | 0.21               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (24)                            | 1      | 0      | OK     | 0.27               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (32)                            | 1      | 0      | OK     | 0.26               |
| K64F-GCC_ARM | K64F          | tests-mbed_hal_fpga_ci_test_shield-spi | SPI - symbol size testing (4)                             | 1      | 0      | OK     | 0.27               |
mbedgt: test case results: 25 OK

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Reviewers

@jeromecoutant @LMESTM @mmahadevan108
@fkjagodzinski @maciejbocianski
@jamesbeyond


Static pinmap extension required to use pin_function() and pin_mode() functions instead of pinmap_pinout(). Unfortunatelly pin_function() does not allow passing NC pin.
Call pin_function() and pin_mode() only if MISO/MOSI pin is not NC.
@LMESTM
Copy link
Contributor

LMESTM commented Feb 18, 2020

Static pin-map extension required to use pin_function() and pin_mode() functions instead of pinmap_pinout(). Unfortunately pin_function() does not allow passing NC pin.

Because of this, we end-up with a lot of checks (if (pin != NC)) everywhere in the code, including in this PR. Shouldn't we actually rather change pin_function to simply return when NC pin is passed as a parameter ?

Other than that this question, I am fine with the change as it is now - so I will approve it.

Copy link
Contributor

@LMESTM LMESTM left a comment

Choose a reason for hiding this comment

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

For the ST driver part - looks ok to me

@ciarmcom
Copy link
Member

@mprse, thank you for your changes.
@fkjagodzinski @LMESTM @maclobdell @maciejbocianski @jamesbeyond @mmahadevan108 @jeromecoutant @ARMmbed/mbed-os-hal @ARMmbed/mbed-os-test @ARMmbed/mbed-os-maintainers please review.

@mmahadevan108
Copy link
Contributor

Can this update be extended to include K66F and KW41D?

@mprse
Copy link
Contributor Author

mprse commented Feb 19, 2020

Can this update be extended to include K66F and KW41D?

K66F and KW41D are not affected by Issue #12435. This only applies to targets with static pinmap support enabled (PR #11892).

Shouldn't we actually rather change pin_function to simply return when NC pin is passed as a parameter ?

I agree this is good. This should be changed in the future if there is no objection to change pin_function() as described.

@jeromecoutant
Copy link
Collaborator

Quick test done:

[1582099379.56][CONN][RXD] >>> Running case #3: 'SPI - init/free test all pins (CS == NC, MISO/MOSI == NC)'...
[1582099379.79][CONN][RXD] 1073819648 - peripheral tested on port: peripheral=(1073819648) MOSI=(D11) MISO=(D12) SCLK=(D13) ...succeeded

Seems that none of MOSI/MISO are set to NC ?

@mprse
Copy link
Contributor Author

mprse commented Feb 19, 2020

Seems that none of MOSI/MISO are set to NC ?

Good point. I used one_peripheral() function to find pins for testing and in the test code switch MISO/MOSI to NC. So NC has been tested, but the message is inconsistent. I will add extra message in test case.

@LMESTM
Copy link
Contributor

LMESTM commented Feb 19, 2020

Shouldn't we actually rather change pin_function to simply return when NC pin is passed as a parameter ?

I agree this is good. This should be changed in the future if there is no objection to change pin_function() as described.

Seems fairly straightforward for ST targets, we would need to replace the ASSERT by a simple return.
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/pinmap.c#L62

@jeromecoutant
Copy link
Collaborator

Seems that none of MOSI/MISO are set to NC ?

OK, seems it is only print issue as test is doing 2 sub cases: 1 with only MOSI pin, 1 with MISO...

Maybe a new type "SPINoCs1Line" could be good instead of SPINoCSPort ?

@mprse
Copy link
Contributor Author

mprse commented Feb 19, 2020

With the extra prints it will look like this:

[1582100821.99][CONN][RXD] >>> Running case #3: 'SPI - init/free test all pins (CS == NC, MISO/MOSI == NC)'...
[1582100822.08][CONN][INF] found KV pair in stream: {{__testcase_start;SPI - init/free test all pins (CS == NC, MISO/MOSI == NC)}}, queued...
[1582100822.12][CONN][RXD] ***Testing one SPI pin configuration***
[1582100822.22][CONN][RXD] 1073819648 - peripheral tested on port: peripheral=(1073819648) MOSI=(D11) MISO=(D12) SCLK=(D13) ...
[1582100822.27][CONN][RXD] Testing: MOSI = NC. Testing: MISO = NC. succeeded
[1582100822.36][CONN][INF] found KV pair in stream: {{__testcase_finish;SPI - init/free test all pins (CS == NC, MISO/MOSI == NC);1;0}}, queued...
[1582100822.44][CONN][RXD] >>> 'SPI - init/free test all pins (CS == NC, MISO/MOSI == NC)': 1 passed, 0 failed

Is that acceptable?
Adding SPINoCs1Line is a good solution, but we would need to add two types one for MOSI and one for MISO. For the purpose of this simple case, I think that this extra print is ok.

@mprse
Copy link
Contributor Author

mprse commented Feb 19, 2020

Seems fairly straightforward for ST targets, we would need to replace the ASSERT by a simple return.

@LMESTM please review 713be4f.

@mmahadevan108 Is such change acceptable also for NXP targets?

Test results (NUCLEO_F429ZI):

| target                | platform_name | test suite                                  | result | elapsed_time (sec) | copy_method |
|-----------------------|---------------|---------------------------------------------|--------|--------------------|-------------|
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-analogin | OK     | 18.81              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio     | OK     | 21.59              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-gpio_irq | OK     | 21.7               | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-i2c      | OK     | 20.53              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-pwm      | OK     | 46.96              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-spi      | OK     | 28.35              | default     |
| NUCLEO_F429ZI-GCC_ARM | NUCLEO_F429ZI | tests-mbed_hal_fpga_ci_test_shield-uart     | OK     | 22.71              | default     |
mbedgt: test suite results: 7 OK

@mprse
Copy link
Contributor Author

mprse commented Feb 20, 2020

ping @mmahadevan108

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 style, otherwise looks fine to em

} else {
} else if (mosi == NC) {
spi_per = (SPIName)pinmap_merge(spi_miso, spi_sclk);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

else should be on line 50

@mergify mergify bot added needs: CI and removed needs: review labels Feb 21, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 24, 2020

Started CI meanwhile we complete reviews

@mbed-ci
Copy link

mbed-ci commented Feb 24, 2020

Test run: SUCCESS

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

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 27, 2020

CI completed, just one approval. Please complete your reviews

@0xc0170 0xc0170 removed request for a team February 27, 2020 13:54
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 2, 2020

Marked as ready for merge, would like to integrate later today

@0xc0170 0xc0170 merged commit bad9c57 into ARMmbed:master Mar 3, 2020
@mergify mergify bot removed the ready for merge label Mar 3, 2020
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.

7 participants